svn commit: r346730 - in head/sys/powerpc: aim powerpc

2019-04-25 Thread Justin Hibbits
Author: jhibbits
Date: Fri Apr 26 03:18:49 2019
New Revision: 346730
URL: https://svnweb.freebsd.org/changeset/base/346730

Log:
  powerpc64: Clear FSCR SPR, so that it's in a known state
  
  This now turns any access to the DSCR SPR into a SIGILL.  Later commits will
  make DCSR work correctly on POWER8 and POWER9.
  
  PR:   237208

Modified:
  head/sys/powerpc/aim/mp_cpudep.c
  head/sys/powerpc/powerpc/cpu.c

Modified: head/sys/powerpc/aim/mp_cpudep.c
==
--- head/sys/powerpc/aim/mp_cpudep.cFri Apr 26 03:13:44 2019
(r346729)
+++ head/sys/powerpc/aim/mp_cpudep.cFri Apr 26 03:18:49 2019
(r346730)
@@ -98,6 +98,12 @@ cpudep_ap_early_bootstrap(void)
 
mtspr(SPR_LPCR, lpcr);
isync();
+
+   /*
+* Nuke FSCR, to be managed on a per-process basis
+* later.
+*/
+   mtspr(SPR_FSCR, 0);
}
 #endif
break;

Modified: head/sys/powerpc/powerpc/cpu.c
==
--- head/sys/powerpc/powerpc/cpu.c  Fri Apr 26 03:13:44 2019
(r346729)
+++ head/sys/powerpc/powerpc/cpu.c  Fri Apr 26 03:18:49 2019
(r346730)
@@ -663,6 +663,9 @@ cpu_powerx_setup(int cpuid, uint16_t vers)
if ((mfmsr() & PSL_HV) == 0)
return;
 
+   /* Nuke the FSCR, to disable all facilities. */
+   mtspr(SPR_FSCR, 0);
+
/* Configure power-saving */
switch (vers) {
case IBMPOWER8:
___
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: r346729 - head/sys/powerpc/include

2019-04-25 Thread Justin Hibbits
Author: jhibbits
Date: Fri Apr 26 03:13:44 2019
New Revision: 346729
URL: https://svnweb.freebsd.org/changeset/base/346729

Log:
  powerpc: Fix whitespace in SPR header.

Modified:
  head/sys/powerpc/include/spr.h

Modified: head/sys/powerpc/include/spr.h
==
--- head/sys/powerpc/include/spr.h  Fri Apr 26 02:30:03 2019
(r346728)
+++ head/sys/powerpc/include/spr.h  Fri Apr 26 03:13:44 2019
(r346729)
@@ -122,19 +122,19 @@
 #defineSPR_EID 0x051   /* ..8 Exception Interrupt ??? 
*/
 #defineSPR_NRI 0x052   /* ..8 Exception Interrupt ??? 
*/
 #defineSPR_FSCR0x099   /* Facility Status and Control 
Register */
-#define FSCR_IC_MASK 0xFF00ULL /* FSCR[0:7] is 
Interrupt Cause */
-#define FSCR_IC_FP   0xULL /* FP unavailable */
-#define FSCR_IC_VSX  0x0100ULL /* VSX unavailable */
-#define FSCR_IC_DSCR 0x0200ULL /* Access to the DSCR 
at SPRs 3 or 17 */
-#define FSCR_IC_PM   0x0300ULL /* Read or write access 
of a Performance Monitor SPR in group A */
-#define FSCR_IC_BHRB 0x0400ULL /* Execution of a BHRB 
Instruction */
-#define FSCR_IC_HTM  0x0500ULL /* Access to a 
Transactional Memory */
+#define  FSCR_IC_MASK0xFF00ULL /* FSCR[0:7] is 
Interrupt Cause */
+#define  FSCR_IC_FP  0xULL /* FP 
unavailable */
+#define  FSCR_IC_VSX 0x0100ULL /* VSX 
unavailable */
+#define  FSCR_IC_DSCR0x0200ULL /* Access to 
the DSCR at SPRs 3 or 17 */
+#define  FSCR_IC_PM  0x0300ULL /* Read or 
write access of a Performance Monitor SPR in group A */
+#define  FSCR_IC_BHRB0x0400ULL /* Execution of 
a BHRB Instruction */
+#define  FSCR_IC_HTM 0x0500ULL /* Access to a 
Transactional Memory */
 /* Reserved 0x0600ULL */
-#define FSCR_IC_EBB  0x0700ULL /* Access to 
Event-Based Branch */
-#define FSCR_IC_TAR  0x0800ULL /* Access to Target 
Address Register */
-#define FSCR_IC_STOP 0x0900ULL /* Access to the 'stop' 
instruction in privileged non-hypervisor state */
-#define FSCR_IC_MSG  0x0A00ULL /* Access to 'msgsndp' 
or 'msgclrp' instructions */
-#define FSCR_IC_SCV  0x0C00ULL /* Execution of a 'scv' 
instruction */
+#define  FSCR_IC_EBB 0x0700ULL /* Access to 
Event-Based Branch */
+#define  FSCR_IC_TAR 0x0800ULL /* Access to 
Target Address Register */
+#define  FSCR_IC_STOP0x0900ULL /* Access to 
the 'stop' instruction in privileged non-hypervisor state */
+#define  FSCR_IC_MSG 0x0A00ULL /* Access to 
'msgsndp' or 'msgclrp' instructions */
+#define  FSCR_IC_SCV 0x0C00ULL /* Execution of 
a 'scv' instruction */
 #defineSPR_USPRG0  0x100   /* 4.. User SPR General 0 */
 #defineSPR_VRSAVE  0x100   /* .6. AltiVec VRSAVE */
 #defineSPR_SPRG0   0x110   /* 468 SPR General 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: r346728 - in head/sys/powerpc: include powerpc

2019-04-25 Thread Justin Hibbits
Author: jhibbits
Date: Fri Apr 26 02:30:03 2019
New Revision: 346728
URL: https://svnweb.freebsd.org/changeset/base/346728

Log:
  powerpc: Add another feature2 flag, and update power9 definition
  
  Also fix the definition of PPC_FEATURE2_HTM_NOSUSPEND, a bad line copy.
  
  This now closer matches Linux's definition.

Modified:
  head/sys/powerpc/include/cpu.h
  head/sys/powerpc/powerpc/cpu.c

Modified: head/sys/powerpc/include/cpu.h
==
--- head/sys/powerpc/include/cpu.h  Fri Apr 26 02:19:25 2019
(r346727)
+++ head/sys/powerpc/include/cpu.h  Fri Apr 26 02:30:03 2019
(r346728)
@@ -81,6 +81,7 @@ extern u_long cpu_features2;
 #definePPC_FEATURE2_ARCH_2_07  0x8000
 #definePPC_FEATURE2_HTM0x4000
 #definePPC_FEATURE2_DSCR   0x2000
+#definePPC_FEATURE2_EBB0x1000
 #definePPC_FEATURE2_ISEL   0x0800
 #definePPC_FEATURE2_TAR0x0400
 #definePPC_FEATURE2_HAS_VEC_CRYPTO 0x0200
@@ -89,7 +90,7 @@ extern u_long cpu_features2;
 #definePPC_FEATURE2_HAS_IEEE1280x0040
 #definePPC_FEATURE2_DARN   0x0020
 #definePPC_FEATURE2_SCV0x0010
-#definePPC_FEATURE2_HTM_NOSUSPEND  0x0100
+#definePPC_FEATURE2_HTM_NOSUSPEND  0x0008
 
 #definePPC_FEATURE_BITMASK 
\
"\20"   \

Modified: head/sys/powerpc/powerpc/cpu.c
==
--- head/sys/powerpc/powerpc/cpu.c  Fri Apr 26 02:19:25 2019
(r346727)
+++ head/sys/powerpc/powerpc/cpu.c  Fri Apr 26 02:30:03 2019
(r346728)
@@ -183,7 +183,8 @@ static const struct cputab models[] = {
   PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP | PPC_FEATURE_ARCH_2_05 |
   PPC_FEATURE_ARCH_2_06 | PPC_FEATURE_HAS_VSX | PPC_FEATURE_TRUE_LE,
   PPC_FEATURE2_ARCH_2_07 | PPC_FEATURE2_HTM | PPC_FEATURE2_DSCR |
-  PPC_FEATURE2_ISEL | PPC_FEATURE2_TAR | PPC_FEATURE2_HAS_VEC_CRYPTO |
+  PPC_FEATURE2_EBB | PPC_FEATURE2_ISEL | PPC_FEATURE2_TAR |
+  PPC_FEATURE2_HAS_VEC_CRYPTO | PPC_FEATURE2_HTM_NOSC |
   PPC_FEATURE2_ARCH_3_00 | PPC_FEATURE2_HAS_IEEE128 |
   PPC_FEATURE2_DARN, cpu_powerx_setup },
 { "Motorola PowerPC 7400", MPC7400,REVFMT_MAJMIN,
___
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: r346727 - stable/11/usr.sbin/acpi/acpidump

2019-04-25 Thread Marcin Wojtas
Author: mw
Date: Fri Apr 26 02:19:25 2019
New Revision: 346727
URL: https://svnweb.freebsd.org/changeset/base/346727

Log:
  MFC r343455: Fix tpm2 acpidump compilation on 32-bit

Modified:
  stable/11/usr.sbin/acpi/acpidump/acpi.c

Modified: stable/11/usr.sbin/acpi/acpidump/acpi.c
==
--- stable/11/usr.sbin/acpi/acpidump/acpi.c Fri Apr 26 02:16:57 2019
(r346726)
+++ stable/11/usr.sbin/acpi/acpidump/acpi.c Fri Apr 26 02:19:25 2019
(r346727)
@@ -868,7 +868,7 @@ static void acpi_handle_tpm2(ACPI_TABLE_HEADER *sdp)
printf (BEGIN_COMMENT);
acpi_print_sdt(sdp);
tpm2 = (ACPI_TABLE_TPM2 *) sdp;
-   printf ("\t\tControlArea=%lx\n", tpm2->ControlAddress);
+   printf ("\t\tControlArea=%jx\n", tpm2->ControlAddress);
printf ("\t\tStartMethod=%x\n", tpm2->StartMethod); 
printf (END_COMMENT);
 }
___
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: r346726 - stable/12/usr.sbin/acpi/acpidump

2019-04-25 Thread Marcin Wojtas
Author: mw
Date: Fri Apr 26 02:16:57 2019
New Revision: 346726
URL: https://svnweb.freebsd.org/changeset/base/346726

Log:
  MFC r343455: Fix tpm2 acpidump compilation on 32-bit

Modified:
  stable/12/usr.sbin/acpi/acpidump/acpi.c

Modified: stable/12/usr.sbin/acpi/acpidump/acpi.c
==
--- stable/12/usr.sbin/acpi/acpidump/acpi.c Fri Apr 26 01:58:36 2019
(r346725)
+++ stable/12/usr.sbin/acpi/acpidump/acpi.c Fri Apr 26 02:16:57 2019
(r346726)
@@ -977,7 +977,7 @@ static void acpi_handle_tpm2(ACPI_TABLE_HEADER *sdp)
printf (BEGIN_COMMENT);
acpi_print_sdt(sdp);
tpm2 = (ACPI_TABLE_TPM2 *) sdp;
-   printf ("\t\tControlArea=%lx\n", tpm2->ControlAddress);
+   printf ("\t\tControlArea=%jx\n", tpm2->ControlAddress);
printf ("\t\tStartMethod=%x\n", tpm2->StartMethod); 
printf (END_COMMENT);
 }
___
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: r346716 - stable/11/usr.sbin/bhyve

2019-04-25 Thread Alexander Motin



On 25.04.2019 18:58, Rodney W. Grimes wrote:
>> Author: mav
>> Date: Thu Apr 25 22:53:25 2019
>> New Revision: 346716
>> URL: https://svnweb.freebsd.org/changeset/base/346716
>>
>> Log:
>>   Fix build with r346707.
>>
>> Modified:
>>   stable/11/usr.sbin/bhyve/Makefile
>>
>> Modified: stable/11/usr.sbin/bhyve/Makefile
>> ==
>> --- stable/11/usr.sbin/bhyve/MakefileThu Apr 25 22:52:44 2019
>> (r346715)
>> +++ stable/11/usr.sbin/bhyve/MakefileThu Apr 25 22:53:25 2019
>> (r346716)
>> @@ -3,6 +3,7 @@
>>  #
>>  
>>  .include 
>> +CFLAGS+=-I${SRCTOP}/sys
>>  
>>  PROG=   bhyve
>>  PACKAGE=bhyve
> 
> This is an unnoted direct committ to stable/11?
> 
> I am unclear as to why this is needed, it should be picking these
> headers up from the tmp directory in obj.

It is part of r334940 in head, which is not going to be merged to 11.

-- 
Alexander Motin
___
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: r346725 - in stable/11/sys: conf dev/random dev/tpm sys

2019-04-25 Thread Marcin Wojtas
Author: mw
Date: Fri Apr 26 01:58:36 2019
New Revision: 346725
URL: https://svnweb.freebsd.org/changeset/base/346725

Log:
  MFC r345438,r345842,r346259,r346261: TPM as possible entropy source
  
  r345438:
  Allow using TPM as entropy source
  
  TPM has a built-in RNG, with its own entropy source.
  The driver was extended to harvest 16 random bytes from TPM every 10 seconds.
  A new build option "TPM_HARVEST" was introduced - for now, however, it
  is not enabled by default in the GENERIC config.
  
  Reviewed by: markm, delphij
  Approved by: secteam
  
  r345842:
  Add a cv_wait to the TPM2.0 harvesting function
  
  r346259:
  tpm: Prevent session hijack
  
  r346261:
  Improve tpm20 style
  
  Submitted by: Kornel Duleba 
  Obtained from: Semihalf
  Sponsored by: Stormshield

Modified:
  stable/11/sys/conf/options
  stable/11/sys/dev/random/random_harvestq.c
  stable/11/sys/dev/tpm/tpm20.c
  stable/11/sys/dev/tpm/tpm20.h
  stable/11/sys/dev/tpm/tpm_crb.c
  stable/11/sys/dev/tpm/tpm_tis.c
  stable/11/sys/sys/random.h

Modified: stable/11/sys/conf/options
==
--- stable/11/sys/conf/options  Fri Apr 26 01:41:55 2019(r346724)
+++ stable/11/sys/conf/options  Fri Apr 26 01:58:36 2019(r346725)
@@ -986,6 +986,9 @@ RANDOM_ENABLE_UMA   opt_global.h
 # Intel em(4) driver
 EM_MULTIQUEUE  opt_em.h
 
+# This options turns TPM into entropy source.
+TPM_HARVESTopt_tpm.h
+
 # BHND(4) driver
 BHND_LOGLEVEL  opt_global.h
 

Modified: stable/11/sys/dev/random/random_harvestq.c
==
--- stable/11/sys/dev/random/random_harvestq.c  Fri Apr 26 01:41:55 2019
(r346724)
+++ stable/11/sys/dev/random/random_harvestq.c  Fri Apr 26 01:58:36 2019
(r346725)
@@ -288,6 +288,7 @@ static const char *(random_source_descr[]) = {
"PURE_RDRAND",
"PURE_NEHEMIAH",
"PURE_RNDTEST",
+   [RANDOM_PURE_TPM] = "PURE_TPM",
/* "ENTROPYSOURCE" */
 };
 

Modified: stable/11/sys/dev/tpm/tpm20.c
==
--- stable/11/sys/dev/tpm/tpm20.c   Fri Apr 26 01:41:55 2019
(r346724)
+++ stable/11/sys/dev/tpm/tpm20.c   Fri Apr 26 01:58:36 2019
(r346725)
@@ -28,13 +28,27 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include 
+
 #include "tpm20.h"
 
+#define TPM_HARVEST_SIZE 16
+/*
+ * Perform a harvest every 10 seconds.
+ * Since discrete TPMs are painfully slow
+ * we don't want to execute this too often
+ * as the chip is likely to be used by others too.
+ */
+#define TPM_HARVEST_INTERVAL 1000
+
 MALLOC_DECLARE(M_TPM20);
 MALLOC_DEFINE(M_TPM20, "tpm_buffer", "buffer for tpm 2.0 driver");
 
 static void tpm20_discard_buffer(void *arg);
-static int tpm20_save_state(device_t dev, bool suspend);
+#ifdef TPM_HARVEST
+static void tpm20_harvest(void *arg);
+#endif
+static int  tpm20_save_state(device_t dev, bool suspend);
 
 static d_open_ttpm20_open;
 static d_close_t   tpm20_close;
@@ -63,6 +77,10 @@ tpm20_read(struct cdev *dev, struct uio *uio, int flag
 
callout_stop(>discard_buffer_callout);
sx_xlock(>dev_lock);
+   if (sc->owner_tid != uio->uio_td->td_tid) {
+   sx_xunlock(>dev_lock);
+   return (EPERM);
+   }
 
bytes_to_transfer = MIN(sc->pending_data_length, uio->uio_resid);
if (bytes_to_transfer > 0) {
@@ -114,15 +132,18 @@ tpm20_write(struct cdev *dev, struct uio *uio, int fla
 
result = sc->transmit(sc, byte_count);
 
-   if (result == 0)
+   if (result == 0) {
callout_reset(>discard_buffer_callout,
TPM_READ_TIMEOUT / tick, tpm20_discard_buffer, sc);
+   sc->owner_tid = uio->uio_td->td_tid;
+   }
 
sx_xunlock(>dev_lock);
return (result);
 }
 
-static void tpm20_discard_buffer(void *arg)
+static void
+tpm20_discard_buffer(void *arg)
 {
struct tpm_sc *sc;
 
@@ -175,6 +196,11 @@ tpm20_init(struct tpm_sc *sc)
sx_init(>dev_lock, "TPM driver lock");
cv_init(>buf_cv, "TPM buffer cv");
callout_init(>discard_buffer_callout, 1);
+#ifdef TPM_HARVEST
+   sc->harvest_ticks = TPM_HARVEST_INTERVAL / tick;
+   callout_init(>harvest_callout, 1);
+   callout_reset(>harvest_callout, 0, tpm20_harvest, sc);
+#endif
sc->pending_data_length = 0;
 
make_dev_args_init();
@@ -195,6 +221,10 @@ void
 tpm20_release(struct tpm_sc *sc)
 {
 
+#ifdef TPM_HARVEST
+   callout_drain(>harvest_callout);
+#endif
+
if (sc->buf != NULL)
free(sc->buf, M_TPM20);
 
@@ -217,14 +247,69 @@ tpm20_shutdown(device_t dev)
return (tpm20_save_state(dev, false));
 }
 
+#ifdef TPM_HARVEST
+
+/*
+ * Get TPM_HARVEST_SIZE random bytes and add them
+ * into system entropy pool.
+ */
+static void
+tpm20_harvest(void *arg)
+{
+   struct 

svn commit: r346724 - in stable/12/sys: conf dev/random dev/tpm sys

2019-04-25 Thread Marcin Wojtas
Author: mw
Date: Fri Apr 26 01:41:55 2019
New Revision: 346724
URL: https://svnweb.freebsd.org/changeset/base/346724

Log:
  MFC r345438,r345842,r346259,r346261: TPM as possible entropy source
  
  r345438:
  Allow using TPM as entropy source
  
  TPM has a built-in RNG, with its own entropy source.
  The driver was extended to harvest 16 random bytes from TPM every 10 seconds.
  A new build option "TPM_HARVEST" was introduced - for now, however, it
  is not enabled by default in the GENERIC config.
  
  r345842:
  Add a cv_wait to the TPM2.0 harvesting function
  
  r346259:
  tpm: Prevent session hijack
  
  r346261:
  Improve tpm20 style
  
  Submitted by: Kornel Duleba 
  Obtained from: Semihalf
  Sponsored by: Stormshield

Modified:
  stable/12/sys/conf/options
  stable/12/sys/dev/random/random_harvestq.c
  stable/12/sys/dev/tpm/tpm20.c
  stable/12/sys/dev/tpm/tpm20.h
  stable/12/sys/dev/tpm/tpm_crb.c
  stable/12/sys/dev/tpm/tpm_tis.c
  stable/12/sys/sys/random.h

Modified: stable/12/sys/conf/options
==
--- stable/12/sys/conf/options  Fri Apr 26 01:29:00 2019(r346723)
+++ stable/12/sys/conf/options  Fri Apr 26 01:41:55 2019(r346724)
@@ -991,6 +991,9 @@ RANDOM_LOADABLE opt_global.h
 RANDOM_ENABLE_UMA  opt_global.h
 RANDOM_ENABLE_ETHERopt_global.h
 
+# This options turns TPM into entropy source.
+TPM_HARVESTopt_tpm.h
+
 # BHND(4) driver
 BHND_LOGLEVEL  opt_global.h
 

Modified: stable/12/sys/dev/random/random_harvestq.c
==
--- stable/12/sys/dev/random/random_harvestq.c  Fri Apr 26 01:29:00 2019
(r346723)
+++ stable/12/sys/dev/random/random_harvestq.c  Fri Apr 26 01:41:55 2019
(r346724)
@@ -315,6 +315,7 @@ static const char *random_source_descr[ENTROPYSOURCE] 
[RANDOM_PURE_BROADCOM] = "PURE_BROADCOM",
[RANDOM_PURE_CCP] = "PURE_CCP",
[RANDOM_PURE_DARN] = "PURE_DARN",
+   [RANDOM_PURE_TPM] = "PURE_TPM",
/* "ENTROPYSOURCE" */
 };
 

Modified: stable/12/sys/dev/tpm/tpm20.c
==
--- stable/12/sys/dev/tpm/tpm20.c   Fri Apr 26 01:29:00 2019
(r346723)
+++ stable/12/sys/dev/tpm/tpm20.c   Fri Apr 26 01:41:55 2019
(r346724)
@@ -28,13 +28,27 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include 
+
 #include "tpm20.h"
 
+#define TPM_HARVEST_SIZE 16
+/*
+ * Perform a harvest every 10 seconds.
+ * Since discrete TPMs are painfully slow
+ * we don't want to execute this too often
+ * as the chip is likely to be used by others too.
+ */
+#define TPM_HARVEST_INTERVAL 1000
+
 MALLOC_DECLARE(M_TPM20);
 MALLOC_DEFINE(M_TPM20, "tpm_buffer", "buffer for tpm 2.0 driver");
 
 static void tpm20_discard_buffer(void *arg);
-static int tpm20_save_state(device_t dev, bool suspend);
+#ifdef TPM_HARVEST
+static void tpm20_harvest(void *arg);
+#endif
+static int  tpm20_save_state(device_t dev, bool suspend);
 
 static d_open_ttpm20_open;
 static d_close_t   tpm20_close;
@@ -63,6 +77,10 @@ tpm20_read(struct cdev *dev, struct uio *uio, int flag
 
callout_stop(>discard_buffer_callout);
sx_xlock(>dev_lock);
+   if (sc->owner_tid != uio->uio_td->td_tid) {
+   sx_xunlock(>dev_lock);
+   return (EPERM);
+   }
 
bytes_to_transfer = MIN(sc->pending_data_length, uio->uio_resid);
if (bytes_to_transfer > 0) {
@@ -114,15 +132,18 @@ tpm20_write(struct cdev *dev, struct uio *uio, int fla
 
result = sc->transmit(sc, byte_count);
 
-   if (result == 0)
+   if (result == 0) {
callout_reset(>discard_buffer_callout,
TPM_READ_TIMEOUT / tick, tpm20_discard_buffer, sc);
+   sc->owner_tid = uio->uio_td->td_tid;
+   }
 
sx_xunlock(>dev_lock);
return (result);
 }
 
-static void tpm20_discard_buffer(void *arg)
+static void
+tpm20_discard_buffer(void *arg)
 {
struct tpm_sc *sc;
 
@@ -175,6 +196,11 @@ tpm20_init(struct tpm_sc *sc)
sx_init(>dev_lock, "TPM driver lock");
cv_init(>buf_cv, "TPM buffer cv");
callout_init(>discard_buffer_callout, 1);
+#ifdef TPM_HARVEST
+   sc->harvest_ticks = TPM_HARVEST_INTERVAL / tick;
+   callout_init(>harvest_callout, 1);
+   callout_reset(>harvest_callout, 0, tpm20_harvest, sc);
+#endif
sc->pending_data_length = 0;
 
make_dev_args_init();
@@ -195,6 +221,10 @@ void
 tpm20_release(struct tpm_sc *sc)
 {
 
+#ifdef TPM_HARVEST
+   callout_drain(>harvest_callout);
+#endif
+
if (sc->buf != NULL)
free(sc->buf, M_TPM20);
 
@@ -217,14 +247,68 @@ tpm20_shutdown(device_t dev)
return (tpm20_save_state(dev, false));
 }
 
+#ifdef TPM_HARVEST
+
+/*
+ * Get TPM_HARVEST_SIZE random bytes and add them
+ * into system entropy pool.
+ */
+static void

svn commit: r346723 - in stable/12: sys/dev/tpm usr.sbin/acpi/acpidump

2019-04-25 Thread Marcin Wojtas
Author: mw
Date: Fri Apr 26 01:29:00 2019
New Revision: 346723
URL: https://svnweb.freebsd.org/changeset/base/346723

Log:
  MFC r343438: Use ACPI TPM2 table to probe tpmtis and tpmcrb device
  
  Sponsored by: Stormshield

Modified:
  stable/12/sys/dev/tpm/tpm20.h
  stable/12/sys/dev/tpm/tpm_crb.c
  stable/12/sys/dev/tpm/tpm_tis.c
  stable/12/usr.sbin/acpi/acpidump/acpi.c

Modified: stable/12/sys/dev/tpm/tpm20.h
==
--- stable/12/sys/dev/tpm/tpm20.h   Fri Apr 26 01:20:39 2019
(r346722)
+++ stable/12/sys/dev/tpm/tpm20.h   Fri Apr 26 01:29:00 2019
(r346723)
@@ -93,6 +93,12 @@ __FBSDID("$FreeBSD$");
 #defineTPM_CDEV_NAME   "tpm0"
 #defineTPM_CDEV_PERM_FLAG  0600
 
+
+#define TPM2_START_METHOD_ACPI 2
+#define TPM2_START_METHOD_TIS 6
+#define TPM2_START_METHOD_CRB 7
+#define TPM2_START_METHOD_CRB_ACPI 8
+
 struct tpm_sc {
device_tdev;
 

Modified: stable/12/sys/dev/tpm/tpm_crb.c
==
--- stable/12/sys/dev/tpm/tpm_crb.c Fri Apr 26 01:20:39 2019
(r346722)
+++ stable/12/sys/dev/tpm/tpm_crb.c Fri Apr 26 01:29:00 2019
(r346723)
@@ -104,26 +104,21 @@ char *tpmcrb_ids[] = {"MSFT0101", NULL};
 static int
 tpmcrb_acpi_probe(device_t dev)
 {
-   struct resource *res;
-   int rid = 0;
-   uint32_t caps;
+   int err = 0;
+   ACPI_TABLE_TPM23 *tbl;
+   ACPI_STATUS status;
 
if (ACPI_ID_PROBE(device_get_parent(dev), dev, tpmcrb_ids) == NULL)
return (ENXIO);
 
-   /* Check if device is in CRB mode */
-   res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, , RF_ACTIVE);
-   if (res == NULL)
-   return (ENXIO);
+   /*Find TPM2 Header*/
+   status = AcpiGetTable(ACPI_SIG_TPM2, 1, (ACPI_TABLE_HEADER **) );
+   if(ACPI_FAILURE(status) ||
+  tbl->StartMethod != TPM2_START_METHOD_CRB)
+   err = ENXIO;
 
-   caps = bus_read_4(res, TPM_CRB_INTF_ID);
-   bus_release_resource(dev, SYS_RES_MEMORY, rid, res);
-
-   if ((caps & TPM_CRB_INTF_ID_TYPE) != TPM_CRB_INTF_ID_TYPE_CRB)
-   return (ENXIO);
-
device_set_desc(dev, "Trusted Platform Module 2.0, CRB mode");
-   return (BUS_PROBE_DEFAULT);
+   return (err);
 }
 
 static ACPI_STATUS

Modified: stable/12/sys/dev/tpm/tpm_tis.c
==
--- stable/12/sys/dev/tpm/tpm_tis.c Fri Apr 26 01:20:39 2019
(r346722)
+++ stable/12/sys/dev/tpm/tpm_tis.c Fri Apr 26 01:29:00 2019
(r346723)
@@ -100,25 +100,20 @@ char *tpmtis_ids[] = {"MSFT0101", NULL};
 static int
 tpmtis_acpi_probe(device_t dev)
 {
-   struct resource *res;
-   int rid = 0;
-   uint32_t caps;
+   int err = 0;
+   ACPI_TABLE_TPM23 *tbl;
+   ACPI_STATUS status;
 
if (ACPI_ID_PROBE(device_get_parent(dev), dev, tpmtis_ids) == NULL)
return (ENXIO);
+   /*Find TPM2 Header*/
+   status = AcpiGetTable(ACPI_SIG_TPM2, 1, (ACPI_TABLE_HEADER **) );
+   if(ACPI_FAILURE(status) ||
+  tbl->StartMethod != TPM2_START_METHOD_TIS)
+   err = ENXIO;
 
-   /* Check if device is in TPM 2.0 TIS mode */
-   res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, , RF_ACTIVE);
-   if (res == NULL)
-   return (ENXIO);
-
-   caps = bus_read_4(res, TPM_INTF_CAPS);
-   bus_release_resource(dev, SYS_RES_MEMORY, rid, res);
-   if ((caps & TPM_INTF_CAPS_VERSION) != TPM_INTF_CAPS_TPM20)
-   return (ENXIO);
-
device_set_desc(dev, "Trusted Platform Module 2.0, FIFO mode");
-   return (BUS_PROBE_DEFAULT);
+   return (err);
 }
 
 static int

Modified: stable/12/usr.sbin/acpi/acpidump/acpi.c
==
--- stable/12/usr.sbin/acpi/acpidump/acpi.c Fri Apr 26 01:20:39 2019
(r346722)
+++ stable/12/usr.sbin/acpi/acpidump/acpi.c Fri Apr 26 01:29:00 2019
(r346723)
@@ -970,7 +970,18 @@ acpi_handle_tcpa(ACPI_TABLE_HEADER *sdp)
 
printf(END_COMMENT);
 }
-
+static void acpi_handle_tpm2(ACPI_TABLE_HEADER *sdp)
+{
+   ACPI_TABLE_TPM2 *tpm2;
+   
+   printf (BEGIN_COMMENT);
+   acpi_print_sdt(sdp);
+   tpm2 = (ACPI_TABLE_TPM2 *) sdp;
+   printf ("\t\tControlArea=%lx\n", tpm2->ControlAddress);
+   printf ("\t\tStartMethod=%x\n", tpm2->StartMethod); 
+   printf (END_COMMENT);
+}
+   
 static const char *
 devscope_type2str(int type)
 {
@@ -1769,6 +1780,8 @@ acpi_handle_rsdt(ACPI_TABLE_HEADER *rsdp)
acpi_handle_wddt(sdp);
else if (!memcmp(sdp->Signature, ACPI_SIG_LPIT, 4))
acpi_handle_lpit(sdp);
+   else if (!memcmp(sdp->Signature, ACPI_SIG_TPM2, 4))
+   

svn commit: r346722 - in stable/11: sys/dev/tpm usr.sbin/acpi/acpidump

2019-04-25 Thread Marcin Wojtas
Author: mw
Date: Fri Apr 26 01:20:39 2019
New Revision: 346722
URL: https://svnweb.freebsd.org/changeset/base/346722

Log:
  MFC r343438: Use ACPI TPM2 table to probe tpmtis and tpmcrb device
  
  Submitted by: Kornel Duleba 
  Obtained from: Semihalf
  Sponsored by: Stormshield

Modified:
  stable/11/sys/dev/tpm/tpm20.h
  stable/11/sys/dev/tpm/tpm_crb.c
  stable/11/sys/dev/tpm/tpm_tis.c
  stable/11/usr.sbin/acpi/acpidump/acpi.c

Modified: stable/11/sys/dev/tpm/tpm20.h
==
--- stable/11/sys/dev/tpm/tpm20.h   Fri Apr 26 01:02:24 2019
(r346721)
+++ stable/11/sys/dev/tpm/tpm20.h   Fri Apr 26 01:20:39 2019
(r346722)
@@ -93,6 +93,12 @@ __FBSDID("$FreeBSD$");
 #defineTPM_CDEV_NAME   "tpm0"
 #defineTPM_CDEV_PERM_FLAG  0600
 
+
+#define TPM2_START_METHOD_ACPI 2
+#define TPM2_START_METHOD_TIS 6
+#define TPM2_START_METHOD_CRB 7
+#define TPM2_START_METHOD_CRB_ACPI 8
+
 struct tpm_sc {
device_tdev;
 

Modified: stable/11/sys/dev/tpm/tpm_crb.c
==
--- stable/11/sys/dev/tpm/tpm_crb.c Fri Apr 26 01:02:24 2019
(r346721)
+++ stable/11/sys/dev/tpm/tpm_crb.c Fri Apr 26 01:20:39 2019
(r346722)
@@ -104,26 +104,21 @@ char *tpmcrb_ids[] = {"MSFT0101", NULL};
 static int
 tpmcrb_acpi_probe(device_t dev)
 {
-   struct resource *res;
-   int rid = 0;
-   uint32_t caps;
+   int err = 0;
+   ACPI_TABLE_TPM2 *tbl;
+   ACPI_STATUS status;
 
if (ACPI_ID_PROBE(device_get_parent(dev), dev, tpmcrb_ids) == NULL)
return (ENXIO);
 
-   /* Check if device is in CRB mode */
-   res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, , RF_ACTIVE);
-   if (res == NULL)
-   return (ENXIO);
+   /*Find TPM2 Header*/
+   status = AcpiGetTable(ACPI_SIG_TPM2, 1, (ACPI_TABLE_HEADER **) );
+   if(ACPI_FAILURE(status) ||
+  tbl->StartMethod != TPM2_START_METHOD_CRB)
+   err = ENXIO;
 
-   caps = bus_read_4(res, TPM_CRB_INTF_ID);
-   bus_release_resource(dev, SYS_RES_MEMORY, rid, res);
-
-   if ((caps & TPM_CRB_INTF_ID_TYPE) != TPM_CRB_INTF_ID_TYPE_CRB)
-   return (ENXIO);
-
device_set_desc(dev, "Trusted Platform Module 2.0, CRB mode");
-   return (BUS_PROBE_DEFAULT);
+   return (err);
 }
 
 static ACPI_STATUS

Modified: stable/11/sys/dev/tpm/tpm_tis.c
==
--- stable/11/sys/dev/tpm/tpm_tis.c Fri Apr 26 01:02:24 2019
(r346721)
+++ stable/11/sys/dev/tpm/tpm_tis.c Fri Apr 26 01:20:39 2019
(r346722)
@@ -100,25 +100,21 @@ char *tpmtis_ids[] = {"MSFT0101", NULL};
 static int
 tpmtis_acpi_probe(device_t dev)
 {
-   struct resource *res;
-   int rid = 0;
-   uint32_t caps;
+   int err = 0;
+   ACPI_TABLE_TPM2 *tbl;
+   ACPI_STATUS status;
 
if (ACPI_ID_PROBE(device_get_parent(dev), dev, tpmtis_ids) == NULL)
return (ENXIO);
 
-   /* Check if device is in TPM 2.0 TIS mode */
-   res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, , RF_ACTIVE);
-   if (res == NULL)
-   return (ENXIO);
+   /*Find TPM2 Header*/
+   status = AcpiGetTable(ACPI_SIG_TPM2, 1, (ACPI_TABLE_HEADER **) );
+   if(ACPI_FAILURE(status) ||
+  tbl->StartMethod != TPM2_START_METHOD_TIS)
+   err = ENXIO;
 
-   caps = bus_read_4(res, TPM_INTF_CAPS);
-   bus_release_resource(dev, SYS_RES_MEMORY, rid, res);
-   if ((caps & TPM_INTF_CAPS_VERSION) != TPM_INTF_CAPS_TPM20)
-   return (ENXIO);
-
device_set_desc(dev, "Trusted Platform Module 2.0, FIFO mode");
-   return (BUS_PROBE_DEFAULT);
+   return (err);
 }
 
 static int

Modified: stable/11/usr.sbin/acpi/acpidump/acpi.c
==
--- stable/11/usr.sbin/acpi/acpidump/acpi.c Fri Apr 26 01:02:24 2019
(r346721)
+++ stable/11/usr.sbin/acpi/acpidump/acpi.c Fri Apr 26 01:20:39 2019
(r346722)
@@ -861,7 +861,18 @@ acpi_handle_tcpa(ACPI_TABLE_HEADER *sdp)
 
printf(END_COMMENT);
 }
-
+static void acpi_handle_tpm2(ACPI_TABLE_HEADER *sdp)
+{
+   ACPI_TABLE_TPM2 *tpm2;
+   
+   printf (BEGIN_COMMENT);
+   acpi_print_sdt(sdp);
+   tpm2 = (ACPI_TABLE_TPM2 *) sdp;
+   printf ("\t\tControlArea=%lx\n", tpm2->ControlAddress);
+   printf ("\t\tStartMethod=%x\n", tpm2->StartMethod); 
+   printf (END_COMMENT);
+}
+   
 static const char *
 devscope_type2str(int type)
 {
@@ -1656,6 +1667,8 @@ acpi_handle_rsdt(ACPI_TABLE_HEADER *rsdp)
acpi_handle_dmar(sdp);
else if (!memcmp(sdp->Signature, ACPI_SIG_NFIT, 4))
acpi_handle_nfit(sdp);
+   else if 

Re: svn commit: r346386 - in head/sys: dev/bge dev/pci dev/twa x86/iommu

2019-04-25 Thread Tycho Nightingale

As Ryan suggests r232260 should be recommitted to get acc(4) fixed.

However, given the age of the devices involved and the lack of support by the 
standard, I’d say the threshold isn’t met to reinstate the boundary globally 
preemptively.

To get the insurance, which may not even be necessary, you start to contort 
working drivers.  For example the insurance can cause legitimate mappings to 
fail to load.  Since bus_dma(9) has no interface to return the “active” 
boundary and only returns the EFBIG when boundary constraint causes a mapping 
to fail to load this causes a rather cryptic failure when a driver.  E.g. with 
the insurance a a tiny 8 byte region will fail to load into a single segment on 
ioat(4) if it happens to cross an invisible 4GB boundary instituted by the 
parent.  You need create a tag which allows multiple segments.  How many 
segments?  Well it depends on how many artificial boundaries; it starts to get 
ugly.  Seems better to support the handful of those devices which need 
hand-holding at the tag level for those devices.

Tycho

> On Apr 25, 2019, at 7:31 PM, Scott Long  wrote:
> 
> Yeah, it might be turning into an old wives tale at this point.  I clearly 
> remember
> it being discussed at the PCI-SIG in late 2003 when PCIe 1.0 was in its final
> draft stages.  However, that was a long time ago, and it’s possible that even
> if it’s a limitation in some version or another of the spec, that most 
> hardware
> and firmware just silently account for it.  At the time (and even now) it 
> didn’t
> seem like an onerous limitation to place on drivers, especially with it being
> quite easy to implement in FreeBSD.  So I’m on the fence; it might be a bit of
> trivia that’s not relevant, and maybe wasn’t ever relevant, but it’s also 
> cheap
> insurance.
> 
> Scott
> 
> 
>> On Apr 25, 2019, at 4:24 PM, Ryan Stone  wrote:
>> 
>> +scottl@, who I believe explained this to us in the first place.
>> 
>> As I recall, it had something to do with 64-bit DMA being expressed as
>> segment base + 32-bit offset.  DMA engines that blindly try to cross a
>> 32-bit boundary end up back at the start of the segment and read/write
>> the wrong memory location.
>> 
>> On Thu, Apr 25, 2019 at 4:37 PM John Baldwin  wrote:
>>> 
>>> I had looked for the aac change, but wasn't able to find it, perhaps 
>>> because I
>>> looked at tags created in aac.c rather than aac_pci.c.  I agree aac will 
>>> need to
>>> be re-patched.  I'm not really certain how many other devices are actually 
>>> broken.
>>> They would all be due to a firmware bug, nothing inherent in PCI.
>>> 
>>> I believe twa(4) and bge(4) issues predated aac(4) FWIW.
>>> 
>>> Unfortunately, the main bit of discussion about moving the limit into the 
>>> PCI bus
>>> itself seems to be an IRC discussion on 2/28/12 that resulted in revision 
>>> r232267
>>> as a quick MFC'able fix, but I don't have a log of that conversation. :(  I
>>> couldn't find anything in e-mail either that was definitive for why this 
>>> might have
>>> been inherent in PCI-e vs a few firmware writers having similar bugs.
>>> 
>>> On 4/25/19 12:20 PM, Ryan Stone wrote:
 Following up, this is what will have to be re-instated in the aac driver:
 
 http://svn.freebsd.org/changeset/base/232260
 
 However, my biggest concern is that we have no idea how many new
 devices with the broken behaviour might have been introduced since we
 fixed the problem in general.  How does Linux handle the issue?
 
 On Thu, Apr 25, 2019 at 3:17 PM Ryan Stone  wrote:
> 
> This change makes me *very* uncomfortable.  It was originally brought
> in due to issues with Adaptec RAID cards using the aac(9) driver.  The
> symptoms of the bug included silent corruption of data as it was
> written to disk.  Are we sure that this change is a good idea, given
> how catastrophic it is when a device gets this wrong?
> 
> On Fri, Apr 19, 2019 at 9:43 AM Tycho Nightingale  
> wrote:
>> 
>> Author: tychon
>> Date: Fri Apr 19 13:43:33 2019
>> New Revision: 346386
>> URL: https://svnweb.freebsd.org/changeset/base/346386
>> 
>> Log:
>> remove the 4GB boundary requirement on PCI DMA segments
>> 
>> Reviewed by:  kib
>> Discussed with:   jhb
>> Sponsored by: Dell EMC Isilon
>> Differential Revision:https://reviews.freebsd.org/D19867
>> 
>> Modified:
>> head/sys/dev/bge/if_bgereg.h
>> head/sys/dev/pci/pci.c
>> head/sys/dev/pci/pcivar.h
>> head/sys/dev/twa/tw_osl.h
>> head/sys/dev/twa/tw_osl_freebsd.c
>> head/sys/x86/iommu/intel_ctx.c
>> 
>> Modified: head/sys/dev/bge/if_bgereg.h
>> ==
>> --- head/sys/dev/bge/if_bgereg.hFri Apr 19 13:23:41 2019
>> (r346385)
>> +++ head/sys/dev/bge/if_bgereg.hFri Apr 19 13:43:33 2019
>> (r346386)

svn commit: r346721 - in stable/11/sys: conf dev/tpm modules/tpm

2019-04-25 Thread Marcin Wojtas
Author: mw
Date: Fri Apr 26 01:02:24 2019
New Revision: 346721
URL: https://svnweb.freebsd.org/changeset/base/346721

Log:
  MFC r342084,r342251,r342271,r342285: Introduce TPM2.0 driver
  
  r342084
  Introduce driver for TPM 2.0 in CRB and FIFO (TIS) modes
  
  r342251
  Include the new TPM 2.0 driver in the TPM module.
  
  r342271
  Fix obtaining RSP address in TPM CRB for non-amd64 platforms
  
  r342285
  tpm(4): Fix GCC build after r342084 (TPM 2.0 driver commit)
  
  Submitted by: Kornel Duleba 
  Obtained from: Semihalf
  Sponsored by: Stormshield

Added:
  stable/11/sys/dev/tpm/tpm20.c
 - copied, changed from r342084, head/sys/dev/tpm/tpm20.c
  stable/11/sys/dev/tpm/tpm20.h
 - copied, changed from r342084, head/sys/dev/tpm/tpm20.h
  stable/11/sys/dev/tpm/tpm_crb.c
 - copied, changed from r342084, head/sys/dev/tpm/tpm_crb.c
  stable/11/sys/dev/tpm/tpm_tis.c
 - copied unchanged from r342084, head/sys/dev/tpm/tpm_tis.c
Modified:
  stable/11/sys/conf/files.amd64
  stable/11/sys/modules/tpm/Makefile

Modified: stable/11/sys/conf/files.amd64
==
--- stable/11/sys/conf/files.amd64  Fri Apr 26 01:02:14 2019
(r346720)
+++ stable/11/sys/conf/files.amd64  Fri Apr 26 01:02:24 2019
(r346721)
@@ -473,6 +473,9 @@ dev/syscons/scvesactl.c optionalsc vga 
vesa
 dev/syscons/scvgarndr.coptionalsc vga
 dev/syscons/scvtb.coptionalsc
 dev/tpm/tpm.c  optionaltpm
+dev/tpm/tpm20.coptionaltpm
+dev/tpm/tpm_crb.c  optionaltpm acpi
+dev/tpm/tpm_tis.c  optionaltpm acpi
 dev/tpm/tpm_acpi.c optionaltpm acpi
 dev/tpm/tpm_isa.c  optionaltpm isa
 dev/uart/uart_cpu_x86.coptionaluart

Copied and modified: stable/11/sys/dev/tpm/tpm20.c (from r342084, 
head/sys/dev/tpm/tpm20.c)
==
--- head/sys/dev/tpm/tpm20.cFri Dec 14 16:14:36 2018(r342084, copy 
source)
+++ stable/11/sys/dev/tpm/tpm20.c   Fri Apr 26 01:02:24 2019
(r346721)
@@ -36,6 +36,22 @@ MALLOC_DEFINE(M_TPM20, "tpm_buffer", "buffer for tpm 2
 static void tpm20_discard_buffer(void *arg);
 static int tpm20_save_state(device_t dev, bool suspend);
 
+static d_open_ttpm20_open;
+static d_close_t   tpm20_close;
+static d_read_ttpm20_read;
+static d_write_t   tpm20_write;
+static d_ioctl_t   tpm20_ioctl;
+
+static struct cdevsw tpm20_cdevsw = {
+   .d_version = D_VERSION,
+   .d_open = tpm20_open,
+   .d_close = tpm20_close,
+   .d_read = tpm20_read,
+   .d_write = tpm20_write,
+   .d_ioctl = tpm20_ioctl,
+   .d_name = "tpm20",
+};
+
 int
 tpm20_read(struct cdev *dev, struct uio *uio, int flags)
 {
@@ -162,7 +178,7 @@ tpm20_init(struct tpm_sc *sc)
sc->pending_data_length = 0;
 
make_dev_args_init();
-   args.mda_devsw = _cdevsw;
+   args.mda_devsw = _cdevsw;
args.mda_uid = UID_ROOT;
args.mda_gid = GID_WHEEL;
args.mda_mode = TPM_CDEV_PERM_FLAG;

Copied and modified: stable/11/sys/dev/tpm/tpm20.h (from r342084, 
head/sys/dev/tpm/tpm20.h)
==
--- head/sys/dev/tpm/tpm20.hFri Dec 14 16:14:36 2018(r342084, copy 
source)
+++ stable/11/sys/dev/tpm/tpm20.h   Fri Apr 26 01:02:24 2019
(r346721)
@@ -124,22 +124,6 @@ int32_t tpm20_get_timeout(uint32_t command);
 int tpm20_init(struct tpm_sc *sc);
 void tpm20_release(struct tpm_sc *sc);
 
-d_open_t   tpm20_open;
-d_close_t  tpm20_close;
-d_read_t   tpm20_read;
-d_write_t  tpm20_write;
-d_ioctl_t  tpm20_ioctl;
-
-static struct cdevsw tpm_cdevsw = {
-   .d_version = D_VERSION,
-   .d_open = tpm20_open,
-   .d_close = tpm20_close,
-   .d_read = tpm20_read,
-   .d_write = tpm20_write,
-   .d_ioctl = tpm20_ioctl,
-   .d_name = "tpm20",
-};
-
 /* Small helper routines for io ops */
 static inline uint8_t
 RD1(struct tpm_sc *sc, bus_size_t off)
@@ -153,12 +137,14 @@ RD4(struct tpm_sc *sc, bus_size_t off)
 
return (bus_read_4(sc->mem_res, off));
 }
+#ifdef __amd64__
 static inline uint64_t
 RD8(struct tpm_sc *sc, bus_size_t off)
 {
 
return (bus_read_8(sc->mem_res, off));
 }
+#endif
 static inline void
 WR1(struct tpm_sc *sc, bus_size_t off, uint8_t val)
 {

Copied and modified: stable/11/sys/dev/tpm/tpm_crb.c (from r342084, 
head/sys/dev/tpm/tpm_crb.c)
==
--- head/sys/dev/tpm/tpm_crb.c  Fri Dec 14 16:14:36 2018(r342084, copy 
source)
+++ stable/11/sys/dev/tpm/tpm_crb.c Fri Apr 26 01:02:24 2019
(r346721)
@@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$");
 #define 

svn commit: r346720 - in stable/12/sys: conf dev/tpm modules/tpm

2019-04-25 Thread Marcin Wojtas
Author: mw
Date: Fri Apr 26 01:02:14 2019
New Revision: 346720
URL: https://svnweb.freebsd.org/changeset/base/346720

Log:
  MFC r342084,r342251,r342271,r342285: Introduce TPM2.0 driver
  
  r342084
  Introduce driver for TPM 2.0 in CRB and FIFO (TIS) modes
  
  r342251
  Include the new TPM 2.0 driver in the TPM module.
  
  r342271
  Fix obtaining RSP address in TPM CRB for non-amd64 platforms
  
  r342285
  tpm(4): Fix GCC build after r342084 (TPM 2.0 driver commit)
  
  Submitted by: Kornel Duleba 
  Obtained from: Semihalf
  Sponsored by: Stormshield

Added:
  stable/12/sys/dev/tpm/tpm20.c
 - copied, changed from r342084, head/sys/dev/tpm/tpm20.c
  stable/12/sys/dev/tpm/tpm20.h
 - copied, changed from r342084, head/sys/dev/tpm/tpm20.h
  stable/12/sys/dev/tpm/tpm_crb.c
 - copied, changed from r342084, head/sys/dev/tpm/tpm_crb.c
  stable/12/sys/dev/tpm/tpm_tis.c
 - copied unchanged from r342084, head/sys/dev/tpm/tpm_tis.c
Modified:
  stable/12/sys/conf/files.amd64
  stable/12/sys/modules/tpm/Makefile

Modified: stable/12/sys/conf/files.amd64
==
--- stable/12/sys/conf/files.amd64  Fri Apr 26 00:48:52 2019
(r346719)
+++ stable/12/sys/conf/files.amd64  Fri Apr 26 01:02:14 2019
(r346720)
@@ -487,6 +487,9 @@ dev/syscons/scvesactl.c optionalsc vga 
vesa
 dev/syscons/scvgarndr.coptionalsc vga
 dev/syscons/scvtb.coptionalsc
 dev/tpm/tpm.c  optionaltpm
+dev/tpm/tpm20.coptionaltpm
+dev/tpm/tpm_crb.c  optionaltpm acpi
+dev/tpm/tpm_tis.c  optionaltpm acpi
 dev/tpm/tpm_acpi.c optionaltpm acpi
 dev/tpm/tpm_isa.c  optionaltpm isa
 dev/uart/uart_cpu_x86.coptionaluart

Copied and modified: stable/12/sys/dev/tpm/tpm20.c (from r342084, 
head/sys/dev/tpm/tpm20.c)
==
--- head/sys/dev/tpm/tpm20.cFri Dec 14 16:14:36 2018(r342084, copy 
source)
+++ stable/12/sys/dev/tpm/tpm20.c   Fri Apr 26 01:02:14 2019
(r346720)
@@ -36,6 +36,22 @@ MALLOC_DEFINE(M_TPM20, "tpm_buffer", "buffer for tpm 2
 static void tpm20_discard_buffer(void *arg);
 static int tpm20_save_state(device_t dev, bool suspend);
 
+static d_open_ttpm20_open;
+static d_close_t   tpm20_close;
+static d_read_ttpm20_read;
+static d_write_t   tpm20_write;
+static d_ioctl_t   tpm20_ioctl;
+
+static struct cdevsw tpm20_cdevsw = {
+   .d_version = D_VERSION,
+   .d_open = tpm20_open,
+   .d_close = tpm20_close,
+   .d_read = tpm20_read,
+   .d_write = tpm20_write,
+   .d_ioctl = tpm20_ioctl,
+   .d_name = "tpm20",
+};
+
 int
 tpm20_read(struct cdev *dev, struct uio *uio, int flags)
 {
@@ -162,7 +178,7 @@ tpm20_init(struct tpm_sc *sc)
sc->pending_data_length = 0;
 
make_dev_args_init();
-   args.mda_devsw = _cdevsw;
+   args.mda_devsw = _cdevsw;
args.mda_uid = UID_ROOT;
args.mda_gid = GID_WHEEL;
args.mda_mode = TPM_CDEV_PERM_FLAG;

Copied and modified: stable/12/sys/dev/tpm/tpm20.h (from r342084, 
head/sys/dev/tpm/tpm20.h)
==
--- head/sys/dev/tpm/tpm20.hFri Dec 14 16:14:36 2018(r342084, copy 
source)
+++ stable/12/sys/dev/tpm/tpm20.h   Fri Apr 26 01:02:14 2019
(r346720)
@@ -124,22 +124,6 @@ int32_t tpm20_get_timeout(uint32_t command);
 int tpm20_init(struct tpm_sc *sc);
 void tpm20_release(struct tpm_sc *sc);
 
-d_open_t   tpm20_open;
-d_close_t  tpm20_close;
-d_read_t   tpm20_read;
-d_write_t  tpm20_write;
-d_ioctl_t  tpm20_ioctl;
-
-static struct cdevsw tpm_cdevsw = {
-   .d_version = D_VERSION,
-   .d_open = tpm20_open,
-   .d_close = tpm20_close,
-   .d_read = tpm20_read,
-   .d_write = tpm20_write,
-   .d_ioctl = tpm20_ioctl,
-   .d_name = "tpm20",
-};
-
 /* Small helper routines for io ops */
 static inline uint8_t
 RD1(struct tpm_sc *sc, bus_size_t off)
@@ -153,12 +137,14 @@ RD4(struct tpm_sc *sc, bus_size_t off)
 
return (bus_read_4(sc->mem_res, off));
 }
+#ifdef __amd64__
 static inline uint64_t
 RD8(struct tpm_sc *sc, bus_size_t off)
 {
 
return (bus_read_8(sc->mem_res, off));
 }
+#endif
 static inline void
 WR1(struct tpm_sc *sc, bus_size_t off, uint8_t val)
 {

Copied and modified: stable/12/sys/dev/tpm/tpm_crb.c (from r342084, 
head/sys/dev/tpm/tpm_crb.c)
==
--- head/sys/dev/tpm/tpm_crb.c  Fri Dec 14 16:14:36 2018(r342084, copy 
source)
+++ stable/12/sys/dev/tpm/tpm_crb.c Fri Apr 26 01:02:14 2019
(r346720)
@@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$");
 #define 

svn commit: r346719 - in stable/12: lib/libsecureboot lib/libsecureboot/efi lib/libsecureboot/h share/mk stand/efi/loader tools/build/options

2019-04-25 Thread Marcin Wojtas
Author: mw
Date: Fri Apr 26 00:48:52 2019
New Revision: 346719
URL: https://svnweb.freebsd.org/changeset/base/346719

Log:
  MFC r344840: Extend libsecureboot(old libve) to obtain trusted certificates 
from UEFI and implement revocation
  
  UEFI related headers were copied from edk2.
  
  A new build option "MK_LOADER_EFI_SECUREBOOT" was added to allow
  loading of trusted anchors from UEFI.
  
  Certificate revocation support is also introduced.
  The forbidden certificates are loaded from dbx variable.
  Verification fails in two cases:
  
  There is a direct match between cert in dbx and the one in the chain.
  The CA used to sign the chain is found in dbx.
  One can also insert a hash of TBS section of a certificate into dbx.
  In this case verifications fails only if a direct match with a
  certificate in chain is found.
  
  Submitted by: Kornel Duleba 
  Obtained from: Semihalf
  Sponsored by: Stormshield

Added:
  stable/12/lib/libsecureboot/efi/
 - copied from r344840, head/lib/libsecureboot/efi/
  stable/12/tools/build/options/WITH_LOADER_EFI_SECUREBOOT
 - copied unchanged from r344840, 
head/tools/build/options/WITH_LOADER_EFI_SECUREBOOT
Modified:
  stable/12/lib/libsecureboot/Makefile.inc
  stable/12/lib/libsecureboot/Makefile.libsa.inc
  stable/12/lib/libsecureboot/h/verify_file.h
  stable/12/lib/libsecureboot/libsecureboot-priv.h
  stable/12/lib/libsecureboot/local.trust.mk
  stable/12/lib/libsecureboot/verify_file.c
  stable/12/lib/libsecureboot/vets.c
  stable/12/share/mk/src.opts.mk
  stable/12/stand/efi/loader/Makefile
  stable/12/stand/efi/loader/main.c

Modified: stable/12/lib/libsecureboot/Makefile.inc
==
--- stable/12/lib/libsecureboot/Makefile.incFri Apr 26 00:39:30 2019
(r346718)
+++ stable/12/lib/libsecureboot/Makefile.incFri Apr 26 00:48:52 2019
(r346719)
@@ -31,6 +31,17 @@ BRSSL_SRCS+= \
${BEARSSL}/tools/xmem.c \
${BEARSSL}/tools/vector.c
 
+BRSSL_DEPS= \
+   brf.c \
+   vets.c \
+   veta.c
+
+.if ${MK_LOADER_EFI_SECUREBOOT} != "no"
+BRSSL_DEPS+= \
+   efi_init.c \
+   efi_variables.c
+.endif
+
 # we do not need/want nested objdirs
 OBJS_SRCS_FILTER = T R
 
@@ -134,7 +145,7 @@ vse.h:
echo 'NULL };' ) > ${.TARGET}
 
 
-.for s in ${BRSSL_SRCS} brf.c vets.c veta.c
+.for s in ${BRSSL_SRCS} ${BRSSL_DEPS}
 .ifdef BRSSL_SED
 $s: brssl.h
 .endif

Modified: stable/12/lib/libsecureboot/Makefile.libsa.inc
==
--- stable/12/lib/libsecureboot/Makefile.libsa.inc  Fri Apr 26 00:39:30 
2019(r346718)
+++ stable/12/lib/libsecureboot/Makefile.libsa.inc  Fri Apr 26 00:48:52 
2019(r346719)
@@ -16,6 +16,19 @@ SRCS+= \
vepcr.c \
verify_file.c \
 
+# Build library with support for the UEFI based authentication
+.if ${MK_LOADER_EFI_SECUREBOOT} == "yes"
+SRCS+= \
+   efi/efi_variables.c \
+   efi/efi_init.c
+
+# Add includes required by efi part
+CFLAGS+= \
+   -I${SRCTOP}/stand/efi/include \
+   -I${SRCTOP}/lib/libsecureboot/efi/include \
+   -I${SRCTOP}/stand/efi/include/${MACHINE}
+.endif
+
 # this is the list of paths (relative to a file
 # that we need to verify) used to find a signed manifest.
 # the signature extensions in VE_SIGNATURE_EXT_LIST

Modified: stable/12/lib/libsecureboot/h/verify_file.h
==
--- stable/12/lib/libsecureboot/h/verify_file.h Fri Apr 26 00:39:30 2019
(r346718)
+++ stable/12/lib/libsecureboot/h/verify_file.h Fri Apr 26 00:48:52 2019
(r346719)
@@ -40,6 +40,7 @@ struct stat;
 
 voidve_debug_set(int);
 int ve_status_get(int);
+voidve_efi_init(void);
 int load_manifest(const char *, const char *, const char *, struct stat *);
 int verify_file(int, const char *, off_t, int);
 voidverify_pcr_export(void);

Modified: stable/12/lib/libsecureboot/libsecureboot-priv.h
==
--- stable/12/lib/libsecureboot/libsecureboot-priv.hFri Apr 26 00:39:30 
2019(r346718)
+++ stable/12/lib/libsecureboot/libsecureboot-priv.hFri Apr 26 00:48:52 
2019(r346719)
@@ -31,8 +31,15 @@
 /* public api */
 #include "libsecureboot.h"
 
+typedef struct {
+   unsigned char   *data;
+   size_t  hash_size;
+} hash_data;
+
 size_t ve_trust_anchors_add(br_x509_certificate *, size_t);
-char *fingerprint_info_lookup(int, const char *);
+size_t ve_forbidden_anchors_add(br_x509_certificate *, size_t);
+void   ve_forbidden_digest_add(hash_data *digest, size_t);
+char   *fingerprint_info_lookup(int, const char *);
 
 br_x509_certificate * parse_certificates(unsigned char *, size_t, size_t *);
 int  certificate_to_trust_anchor_inner(br_x509_trust_anchor *,
@@ -44,5 +51,10 @@ int verify_rsa_digest(br_rsa_public_key 

svn commit: r346718 - stable/12/stand/efi/libefi

2019-04-25 Thread Marcin Wojtas
Author: mw
Date: Fri Apr 26 00:39:30 2019
New Revision: 346718
URL: https://svnweb.freebsd.org/changeset/base/346718

Log:
  MFC r343911: Allow reading the UEFI variable size
  
  When loading bigger variables form UEFI it is necessary to know their
  size beforehand, so that an appropriate amount of memory can be
  allocated. The easiest way to do this is to try to read the variable
  with buffer size equal 0, expecting EFI_BUFFER_TOO_SMALL error to be
  returned. Allow such possible approach in efi_getenv routine.
  
  Submitted by: Kornel Duleba 
  Obtained from: Semihalf
  Sponsored by: Stormshield

Modified:
  stable/12/stand/efi/libefi/efienv.c

Modified: stable/12/stand/efi/libefi/efienv.c
==
--- stable/12/stand/efi/libefi/efienv.c Thu Apr 25 22:53:55 2019
(r346717)
+++ stable/12/stand/efi/libefi/efienv.c Fri Apr 26 00:39:30 2019
(r346718)
@@ -49,7 +49,7 @@ efi_getenv(EFI_GUID *g, const char *v, void *data, siz
return (EFI_OUT_OF_RESOURCES);
dl = *len;
rv = RS->GetVariable(uv, g, , , data);
-   if (rv == EFI_SUCCESS)
+   if (rv == EFI_SUCCESS || rv == EFI_BUFFER_TOO_SMALL)
*len = dl;
free(uv);
return (rv);
___
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: r346386 - in head/sys: dev/bge dev/pci dev/twa x86/iommu

2019-04-25 Thread Scott Long
Yeah, it might be turning into an old wives tale at this point.  I clearly 
remember
it being discussed at the PCI-SIG in late 2003 when PCIe 1.0 was in its final
draft stages.  However, that was a long time ago, and it’s possible that even
if it’s a limitation in some version or another of the spec, that most hardware
and firmware just silently account for it.  At the time (and even now) it didn’t
seem like an onerous limitation to place on drivers, especially with it being
quite easy to implement in FreeBSD.  So I’m on the fence; it might be a bit of
trivia that’s not relevant, and maybe wasn’t ever relevant, but it’s also cheap
insurance.

Scott


> On Apr 25, 2019, at 4:24 PM, Ryan Stone  wrote:
> 
> +scottl@, who I believe explained this to us in the first place.
> 
> As I recall, it had something to do with 64-bit DMA being expressed as
> segment base + 32-bit offset.  DMA engines that blindly try to cross a
> 32-bit boundary end up back at the start of the segment and read/write
> the wrong memory location.
> 
> On Thu, Apr 25, 2019 at 4:37 PM John Baldwin  wrote:
>> 
>> I had looked for the aac change, but wasn't able to find it, perhaps because 
>> I
>> looked at tags created in aac.c rather than aac_pci.c.  I agree aac will 
>> need to
>> be re-patched.  I'm not really certain how many other devices are actually 
>> broken.
>> They would all be due to a firmware bug, nothing inherent in PCI.
>> 
>> I believe twa(4) and bge(4) issues predated aac(4) FWIW.
>> 
>> Unfortunately, the main bit of discussion about moving the limit into the 
>> PCI bus
>> itself seems to be an IRC discussion on 2/28/12 that resulted in revision 
>> r232267
>> as a quick MFC'able fix, but I don't have a log of that conversation. :(  I
>> couldn't find anything in e-mail either that was definitive for why this 
>> might have
>> been inherent in PCI-e vs a few firmware writers having similar bugs.
>> 
>> On 4/25/19 12:20 PM, Ryan Stone wrote:
>>> Following up, this is what will have to be re-instated in the aac driver:
>>> 
>>> http://svn.freebsd.org/changeset/base/232260
>>> 
>>> However, my biggest concern is that we have no idea how many new
>>> devices with the broken behaviour might have been introduced since we
>>> fixed the problem in general.  How does Linux handle the issue?
>>> 
>>> On Thu, Apr 25, 2019 at 3:17 PM Ryan Stone  wrote:
 
 This change makes me *very* uncomfortable.  It was originally brought
 in due to issues with Adaptec RAID cards using the aac(9) driver.  The
 symptoms of the bug included silent corruption of data as it was
 written to disk.  Are we sure that this change is a good idea, given
 how catastrophic it is when a device gets this wrong?
 
 On Fri, Apr 19, 2019 at 9:43 AM Tycho Nightingale  
 wrote:
> 
> Author: tychon
> Date: Fri Apr 19 13:43:33 2019
> New Revision: 346386
> URL: https://svnweb.freebsd.org/changeset/base/346386
> 
> Log:
>  remove the 4GB boundary requirement on PCI DMA segments
> 
>  Reviewed by:  kib
>  Discussed with:   jhb
>  Sponsored by: Dell EMC Isilon
>  Differential Revision:https://reviews.freebsd.org/D19867
> 
> Modified:
>  head/sys/dev/bge/if_bgereg.h
>  head/sys/dev/pci/pci.c
>  head/sys/dev/pci/pcivar.h
>  head/sys/dev/twa/tw_osl.h
>  head/sys/dev/twa/tw_osl_freebsd.c
>  head/sys/x86/iommu/intel_ctx.c
> 
> Modified: head/sys/dev/bge/if_bgereg.h
> ==
> --- head/sys/dev/bge/if_bgereg.hFri Apr 19 13:23:41 2019
> (r346385)
> +++ head/sys/dev/bge/if_bgereg.hFri Apr 19 13:43:33 2019
> (r346386)
> @@ -3067,3 +3067,11 @@ struct bge_softc {
> #defineBGE_LOCK_ASSERT(_sc)mtx_assert(&(_sc)->bge_mtx, 
> MA_OWNED)
> #defineBGE_UNLOCK(_sc) mtx_unlock(&(_sc)->bge_mtx)
> #defineBGE_LOCK_DESTROY(_sc)   mtx_destroy(&(_sc)->bge_mtx)
> +
> +#ifdef BUS_SPACE_MAXADDR
> +#if (BUS_SPACE_MAXADDR > 0x)
> +#defineBGE_DMA_BOUNDARY(0x1)
> +#else
> +#defineBGE_DMA_BOUNDARY0
> +#endif
> +#endif
> 
> Modified: head/sys/dev/pci/pci.c
> ==
> --- head/sys/dev/pci/pci.c  Fri Apr 19 13:23:41 2019(r346385)
> +++ head/sys/dev/pci/pci.c  Fri Apr 19 13:43:33 2019(r346386)
> @@ -4343,9 +4343,6 @@ pci_attach_common(device_t dev)
> {
>struct pci_softc *sc;
>int busno, domain;
> -#ifdef PCI_DMA_BOUNDARY
> -   int error, tag_valid;
> -#endif
> #ifdef PCI_RES_BUS
>int rid;
> #endif
> @@ -4365,23 +4362,7 @@ pci_attach_common(device_t dev)
>if (bootverbose)
>device_printf(dev, "domain=%d, 

Re: svn commit: r346386 - in head/sys: dev/bge dev/pci dev/twa x86/iommu

2019-04-25 Thread Ryan Stone
+scottl@, who I believe explained this to us in the first place.

As I recall, it had something to do with 64-bit DMA being expressed as
segment base + 32-bit offset.  DMA engines that blindly try to cross a
32-bit boundary end up back at the start of the segment and read/write
the wrong memory location.

On Thu, Apr 25, 2019 at 4:37 PM John Baldwin  wrote:
>
> I had looked for the aac change, but wasn't able to find it, perhaps because I
> looked at tags created in aac.c rather than aac_pci.c.  I agree aac will need 
> to
> be re-patched.  I'm not really certain how many other devices are actually 
> broken.
> They would all be due to a firmware bug, nothing inherent in PCI.
>
> I believe twa(4) and bge(4) issues predated aac(4) FWIW.
>
> Unfortunately, the main bit of discussion about moving the limit into the PCI 
> bus
> itself seems to be an IRC discussion on 2/28/12 that resulted in revision 
> r232267
> as a quick MFC'able fix, but I don't have a log of that conversation. :(  I
> couldn't find anything in e-mail either that was definitive for why this 
> might have
> been inherent in PCI-e vs a few firmware writers having similar bugs.
>
> On 4/25/19 12:20 PM, Ryan Stone wrote:
> > Following up, this is what will have to be re-instated in the aac driver:
> >
> > http://svn.freebsd.org/changeset/base/232260
> >
> > However, my biggest concern is that we have no idea how many new
> > devices with the broken behaviour might have been introduced since we
> > fixed the problem in general.  How does Linux handle the issue?
> >
> > On Thu, Apr 25, 2019 at 3:17 PM Ryan Stone  wrote:
> >>
> >> This change makes me *very* uncomfortable.  It was originally brought
> >> in due to issues with Adaptec RAID cards using the aac(9) driver.  The
> >> symptoms of the bug included silent corruption of data as it was
> >> written to disk.  Are we sure that this change is a good idea, given
> >> how catastrophic it is when a device gets this wrong?
> >>
> >> On Fri, Apr 19, 2019 at 9:43 AM Tycho Nightingale  
> >> wrote:
> >>>
> >>> Author: tychon
> >>> Date: Fri Apr 19 13:43:33 2019
> >>> New Revision: 346386
> >>> URL: https://svnweb.freebsd.org/changeset/base/346386
> >>>
> >>> Log:
> >>>   remove the 4GB boundary requirement on PCI DMA segments
> >>>
> >>>   Reviewed by:  kib
> >>>   Discussed with:   jhb
> >>>   Sponsored by: Dell EMC Isilon
> >>>   Differential Revision:https://reviews.freebsd.org/D19867
> >>>
> >>> Modified:
> >>>   head/sys/dev/bge/if_bgereg.h
> >>>   head/sys/dev/pci/pci.c
> >>>   head/sys/dev/pci/pcivar.h
> >>>   head/sys/dev/twa/tw_osl.h
> >>>   head/sys/dev/twa/tw_osl_freebsd.c
> >>>   head/sys/x86/iommu/intel_ctx.c
> >>>
> >>> Modified: head/sys/dev/bge/if_bgereg.h
> >>> ==
> >>> --- head/sys/dev/bge/if_bgereg.hFri Apr 19 13:23:41 2019
> >>> (r346385)
> >>> +++ head/sys/dev/bge/if_bgereg.hFri Apr 19 13:43:33 2019
> >>> (r346386)
> >>> @@ -3067,3 +3067,11 @@ struct bge_softc {
> >>>  #defineBGE_LOCK_ASSERT(_sc)mtx_assert(&(_sc)->bge_mtx, 
> >>> MA_OWNED)
> >>>  #defineBGE_UNLOCK(_sc) mtx_unlock(&(_sc)->bge_mtx)
> >>>  #defineBGE_LOCK_DESTROY(_sc)   mtx_destroy(&(_sc)->bge_mtx)
> >>> +
> >>> +#ifdef BUS_SPACE_MAXADDR
> >>> +#if (BUS_SPACE_MAXADDR > 0x)
> >>> +#defineBGE_DMA_BOUNDARY(0x1)
> >>> +#else
> >>> +#defineBGE_DMA_BOUNDARY0
> >>> +#endif
> >>> +#endif
> >>>
> >>> Modified: head/sys/dev/pci/pci.c
> >>> ==
> >>> --- head/sys/dev/pci/pci.c  Fri Apr 19 13:23:41 2019(r346385)
> >>> +++ head/sys/dev/pci/pci.c  Fri Apr 19 13:43:33 2019(r346386)
> >>> @@ -4343,9 +4343,6 @@ pci_attach_common(device_t dev)
> >>>  {
> >>> struct pci_softc *sc;
> >>> int busno, domain;
> >>> -#ifdef PCI_DMA_BOUNDARY
> >>> -   int error, tag_valid;
> >>> -#endif
> >>>  #ifdef PCI_RES_BUS
> >>> int rid;
> >>>  #endif
> >>> @@ -4365,23 +4362,7 @@ pci_attach_common(device_t dev)
> >>> if (bootverbose)
> >>> device_printf(dev, "domain=%d, physical bus=%d\n",
> >>> domain, busno);
> >>> -#ifdef PCI_DMA_BOUNDARY
> >>> -   tag_valid = 0;
> >>> -   if 
> >>> (device_get_devclass(device_get_parent(device_get_parent(dev))) !=
> >>> -   devclass_find("pci")) {
> >>> -   error = bus_dma_tag_create(bus_get_dma_tag(dev), 1,
> >>> -   PCI_DMA_BOUNDARY, BUS_SPACE_MAXADDR, 
> >>> BUS_SPACE_MAXADDR,
> >>> -   NULL, NULL, BUS_SPACE_MAXSIZE, BUS_SPACE_UNRESTRICTED,
> >>> -   BUS_SPACE_MAXSIZE, 0, NULL, NULL, >sc_dma_tag);
> >>> -   if (error)
> >>> -   device_printf(dev, "Failed to create DMA tag: 
> >>> %d\n",
> >>> -   error);
> >>> 

Re: svn commit: r346716 - stable/11/usr.sbin/bhyve

2019-04-25 Thread Rodney W. Grimes
> Author: mav
> Date: Thu Apr 25 22:53:25 2019
> New Revision: 346716
> URL: https://svnweb.freebsd.org/changeset/base/346716
> 
> Log:
>   Fix build with r346707.
> 
> Modified:
>   stable/11/usr.sbin/bhyve/Makefile
> 
> Modified: stable/11/usr.sbin/bhyve/Makefile
> ==
> --- stable/11/usr.sbin/bhyve/Makefile Thu Apr 25 22:52:44 2019
> (r346715)
> +++ stable/11/usr.sbin/bhyve/Makefile Thu Apr 25 22:53:25 2019
> (r346716)
> @@ -3,6 +3,7 @@
>  #
>  
>  .include 
> +CFLAGS+=-I${SRCTOP}/sys
>  
>  PROG=bhyve
>  PACKAGE= bhyve

This is an unnoted direct committ to stable/11?

I am unclear as to why this is needed, it should be picking these
headers up from the tmp directory in obj.

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


svn commit: r346717 - head/usr.sbin/bhyve

2019-04-25 Thread Rodney W. Grimes
Author: rgrimes
Date: Thu Apr 25 22:53:55 2019
New Revision: 346717
URL: https://svnweb.freebsd.org/changeset/base/346717

Log:
  Make bhyve SMBIOS table topology aware
  
  When the CPU Topology was added to bhyve in r332298 the SMBIOS table was
  missed, this table passes topology information to the system and was still
  using the old concept of each vCPU is a socket with 1 core and 1 thread.
  This code did not even try to use the old sysctl information to adjust
  this data.
  
  Correct that by building a proper SMBios table, mapping the > 254 cases to
  0 per the SMBios 2.6 specification that is claimed by the structure.
  
  Reviewed by:  Patrick Mooney 
  Approved by:  bde and/or phk (mentor), jhb (maintainer)
  MFC:  3 days
  Differential Revision:https://reviews.freebsd.org/D18998

Modified:
  head/usr.sbin/bhyve/bhyverun.h
  head/usr.sbin/bhyve/smbiostbl.c

Modified: head/usr.sbin/bhyve/bhyverun.h
==
--- head/usr.sbin/bhyve/bhyverun.h  Thu Apr 25 22:53:25 2019
(r346716)
+++ head/usr.sbin/bhyve/bhyverun.h  Thu Apr 25 22:53:55 2019
(r346717)
@@ -36,6 +36,7 @@
 
 struct vmctx;
 extern int guest_ncpus;
+extern uint16_t cores, sockets, threads;
 extern char *guest_uuid_str;
 extern char *vmname;
 

Modified: head/usr.sbin/bhyve/smbiostbl.c
==
--- head/usr.sbin/bhyve/smbiostbl.c Thu Apr 25 22:53:25 2019
(r346716)
+++ head/usr.sbin/bhyve/smbiostbl.c Thu Apr 25 22:53:55 2019
(r346717)
@@ -636,7 +636,7 @@ smbios_type4_initializer(struct smbios_structure *temp
 {
int i;
 
-   for (i = 0; i < guest_ncpus; i++) {
+   for (i = 0; i < sockets; i++) {
struct smbios_table_type4 *type4;
char *p;
int nstrings, len;
@@ -655,6 +655,16 @@ smbios_type4_initializer(struct smbios_structure *temp
*(*endaddr) = '\0';
(*endaddr)++;
type4->socket = nstrings + 1;
+   /* Revise cores and threads after update to smbios 3.0 */
+   if (cores > 254)
+   type4->cores = 0;
+   else
+   type4->cores = cores;
+   /* This threads is total threads in a socket */
+   if ((cores * threads) > 254)
+   type4->threads = 0;
+   else
+   type4->threads = (cores * threads);
curaddr = *endaddr;
}
 
___
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: r346716 - stable/11/usr.sbin/bhyve

2019-04-25 Thread Alexander Motin
Author: mav
Date: Thu Apr 25 22:53:25 2019
New Revision: 346716
URL: https://svnweb.freebsd.org/changeset/base/346716

Log:
  Fix build with r346707.

Modified:
  stable/11/usr.sbin/bhyve/Makefile

Modified: stable/11/usr.sbin/bhyve/Makefile
==
--- stable/11/usr.sbin/bhyve/Makefile   Thu Apr 25 22:52:44 2019
(r346715)
+++ stable/11/usr.sbin/bhyve/Makefile   Thu Apr 25 22:53:25 2019
(r346716)
@@ -3,6 +3,7 @@
 #
 
 .include 
+CFLAGS+=-I${SRCTOP}/sys
 
 PROG=  bhyve
 PACKAGE=   bhyve
___
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: r346715 - head/usr.sbin/bhyve

2019-04-25 Thread Rodney W. Grimes
Author: rgrimes
Date: Thu Apr 25 22:52:44 2019
New Revision: 346715
URL: https://svnweb.freebsd.org/changeset/base/346715

Log:
  Acpi MADT table correction for VM_MAXCPU > 21
  
  The bhyve acpi MADT table was given a static space of 256 (0x100) bytes,
  this is enough space to allow VM_MAXCPU to be 21, this patch changes that
  so VM_MAXCPU can be of arbitrary value and not overflow the space by
  actually calculating the space needed for the table.
  
  PR:   212782
  Reviewed by:  Patrick Mooney 
  Approved by:  bde (mentor), jhb (maintainer)
  MFC after:3 days
  Differential Revision:https://reviews.freebsd.org/D18815

Modified:
  head/usr.sbin/bhyve/acpi.c

Modified: head/usr.sbin/bhyve/acpi.c
==
--- head/usr.sbin/bhyve/acpi.c  Thu Apr 25 22:51:36 2019(r346714)
+++ head/usr.sbin/bhyve/acpi.c  Thu Apr 25 22:52:44 2019(r346715)
@@ -39,7 +39,9 @@
  *  The tables are placed in the guest's ROM area just below 1MB physical,
  * above the MPTable.
  *
- *  Layout
+ *  Layout (No longer correct at FADT and beyond due to properly
+ *  calculating the size of the MADT to allow for changes to
+ *  VM_MAXCPU above 21 which overflows this layout.)
  *  --
  *   RSDP  ->   0xf2400(36 bytes fixed)
  * RSDT  ->   0xf2440(36 bytes + 4*7 table addrs, 4 used)
@@ -74,18 +76,31 @@ __FBSDID("$FreeBSD$");
 #include "pci_emul.h"
 
 /*
- * Define the base address of the ACPI tables, and the offsets to
- * the individual tables
+ * Define the base address of the ACPI tables, the sizes of some tables, 
+ * and the offsets to the individual tables,
  */
 #define BHYVE_ACPI_BASE0xf2400
 #define RSDT_OFFSET0x040
 #define XSDT_OFFSET0x080
 #define MADT_OFFSET0x100
-#define FADT_OFFSET0x200
-#defineHPET_OFFSET 0x340
-#defineMCFG_OFFSET 0x380
-#define FACS_OFFSET0x3C0
-#define DSDT_OFFSET0x400
+/*
+ * The MADT consists of:
+ * 44  Fixed Header
+ * 8 * maxcpu  Processor Local APIC entries
+ * 12  I/O APIC entry
+ * 2 * 10  Interrupt Source Override entires
+ * 6   Local APIC NMI entry
+ */
+#defineMADT_SIZE   (44 + VM_MAXCPU*8 + 12 + 2*10 + 6)
+#defineFADT_OFFSET (MADT_OFFSET + MADT_SIZE)
+#defineFADT_SIZE   0x140
+#defineHPET_OFFSET (FADT_OFFSET + FADT_SIZE)
+#defineHPET_SIZE   0x40
+#defineMCFG_OFFSET (HPET_OFFSET + HPET_SIZE)
+#defineMCFG_SIZE   0x40
+#defineFACS_OFFSET (MCFG_OFFSET + MCFG_SIZE)
+#defineFACS_SIZE   0x40
+#defineDSDT_OFFSET (FACS_OFFSET + FACS_SIZE)
 
 #defineBHYVE_ASL_TEMPLATE  "bhyve.XXX"
 #define BHYVE_ASL_SUFFIX   ".aml"
___
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: r346714 - in head/sys/amd64: include vmm vmm/amd vmm/intel vmm/io

2019-04-25 Thread Rodney W. Grimes
Author: rgrimes
Date: Thu Apr 25 22:51:36 2019
New Revision: 346714
URL: https://svnweb.freebsd.org/changeset/base/346714

Log:
  Add accessor function for vm->maxcpus
  
  Replace most VM_MAXCPU constant useses with an accessor function to
  vm->maxcpus which for now is initialized and kept at the value of
  VM_MAXCPUS.
  
  This is a rework of Fabian Freyer (fabian.freyer_physik.tu-berlin.de)
  work from D10070 to adjust it for the cpu topology changes that
  occured in r332298
  
  Submitted by: Fabian Freyer (fabian.freyer_physik.tu-berlin.de)
  Reviewed by:  Patrick Mooney 
  Approved by:  bde (mentor), jhb (maintainer)
  MFC after:3 days
  Differential Revision:https://reviews.freebsd.org/D18755

Modified:
  head/sys/amd64/include/vmm.h
  head/sys/amd64/vmm/amd/svm.c
  head/sys/amd64/vmm/intel/vmx.c
  head/sys/amd64/vmm/io/vlapic.c
  head/sys/amd64/vmm/vmm.c
  head/sys/amd64/vmm/vmm_dev.c
  head/sys/amd64/vmm/vmm_lapic.c
  head/sys/amd64/vmm/vmm_stat.c

Modified: head/sys/amd64/include/vmm.h
==
--- head/sys/amd64/include/vmm.hThu Apr 25 22:27:56 2019
(r346713)
+++ head/sys/amd64/include/vmm.hThu Apr 25 22:51:36 2019
(r346714)
@@ -186,6 +186,7 @@ int vm_create(const char *name, struct vm **retvm);
 void vm_destroy(struct vm *vm);
 int vm_reinit(struct vm *vm);
 const char *vm_name(struct vm *vm);
+uint16_t vm_get_maxcpus(struct vm *vm);
 void vm_get_topology(struct vm *vm, uint16_t *sockets, uint16_t *cores,
 uint16_t *threads, uint16_t *maxcpus);
 int vm_set_topology(struct vm *vm, uint16_t sockets, uint16_t cores,

Modified: head/sys/amd64/vmm/amd/svm.c
==
--- head/sys/amd64/vmm/amd/svm.cThu Apr 25 22:27:56 2019
(r346713)
+++ head/sys/amd64/vmm/amd/svm.cThu Apr 25 22:51:36 2019
(r346714)
@@ -524,6 +524,7 @@ svm_vminit(struct vm *vm, pmap_t pmap)
struct svm_vcpu *vcpu;
vm_paddr_t msrpm_pa, iopm_pa, pml4_pa;
int i;
+   uint16_t maxcpus;
 
svm_sc = malloc(sizeof (*svm_sc), M_SVM, M_WAITOK | M_ZERO);
if (((uintptr_t)svm_sc & PAGE_MASK) != 0)
@@ -577,7 +578,8 @@ svm_vminit(struct vm *vm, pmap_t pmap)
iopm_pa = vtophys(svm_sc->iopm_bitmap);
msrpm_pa = vtophys(svm_sc->msr_bitmap);
pml4_pa = svm_sc->nptp;
-   for (i = 0; i < VM_MAXCPU; i++) {
+   maxcpus = vm_get_maxcpus(svm_sc->vm);
+   for (i = 0; i < maxcpus; i++) {
vcpu = svm_get_vcpu(svm_sc, i);
vcpu->nextrip = ~0;
vcpu->lastcpu = NOCPU;

Modified: head/sys/amd64/vmm/intel/vmx.c
==
--- head/sys/amd64/vmm/intel/vmx.c  Thu Apr 25 22:27:56 2019
(r346713)
+++ head/sys/amd64/vmm/intel/vmx.c  Thu Apr 25 22:51:36 2019
(r346714)
@@ -943,6 +943,7 @@ vmx_vminit(struct vm *vm, pmap_t pmap)
struct vmx *vmx;
struct vmcs *vmcs;
uint32_t exc_bitmap;
+   uint16_t maxcpus;
 
vmx = malloc(sizeof(struct vmx), M_VMX, M_WAITOK | M_ZERO);
if ((uintptr_t)vmx & PAGE_MASK) {
@@ -1004,7 +1005,8 @@ vmx_vminit(struct vm *vm, pmap_t pmap)
KASSERT(error == 0, ("vm_map_mmio(apicbase) error %d", error));
}
 
-   for (i = 0; i < VM_MAXCPU; i++) {
+   maxcpus = vm_get_maxcpus(vm);
+   for (i = 0; i < maxcpus; i++) {
vmcs = >vmcs[i];
vmcs->identifier = vmx_revision();
error = vmclear(vmcs);
@@ -3002,11 +3004,13 @@ vmx_vmcleanup(void *arg)
 {
int i;
struct vmx *vmx = arg;
+   uint16_t maxcpus;
 
if (apic_access_virtualization(vmx, 0))
vm_unmap_mmio(vmx->vm, DEFAULT_APIC_BASE, PAGE_SIZE);
 
-   for (i = 0; i < VM_MAXCPU; i++)
+   maxcpus = vm_get_maxcpus(vmx->vm);
+   for (i = 0; i < maxcpus; i++)
vpid_free(vmx->state[i].vpid);
 
free(vmx, M_VMX);

Modified: head/sys/amd64/vmm/io/vlapic.c
==
--- head/sys/amd64/vmm/io/vlapic.c  Thu Apr 25 22:27:56 2019
(r346713)
+++ head/sys/amd64/vmm/io/vlapic.c  Thu Apr 25 22:51:36 2019
(r346714)
@@ -838,7 +838,7 @@ vlapic_calcdest(struct vm *vm, cpuset_t *dmask, uint32
 */
CPU_ZERO(dmask);
vcpuid = vm_apicid2vcpuid(vm, dest);
-   if (vcpuid < VM_MAXCPU)
+   if (vcpuid < vm_get_maxcpus(vm))
CPU_SET(vcpuid, dmask);
} else {
/*
@@ -965,6 +965,7 @@ vlapic_icrlo_write_handler(struct vlapic *vlapic, bool
struct vlapic *vlapic2;
struct vm_exit *vmexit;
struct LAPIC *lapic;
+   uint16_t maxcpus;
 
lapic = 

svn commit: r346713 - head/sys/dev/gpio

2019-04-25 Thread Ian Lepore
Author: ian
Date: Thu Apr 25 22:27:56 2019
New Revision: 346713
URL: https://svnweb.freebsd.org/changeset/base/346713

Log:
  Fix typo: the 4th argument to GPIO_PIN_ACCESS_32 is the set of pins to
  change, not the variable used to return the original pin state.
  
  PR:   237378
  Reported by:  Mori Hiroki 

Modified:
  head/sys/dev/gpio/gpioc.c

Modified: head/sys/dev/gpio/gpioc.c
==
--- head/sys/dev/gpio/gpioc.c   Thu Apr 25 21:54:32 2019(r346712)
+++ head/sys/dev/gpio/gpioc.c   Thu Apr 25 22:27:56 2019(r346713)
@@ -192,7 +192,7 @@ gpioc_ioctl(struct cdev *cdev, u_long cmd, caddr_t arg
case GPIOACCESS32:
a32 = (struct gpio_access_32 *)arg;
res = GPIO_PIN_ACCESS_32(sc->sc_pdev, a32->first_pin,
-   a32->clear_pins, a32->orig_pins, >orig_pins);
+   a32->clear_pins, a32->change_pins, >orig_pins);
break;
case GPIOCONFIG32:
c32 = (struct gpio_config_32 *)arg;
___
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: r346712 - head/sys/compat/linuxkpi/common/src

2019-04-25 Thread Johannes Lundberg
Author: johalun
Date: Thu Apr 25 21:54:32 2019
New Revision: 346712
URL: https://svnweb.freebsd.org/changeset/base/346712

Log:
  Don't call cdev_init where cdev_alloc is called. cdev_alloc already
  handles initialization.
  
  Reported by:  johalun
  Reviewed by:  hps
  Approved by:  imp (mentor), hps
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D19565

Modified:
  head/sys/compat/linuxkpi/common/src/linux_compat.c

Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c
==
--- head/sys/compat/linuxkpi/common/src/linux_compat.c  Thu Apr 25 21:42:02 
2019(r346711)
+++ head/sys/compat/linuxkpi/common/src/linux_compat.c  Thu Apr 25 21:54:32 
2019(r346712)
@@ -2328,7 +2328,7 @@ __register_chrdev(unsigned int major, unsigned int bas
 
for (i = baseminor; i < baseminor + count; i++) {
cdev = cdev_alloc();
-   cdev_init(cdev, fops);
+   cdev->ops = fops;
kobject_set_name(>kobj, name);
 
ret = cdev_add(cdev, makedev(major, i), 1);
@@ -2350,7 +2350,7 @@ __register_chrdev_p(unsigned int major, unsigned int b
 
for (i = baseminor; i < baseminor + count; i++) {
cdev = cdev_alloc();
-   cdev_init(cdev, fops);
+   cdev->ops = fops;
kobject_set_name(>kobj, name);
 
ret = cdev_add_ext(cdev, makedev(major, i), uid, gid, mode);
___
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: r346711 - stable/12

2019-04-25 Thread Enji Cooper
Author: ngie
Date: Thu Apr 25 21:42:02 2019
New Revision: 346711
URL: https://svnweb.freebsd.org/changeset/base/346711

Log:
  MFC r346056:
  
  Fix a typo when sanity checking in the bootstrap-tools target
  
  The path is incorrect for the linker in the error message. It should have been
  /usr/bin/ld, not /usr/bin/cc .

Modified:
  stable/12/Makefile
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/Makefile
==
--- stable/12/Makefile  Thu Apr 25 21:28:28 2019(r346710)
+++ stable/12/Makefile  Thu Apr 25 21:42:02 2019(r346711)
@@ -570,7 +570,7 @@ universe-toolchain: .PHONY universe_prologue
false; \
fi
@if [ ! -e "${HOST_OBJTOP}/tmp/usr/bin/ld" ]; then \
-   echo "Missing host linker at ${HOST_OBJTOP}/tmp/usr/bin/cc?" >&2; \
+   echo "Missing host linker at ${HOST_OBJTOP}/tmp/usr/bin/ld?" >&2; \
false; \
fi
@echo "--"
___
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: r346710 - in stable/12: lib/libc/net sys/fs/nfsclient sys/netinet sys/netinet/netdump sys/netpfil/ipfw/nat64 sys/netpfil/pf

2019-04-25 Thread Rodney W. Grimes
Author: rgrimes
Date: Thu Apr 25 21:28:28 2019
New Revision: 346710
URL: https://svnweb.freebsd.org/changeset/base/346710

Log:
  MFC: r345888: Use IN_foo() macros from sys/netinet/in.h inplace of
  handcrafted code
  
  There are a few places that use hand crafted versions of the macros
  from sys/netinet/in.h making it difficult to actually alter the
  values in use by these macros.  Correct that by replacing handcrafted
  code with proper macro usage.
  
  Reviewed by:  karels, kristof
  Approved by:  bde (mentor, implicit)
  Sponsored by: John Gilmore
  Differential Revision:https://reviews.freebsd.org/D19317

Modified:
  stable/12/lib/libc/net/getnameinfo.c
  stable/12/sys/fs/nfsclient/nfs_clport.c
  stable/12/sys/netinet/in.c
  stable/12/sys/netinet/ip_input.c
  stable/12/sys/netinet/ip_output.c
  stable/12/sys/netinet/netdump/netdump_client.c
  stable/12/sys/netpfil/ipfw/nat64/nat64_translate.h
  stable/12/sys/netpfil/pf/pf.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libc/net/getnameinfo.c
==
--- stable/12/lib/libc/net/getnameinfo.cThu Apr 25 21:25:32 2019
(r346709)
+++ stable/12/lib/libc/net/getnameinfo.cThu Apr 25 21:28:28 2019
(r346710)
@@ -224,10 +224,8 @@ getnameinfo_inet(const struct afd *afd,
case AF_INET:
v4a = (u_int32_t)
ntohl(((const struct sockaddr_in *)sa)->sin_addr.s_addr);
-   if (IN_MULTICAST(v4a) || IN_EXPERIMENTAL(v4a))
-   flags |= NI_NUMERICHOST;
-   v4a >>= IN_CLASSA_NSHIFT;
-   if (v4a == 0)
+   if (IN_MULTICAST(v4a) || IN_EXPERIMENTAL(v4a) ||
+   IN_ZERONET(v4a))
flags |= NI_NUMERICHOST;
break;
 #ifdef INET6

Modified: stable/12/sys/fs/nfsclient/nfs_clport.c
==
--- stable/12/sys/fs/nfsclient/nfs_clport.c Thu Apr 25 21:25:32 2019
(r346709)
+++ stable/12/sys/fs/nfsclient/nfs_clport.c Thu Apr 25 21:28:28 2019
(r346710)
@@ -957,8 +957,7 @@ nfscl_getmyip(struct nfsmount *nmp, struct in6_addr *p
if (error != 0)
return (NULL);
 
-   if ((ntohl(nh_ext.nh_src.s_addr) >> IN_CLASSA_NSHIFT) ==
-   IN_LOOPBACKNET) {
+   if (IN_LOOPBACK(ntohl(nh_ext.nh_src.s_addr))) {
/* Ignore loopback addresses */
return (NULL);
}

Modified: stable/12/sys/netinet/in.c
==
--- stable/12/sys/netinet/in.c  Thu Apr 25 21:25:32 2019(r346709)
+++ stable/12/sys/netinet/in.c  Thu Apr 25 21:28:28 2019(r346710)
@@ -190,15 +190,10 @@ int
 in_canforward(struct in_addr in)
 {
u_long i = ntohl(in.s_addr);
-   u_long net;
 
-   if (IN_EXPERIMENTAL(i) || IN_MULTICAST(i) || IN_LINKLOCAL(i))
+   if (IN_EXPERIMENTAL(i) || IN_MULTICAST(i) || IN_LINKLOCAL(i) ||
+   IN_ZERONET(i) || IN_LOOPBACK(i))
return (0);
-   if (IN_CLASSA(i)) {
-   net = i & IN_CLASSA_NET;
-   if (net == 0 || net == (IN_LOOPBACKNET << IN_CLASSA_NSHIFT))
-   return (0);
-   }
return (1);
 }
 

Modified: stable/12/sys/netinet/ip_input.c
==
--- stable/12/sys/netinet/ip_input.cThu Apr 25 21:25:32 2019
(r346709)
+++ stable/12/sys/netinet/ip_input.cThu Apr 25 21:28:28 2019
(r346710)
@@ -501,10 +501,10 @@ ip_input(struct mbuf *m)
 
IP_PROBE(receive, NULL, NULL, ip, m->m_pkthdr.rcvif, ip, NULL);
 
-   /* 127/8 must not appear on wire - RFC1122 */
+   /* IN_LOOPBACK must not appear on the wire - RFC1122 */
ifp = m->m_pkthdr.rcvif;
-   if ((ntohl(ip->ip_dst.s_addr) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET ||
-   (ntohl(ip->ip_src.s_addr) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET) {
+   if (IN_LOOPBACK(ntohl(ip->ip_dst.s_addr)) ||
+   IN_LOOPBACK(ntohl(ip->ip_src.s_addr))) {
if ((ifp->if_flags & IFF_LOOPBACK) == 0) {
IPSTAT_INC(ips_badaddr);
goto bad;

Modified: stable/12/sys/netinet/ip_output.c
==
--- stable/12/sys/netinet/ip_output.c   Thu Apr 25 21:25:32 2019
(r346709)
+++ stable/12/sys/netinet/ip_output.c   Thu Apr 25 21:28:28 2019
(r346710)
@@ -588,9 +588,9 @@ sendit:
}
}
 
-   /* 127/8 must not appear on wire - RFC1122. */
-   if ((ntohl(ip->ip_dst.s_addr) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET ||
-   (ntohl(ip->ip_src.s_addr) >> IN_CLASSA_NSHIFT) == 

svn commit: r346709 - head/usr.sbin/nfsdumpstate

2019-04-25 Thread Rick Macklem
Author: rmacklem
Date: Thu Apr 25 21:25:32 2019
New Revision: 346709
URL: https://svnweb.freebsd.org/changeset/base/346709

Log:
  Add support to nfsdumpstate for printing of INET6 addresses for locks.
  
  r346190 added support for printing of INET6 addresses for the "-o" option
  (all opens) but missed adding support for INET6 addresses for the "-l" option.
  This patch adds that support.
  
  PR:   223036
  MFC after:1 week

Modified:
  head/usr.sbin/nfsdumpstate/nfsdumpstate.c

Modified: head/usr.sbin/nfsdumpstate/nfsdumpstate.c
==
--- head/usr.sbin/nfsdumpstate/nfsdumpstate.c   Thu Apr 25 21:24:56 2019
(r346708)
+++ head/usr.sbin/nfsdumpstate/nfsdumpstate.c   Thu Apr 25 21:25:32 2019
(r346709)
@@ -176,6 +176,7 @@ dump_lockstate(char *fname)
 {
struct nfsd_dumplocklist dumplocklist;
int cnt, i;
+   char nbuf[INET6_ADDRSTRLEN];
 
dumplocklist.ndllck_size = DUMPSIZE;
dumplocklist.ndllck_list = (void *)lp;
@@ -183,7 +184,7 @@ dump_lockstate(char *fname)
if (nfssvc(NFSSVC_DUMPLOCKS, ) < 0)
errx(1, "Can't dump locks for %s\n", fname);
 
-   printf("%-11s %-36s %-15s %s\n",
+   printf("%-11s %-36s %-45s %s\n",
"Open/Lock",
"  Stateid or Lock Range",
"Clientaddr",
@@ -213,11 +214,26 @@ dump_lockstate(char *fname)
lock_flags(lp[cnt].ndlck_flags),
lp[cnt].ndlck_first,
lp[cnt].ndlck_end);
-   if (lp[cnt].ndlck_addrfam == AF_INET)
-   printf("%-15s ",
+   switch (lp[cnt].ndlck_addrfam) {
+#ifdef INET
+   case AF_INET:
+   printf("%-45s ",
inet_ntoa(lp[cnt].ndlck_cbaddr.sin_addr));
-   else
-   printf("%-15s ", "  ");
+   break;
+#endif
+#ifdef INET6
+   case AF_INET6:
+   if (inet_ntop(AF_INET6, [cnt].ndlck_cbaddr.sin6_addr,
+   nbuf, sizeof(nbuf)) != NULL)
+   printf("%-45s ", nbuf);
+   else
+   printf("%-45s ", " ");
+   break;
+#endif
+   default:
+   printf("%-45s ", "  ");
+   break;
+   }
for (i = 0; i < lp[cnt].ndlck_owner.nclid_idlen; i++)
printf("%02x", lp[cnt].ndlck_owner.nclid_id[i]);
printf(" ");
___
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: r346708 - in head: share/man/man4 sys/net

2019-04-25 Thread Stephen Hurd
Author: shurd
Date: Thu Apr 25 21:24:56 2019
New Revision: 346708
URL: https://svnweb.freebsd.org/changeset/base/346708

Log:
  iflib: Better control over queue core assignment
  
  By default, cores are now assigned to queues in a sequential
  manner rather than all NICs starting at the first core. On a four-core
  system with two NICs each using two queue pairs, the nic:queue -> core
  mapping has changed from this:
  
  0:0 -> 0, 0:1 -> 1
  1:0 -> 0, 1:1 -> 1
  
  To this:
  
  0:0 -> 0, 0:1 -> 1
  1:0 -> 2, 1:1 -> 3
  
  Additionally, a device can now be configured to use separate cores for TX
  and RX queues.
  
  Two new tunables have been added, dev.X.Y.iflib.separate_txrx and
  dev.X.Y.iflib.core_offset. If core_offset is set, the NIC is not part
  of the auto-assigned sequence.
  
  Reviewed by:  marius
  MFC after:2 weeks
  Sponsored by: Limelight Networks
  Differential Revision:https://reviews.freebsd.org/D20029

Modified:
  head/share/man/man4/iflib.4
  head/sys/net/iflib.c

Modified: head/share/man/man4/iflib.4
==
--- head/share/man/man4/iflib.4 Thu Apr 25 21:09:07 2019(r346707)
+++ head/share/man/man4/iflib.4 Thu Apr 25 21:24:56 2019(r346708)
@@ -55,6 +55,16 @@ If zero, the number of TX queues is derived from the n
 socket connected to the controller.
 .It Va disable_msix
 Disables MSI-X interrupts for the device.
+.It Va core_offset
+Specifies a starting core offset to assign queues to.
+If the value is unspecified or 65535, cores are assigned sequentially across
+controllers.
+.It Va separate_txrx
+Requests that RX and TX queues not be paired on the same core.
+If this is zero or not set, an RX and TX queue pair will be assigned to each
+core.
+When set to a non-zero value, TX queues are assigned to cores following the
+last RX queue.
 .El
 .Pp
 These

Modified: head/sys/net/iflib.c
==
--- head/sys/net/iflib.cThu Apr 25 21:09:07 2019(r346707)
+++ head/sys/net/iflib.cThu Apr 25 21:24:56 2019(r346708)
@@ -189,6 +189,9 @@ struct iflib_ctx {
uint16_t ifc_sysctl_qs_eq_override;
uint16_t ifc_sysctl_rx_budget;
uint16_t ifc_sysctl_tx_abdicate;
+   uint16_t ifc_sysctl_core_offset;
+#defineCORE_OFFSET_UNSPECIFIED 0x
+   uint8_t  ifc_sysctl_separate_txrx;
 
qidx_t ifc_sysctl_ntxds[8];
qidx_t ifc_sysctl_nrxds[8];
@@ -723,6 +726,18 @@ static void iflib_free_intr_mem(if_ctx_t ctx);
 static struct mbuf * iflib_fixup_rx(struct mbuf *m);
 #endif
 
+static SLIST_HEAD(cpu_offset_list, cpu_offset) cpu_offsets =
+SLIST_HEAD_INITIALIZER(cpu_offsets);
+struct cpu_offset {
+   SLIST_ENTRY(cpu_offset) entries;
+   cpuset_tset;
+   unsigned intrefcount;
+   uint16_toffset;
+};
+static struct mtx cpu_offset_mtx;
+MTX_SYSINIT(iflib_cpu_offset, _offset_mtx, "iflib_cpu_offset lock",
+MTX_DEF);
+
 NETDUMP_DEFINE(iflib);
 
 #ifdef DEV_NETMAP
@@ -4461,6 +4476,71 @@ iflib_rem_pfil(if_ctx_t ctx)
pfil_head_unregister(pfil);
 }
 
+static uint16_t
+get_ctx_core_offset(if_ctx_t ctx)
+{
+   if_softc_ctx_t scctx = >ifc_softc_ctx;
+   struct cpu_offset *op;
+   uint16_t qc;
+   uint16_t ret = ctx->ifc_sysctl_core_offset;
+
+   if (ret != CORE_OFFSET_UNSPECIFIED)
+   return (ret);
+
+   if (ctx->ifc_sysctl_separate_txrx)
+   qc = scctx->isc_ntxqsets + scctx->isc_nrxqsets;
+   else
+   qc = max(scctx->isc_ntxqsets, scctx->isc_nrxqsets);
+
+   mtx_lock(_offset_mtx);
+   SLIST_FOREACH(op, _offsets, entries) {
+   if (CPU_CMP(>ifc_cpus, >set) == 0) {
+   ret = op->offset;
+   op->offset += qc;
+   MPASS(op->refcount < UINT_MAX);
+   op->refcount++;
+   break;
+   }
+   }
+   if (ret == CORE_OFFSET_UNSPECIFIED) {
+   ret = 0;
+   op = malloc(sizeof(struct cpu_offset), M_IFLIB,
+   M_NOWAIT | M_ZERO);
+   if (op == NULL) {
+   device_printf(ctx->ifc_dev,
+   "allocation for cpu offset failed.\n");
+   } else {
+   op->offset = qc;
+   op->refcount = 1;
+   CPU_COPY(>ifc_cpus, >set);
+   SLIST_INSERT_HEAD(_offsets, op, entries);
+   }
+   }
+   mtx_unlock(_offset_mtx);
+
+   return (ret);
+}
+
+static void
+unref_ctx_core_offset(if_ctx_t ctx)
+{
+   struct cpu_offset *op, *top;
+
+   mtx_lock(_offset_mtx);
+   SLIST_FOREACH_SAFE(op, _offsets, entries, top) {
+   if (CPU_CMP(>ifc_cpus, >set) == 0) {
+   MPASS(op->refcount > 0);
+   op->refcount--;
+  

svn commit: r346707 - in stable/11: sys/amd64/vmm/intel usr.sbin/bhyve

2019-04-25 Thread Alexander Motin
Author: mav
Date: Thu Apr 25 21:09:07 2019
New Revision: 346707
URL: https://svnweb.freebsd.org/changeset/base/346707

Log:
  MFC r339826 (by yuripv):
  Provide basic descriptions for VMX exit reason (from "Intel 64 and IA-32
  Architectures Software Developer’s Manual Volume 3").  Add the document
  to SEE ALSO in bhyve.8 (and pet manlint here a bit).

Modified:
  stable/11/sys/amd64/vmm/intel/vmcs.h
  stable/11/usr.sbin/bhyve/bhyve.8
  stable/11/usr.sbin/bhyve/bhyverun.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/amd64/vmm/intel/vmcs.h
==
--- stable/11/sys/amd64/vmm/intel/vmcs.hThu Apr 25 21:04:38 2019
(r346706)
+++ stable/11/sys/amd64/vmm/intel/vmcs.hThu Apr 25 21:09:07 2019
(r346707)
@@ -336,6 +336,14 @@ vmcs_write(uint32_t encoding, uint64_t val)
 #define EXIT_REASON_WBINVD 54
 #define EXIT_REASON_XSETBV 55
 #defineEXIT_REASON_APIC_WRITE  56
+#defineEXIT_REASON_RDRAND  57
+#defineEXIT_REASON_INVPCID 58
+#defineEXIT_REASON_VMFUNC  59
+#defineEXIT_REASON_ENCLS   60
+#defineEXIT_REASON_RDSEED  61
+#defineEXIT_REASON_PM_LOG_FULL 62
+#defineEXIT_REASON_XSAVES  63
+#defineEXIT_REASON_XRSTORS 64
 
 /*
  * NMI unblocking due to IRET.

Modified: stable/11/usr.sbin/bhyve/bhyve.8
==
--- stable/11/usr.sbin/bhyve/bhyve.8Thu Apr 25 21:04:38 2019
(r346706)
+++ stable/11/usr.sbin/bhyve/bhyve.8Thu Apr 25 21:09:07 2019
(r346707)
@@ -309,7 +309,11 @@ Emergency write is advertised, but no-op at present.
 .Pp
 Framebuffer devices:
 .Bl -tag -width 10n
-.It Oo rfb= Ns Oo Ar IP: Oc Ns Ar port Oc Ns Oo ,w= Ns Ar width Oc Ns Oo ,h= 
Ns Ar height Oc Ns Oo ,vga= Ns Ar vgaconf Oc Ns Oo Ns ,wait Oc Ns Oo ,password= 
Ns Ar password Oc
+.It Xo
+.Oo rfb= Ns Oo Ar IP\&: Oc Ns Ar port Oc Ns Oo ,w= Ns Ar width Oc Ns Oo ,h= Ns
+.Ar height Oc Ns Oo ,vga= Ns Ar vgaconf Oc Ns Oo Ns ,wait Oc Ns Oo ,password= 
Ns
+.Ar password Oc
+.Xc
 .Bl -tag -width 8n
 .It Ar IPv4:port No or Ar [IPv6%zone]:port
 An
@@ -340,8 +344,8 @@ and memory space
 .Pq 64KB at Ad 0xA .
 The default
 .Dq io
-option should be used for guests that attempt to issue BIOS
-calls which result in I/O port queries, and fail to boot if I/O decode is 
disabled.
+option should be used for guests that attempt to issue BIOS calls which result
+in I/O port queries, and fail to boot if I/O decode is disabled.
 .Pp
 The
 .Dq on
@@ -366,8 +370,8 @@ for configuration notes of particular guests.
 .It wait
 Instruct
 .Nm
-to only boot upon the initiation of a VNC connection, simplifying the 
installation
-of operating systems that require immediate keyboard input.
+to only boot upon the initiation of a VNC connection, simplifying the
+installation of operating systems that require immediate keyboard input.
 This can be removed for post-installation use.
 .It password
 This type of authentication is known to be cryptographically weak and is not
@@ -512,6 +516,12 @@ bhyve -c 2 -m 4G -w -H \\
 .Xr ethers 5 ,
 .Xr bhyvectl 8 ,
 .Xr bhyveload 8
+.Pp
+.Rs
+.%A Intel
+.%B 64 and IA-32 Architectures Software Developer’s Manual
+.%V Volume 3
+.Re
 .Sh HISTORY
 .Nm
 first appeared in

Modified: stable/11/usr.sbin/bhyve/bhyverun.c
==
--- stable/11/usr.sbin/bhyve/bhyverun.c Thu Apr 25 21:04:38 2019
(r346706)
+++ stable/11/usr.sbin/bhyve/bhyverun.c Thu Apr 25 21:09:07 2019
(r346707)
@@ -38,6 +38,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
+
 #include 
 #include 
 
@@ -88,6 +90,73 @@ __FBSDID("$FreeBSD$");
 #define MB (1024UL * 1024)
 #define GB (1024UL * MB)
 
+static const char * const vmx_exit_reason_desc[] = {
+   [EXIT_REASON_EXCEPTION] = "Exception or non-maskable interrupt (NMI)",
+   [EXIT_REASON_EXT_INTR] = "External interrupt",
+   [EXIT_REASON_TRIPLE_FAULT] = "Triple fault",
+   [EXIT_REASON_INIT] = "INIT signal",
+   [EXIT_REASON_SIPI] = "Start-up IPI (SIPI)",
+   [EXIT_REASON_IO_SMI] = "I/O system-management interrupt (SMI)",
+   [EXIT_REASON_SMI] = "Other SMI",
+   [EXIT_REASON_INTR_WINDOW] = "Interrupt window",
+   [EXIT_REASON_NMI_WINDOW] = "NMI window",
+   [EXIT_REASON_TASK_SWITCH] = "Task switch",
+   [EXIT_REASON_CPUID] = "CPUID",
+   [EXIT_REASON_GETSEC] = "GETSEC",
+   [EXIT_REASON_HLT] = "HLT",
+   [EXIT_REASON_INVD] = "INVD",
+   [EXIT_REASON_INVLPG] = "INVLPG",
+   [EXIT_REASON_RDPMC] = "RDPMC",
+   [EXIT_REASON_RDTSC] = "RDTSC",
+   [EXIT_REASON_RSM] = "RSM",
+   [EXIT_REASON_VMCALL] = "VMCALL",
+   [EXIT_REASON_VMCLEAR] = 

svn commit: r346706 - in stable/12: sys/amd64/vmm/intel usr.sbin/bhyve

2019-04-25 Thread Alexander Motin
Author: mav
Date: Thu Apr 25 21:04:38 2019
New Revision: 346706
URL: https://svnweb.freebsd.org/changeset/base/346706

Log:
  MFC r339826 (by yuripv):
  Provide basic descriptions for VMX exit reason (from "Intel 64 and IA-32
  Architectures Software Developer’s Manual Volume 3").  Add the document
  to SEE ALSO in bhyve.8 (and pet manlint here a bit).

Modified:
  stable/12/sys/amd64/vmm/intel/vmcs.h
  stable/12/usr.sbin/bhyve/bhyve.8
  stable/12/usr.sbin/bhyve/bhyverun.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/amd64/vmm/intel/vmcs.h
==
--- stable/12/sys/amd64/vmm/intel/vmcs.hThu Apr 25 20:48:25 2019
(r346705)
+++ stable/12/sys/amd64/vmm/intel/vmcs.hThu Apr 25 21:04:38 2019
(r346706)
@@ -338,6 +338,14 @@ vmcs_write(uint32_t encoding, uint64_t val)
 #define EXIT_REASON_WBINVD 54
 #define EXIT_REASON_XSETBV 55
 #defineEXIT_REASON_APIC_WRITE  56
+#defineEXIT_REASON_RDRAND  57
+#defineEXIT_REASON_INVPCID 58
+#defineEXIT_REASON_VMFUNC  59
+#defineEXIT_REASON_ENCLS   60
+#defineEXIT_REASON_RDSEED  61
+#defineEXIT_REASON_PM_LOG_FULL 62
+#defineEXIT_REASON_XSAVES  63
+#defineEXIT_REASON_XRSTORS 64
 
 /*
  * NMI unblocking due to IRET.

Modified: stable/12/usr.sbin/bhyve/bhyve.8
==
--- stable/12/usr.sbin/bhyve/bhyve.8Thu Apr 25 20:48:25 2019
(r346705)
+++ stable/12/usr.sbin/bhyve/bhyve.8Thu Apr 25 21:04:38 2019
(r346706)
@@ -376,7 +376,11 @@ Emergency write is advertised, but no-op at present.
 .Pp
 Framebuffer devices:
 .Bl -tag -width 10n
-.It Oo rfb= Ns Oo Ar IP: Oc Ns Ar port Oc Ns Oo ,w= Ns Ar width Oc Ns Oo ,h= 
Ns Ar height Oc Ns Oo ,vga= Ns Ar vgaconf Oc Ns Oo Ns ,wait Oc Ns Oo ,password= 
Ns Ar password Oc
+.It Xo
+.Oo rfb= Ns Oo Ar IP\&: Oc Ns Ar port Oc Ns Oo ,w= Ns Ar width Oc Ns Oo ,h= Ns
+.Ar height Oc Ns Oo ,vga= Ns Ar vgaconf Oc Ns Oo Ns ,wait Oc Ns Oo ,password= 
Ns
+.Ar password Oc
+.Xc
 .Bl -tag -width 8n
 .It Ar IPv4:port No or Ar [IPv6%zone]:port
 An
@@ -407,8 +411,8 @@ and memory space
 .Pq 64KB at Ad 0xA .
 The default
 .Dq io
-option should be used for guests that attempt to issue BIOS
-calls which result in I/O port queries, and fail to boot if I/O decode is 
disabled.
+option should be used for guests that attempt to issue BIOS calls which result
+in I/O port queries, and fail to boot if I/O decode is disabled.
 .Pp
 The
 .Dq on
@@ -433,8 +437,8 @@ for configuration notes of particular guests.
 .It wait
 Instruct
 .Nm
-to only boot upon the initiation of a VNC connection, simplifying the 
installation
-of operating systems that require immediate keyboard input.
+to only boot upon the initiation of a VNC connection, simplifying the
+installation of operating systems that require immediate keyboard input.
 This can be removed for post-installation use.
 .It password
 This type of authentication is known to be cryptographically weak and is not
@@ -506,8 +510,9 @@ General purpose registers can be queried for each virt
 registers such as floating-point and system registers cannot be queried.
 .Ss Memory
 Memory (including memory mapped I/O regions) can be read by the debugger,
-but not written.  Memory operations use virtual addresses that are resolved
-to physical addresses via the current virtual CPU's active address translation.
+but not written.
+Memory operations use virtual addresses that are resolved to physical addresses
+via the current virtual CPU's active address translation.
 .Ss Control
 The running guest can be interrupted by the debugger at any time
 .Pq for example, by pressing Ctrl-C in the debugger .
@@ -618,6 +623,12 @@ bhyve -c 2 -m 4G -w -H \\
 .Xr ethers 5 ,
 .Xr bhyvectl 8 ,
 .Xr bhyveload 8
+.Pp
+.Rs
+.%A Intel
+.%B 64 and IA-32 Architectures Software Developer’s Manual
+.%V Volume 3
+.Re
 .Sh HISTORY
 .Nm
 first appeared in

Modified: stable/12/usr.sbin/bhyve/bhyverun.c
==
--- stable/12/usr.sbin/bhyve/bhyverun.c Thu Apr 25 20:48:25 2019
(r346705)
+++ stable/12/usr.sbin/bhyve/bhyverun.c Thu Apr 25 21:04:38 2019
(r346706)
@@ -38,6 +38,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
+
 #include 
 #include 
 
@@ -89,6 +91,73 @@ __FBSDID("$FreeBSD$");
 #define MB (1024UL * 1024)
 #define GB (1024UL * MB)
 
+static const char * const vmx_exit_reason_desc[] = {
+   [EXIT_REASON_EXCEPTION] = "Exception or non-maskable interrupt (NMI)",
+   [EXIT_REASON_EXT_INTR] = "External interrupt",
+   [EXIT_REASON_TRIPLE_FAULT] = "Triple fault",
+   [EXIT_REASON_INIT] = "INIT signal",
+   

svn commit: r346705 - head/lib/libbe

2019-04-25 Thread Kyle Evans
Author: kevans
Date: Thu Apr 25 20:48:25 2019
New Revision: 346705
URL: https://svnweb.freebsd.org/changeset/base/346705

Log:
  libbe(3): Fix libcompat build
  
  SHLIBDIR should still be optionally set, just before src.opts.mk is included
  so that libcompat can properly override it. This fixes lib32 failures
  reported by both Jenkins and Michael Butler.
  
  Reported by:  Michael Butler 
  MFC after:3 days
  X-MFC-With:   r346546

Modified:
  head/lib/libbe/Makefile

Modified: head/lib/libbe/Makefile
==
--- head/lib/libbe/Makefile Thu Apr 25 20:23:13 2019(r346704)
+++ head/lib/libbe/Makefile Thu Apr 25 20:48:25 2019(r346705)
@@ -1,10 +1,11 @@
 # $FreeBSD$
 
+SHLIBDIR?= /lib
+
 .include 
 
 PACKAGE=   lib${LIB}
 LIB=   be
-SHLIBDIR=  /lib
 SHLIB_MAJOR=   1
 SHLIB_MINOR=   0
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r346386 - in head/sys: dev/bge dev/pci dev/twa x86/iommu

2019-04-25 Thread John Baldwin
I had looked for the aac change, but wasn't able to find it, perhaps because I
looked at tags created in aac.c rather than aac_pci.c.  I agree aac will need to
be re-patched.  I'm not really certain how many other devices are actually 
broken.
They would all be due to a firmware bug, nothing inherent in PCI.

I believe twa(4) and bge(4) issues predated aac(4) FWIW.

Unfortunately, the main bit of discussion about moving the limit into the PCI 
bus 
itself seems to be an IRC discussion on 2/28/12 that resulted in revision 
r232267
as a quick MFC'able fix, but I don't have a log of that conversation. :(  I
couldn't find anything in e-mail either that was definitive for why this might 
have
been inherent in PCI-e vs a few firmware writers having similar bugs.

On 4/25/19 12:20 PM, Ryan Stone wrote:
> Following up, this is what will have to be re-instated in the aac driver:
> 
> http://svn.freebsd.org/changeset/base/232260
> 
> However, my biggest concern is that we have no idea how many new
> devices with the broken behaviour might have been introduced since we
> fixed the problem in general.  How does Linux handle the issue?
> 
> On Thu, Apr 25, 2019 at 3:17 PM Ryan Stone  wrote:
>>
>> This change makes me *very* uncomfortable.  It was originally brought
>> in due to issues with Adaptec RAID cards using the aac(9) driver.  The
>> symptoms of the bug included silent corruption of data as it was
>> written to disk.  Are we sure that this change is a good idea, given
>> how catastrophic it is when a device gets this wrong?
>>
>> On Fri, Apr 19, 2019 at 9:43 AM Tycho Nightingale  wrote:
>>>
>>> Author: tychon
>>> Date: Fri Apr 19 13:43:33 2019
>>> New Revision: 346386
>>> URL: https://svnweb.freebsd.org/changeset/base/346386
>>>
>>> Log:
>>>   remove the 4GB boundary requirement on PCI DMA segments
>>>
>>>   Reviewed by:  kib
>>>   Discussed with:   jhb
>>>   Sponsored by: Dell EMC Isilon
>>>   Differential Revision:https://reviews.freebsd.org/D19867
>>>
>>> Modified:
>>>   head/sys/dev/bge/if_bgereg.h
>>>   head/sys/dev/pci/pci.c
>>>   head/sys/dev/pci/pcivar.h
>>>   head/sys/dev/twa/tw_osl.h
>>>   head/sys/dev/twa/tw_osl_freebsd.c
>>>   head/sys/x86/iommu/intel_ctx.c
>>>
>>> Modified: head/sys/dev/bge/if_bgereg.h
>>> ==
>>> --- head/sys/dev/bge/if_bgereg.hFri Apr 19 13:23:41 2019
>>> (r346385)
>>> +++ head/sys/dev/bge/if_bgereg.hFri Apr 19 13:43:33 2019
>>> (r346386)
>>> @@ -3067,3 +3067,11 @@ struct bge_softc {
>>>  #defineBGE_LOCK_ASSERT(_sc)mtx_assert(&(_sc)->bge_mtx, 
>>> MA_OWNED)
>>>  #defineBGE_UNLOCK(_sc) mtx_unlock(&(_sc)->bge_mtx)
>>>  #defineBGE_LOCK_DESTROY(_sc)   mtx_destroy(&(_sc)->bge_mtx)
>>> +
>>> +#ifdef BUS_SPACE_MAXADDR
>>> +#if (BUS_SPACE_MAXADDR > 0x)
>>> +#defineBGE_DMA_BOUNDARY(0x1)
>>> +#else
>>> +#defineBGE_DMA_BOUNDARY0
>>> +#endif
>>> +#endif
>>>
>>> Modified: head/sys/dev/pci/pci.c
>>> ==
>>> --- head/sys/dev/pci/pci.c  Fri Apr 19 13:23:41 2019(r346385)
>>> +++ head/sys/dev/pci/pci.c  Fri Apr 19 13:43:33 2019(r346386)
>>> @@ -4343,9 +4343,6 @@ pci_attach_common(device_t dev)
>>>  {
>>> struct pci_softc *sc;
>>> int busno, domain;
>>> -#ifdef PCI_DMA_BOUNDARY
>>> -   int error, tag_valid;
>>> -#endif
>>>  #ifdef PCI_RES_BUS
>>> int rid;
>>>  #endif
>>> @@ -4365,23 +4362,7 @@ pci_attach_common(device_t dev)
>>> if (bootverbose)
>>> device_printf(dev, "domain=%d, physical bus=%d\n",
>>> domain, busno);
>>> -#ifdef PCI_DMA_BOUNDARY
>>> -   tag_valid = 0;
>>> -   if (device_get_devclass(device_get_parent(device_get_parent(dev))) 
>>> !=
>>> -   devclass_find("pci")) {
>>> -   error = bus_dma_tag_create(bus_get_dma_tag(dev), 1,
>>> -   PCI_DMA_BOUNDARY, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR,
>>> -   NULL, NULL, BUS_SPACE_MAXSIZE, BUS_SPACE_UNRESTRICTED,
>>> -   BUS_SPACE_MAXSIZE, 0, NULL, NULL, >sc_dma_tag);
>>> -   if (error)
>>> -   device_printf(dev, "Failed to create DMA tag: %d\n",
>>> -   error);
>>> -   else
>>> -   tag_valid = 1;
>>> -   }
>>> -   if (!tag_valid)
>>> -#endif
>>> -   sc->sc_dma_tag = bus_get_dma_tag(dev);
>>> +   sc->sc_dma_tag = bus_get_dma_tag(dev);
>>> return (0);
>>>  }
>>>
>>>
>>> Modified: head/sys/dev/pci/pcivar.h
>>> ==
>>> --- head/sys/dev/pci/pcivar.h   Fri Apr 19 13:23:41 2019(r346385)
>>> +++ head/sys/dev/pci/pcivar.h   Fri Apr 19 13:43:33 2019(r346386)
>>> @@ -693,14 +693,6 @@ int

svn commit: r346704 - head/stand/efi/loader

2019-04-25 Thread Warner Losh
Author: imp
Date: Thu Apr 25 20:23:13 2019
New Revision: 346704
URL: https://svnweb.freebsd.org/changeset/base/346704

Log:
  Add the proper range of years for Netflix's copyright on this
  file. Note that I wrote it.

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

Modified: head/stand/efi/loader/main.c
==
--- head/stand/efi/loader/main.cThu Apr 25 20:10:02 2019
(r346703)
+++ head/stand/efi/loader/main.cThu Apr 25 20:23:13 2019
(r346704)
@@ -3,7 +3,7 @@
  * Copyright (c) 2006 Marcel Moolenaar
  * All rights reserved.
  *
- * Copyright (c) 2018 Netflix, Inc.
+ * Copyright (c) 2016-2019 Netflix, Inc. written by M. Warner Losh
  * 
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
___
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: r346703 - head/stand/efi/loader

2019-04-25 Thread Warner Losh
Author: imp
Date: Thu Apr 25 20:10:02 2019
New Revision: 346703
URL: https://svnweb.freebsd.org/changeset/base/346703

Log:
  Move initialization of the block device handles earlier (we're just
  snagging them from UEFI BIOS). Call the device type init routines
  earlier as well, as they don't depend on how the console is
  setup. This will allow us to read files earlier in boot, so any rare
  error messages that this might move only to the EFI console will be an
  acceptable price to pay. Also tweak the order of has_kbd so it resides
  next to the rest of the console code. It needs to be after we initialize
  the buffer cache.

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

Modified: head/stand/efi/loader/main.c
==
--- head/stand/efi/loader/main.cThu Apr 25 20:09:49 2019
(r346702)
+++ head/stand/efi/loader/main.cThu Apr 25 20:10:02 2019
(r346703)
@@ -783,13 +783,30 @@ main(int argc, CHAR16 *argv[])
/* Init the time source */
efi_time_init();
 
-   has_kbd = has_keyboard();
-
/*
 * Initialise the block cache. Set the upper limit.
 */
bcache_init(32768, 512);
 
+   /*
+* Scan the BLOCK IO MEDIA handles then
+* march through the device switch probing for things.
+*/
+   i = efipart_inithandles();
+   if (i != 0 && i != ENOENT) {
+   printf("efipart_inithandles failed with ERRNO %d, expect "
+   "failures\n", i);
+   }
+
+   for (i = 0; devsw[i] != NULL; i++)
+   if (devsw[i]->dv_init != NULL)
+   (devsw[i]->dv_init)();
+
+   /*
+* Detect console settings two different ways: one via the command
+* args (eg -h) or via the UEFI ConOut variable.
+*/
+   has_kbd = has_keyboard();
howto = parse_args(argc, argv);
if (!has_kbd && (howto & RB_PROBE))
howto |= RB_SERIAL | RB_MULTIPLE;
@@ -852,20 +869,6 @@ main(int argc, CHAR16 *argv[])
if ((s = getenv("fail_timeout")) != NULL)
fail_timeout = strtol(s, NULL, 10);
 
-   /*
-* Scan the BLOCK IO MEDIA handles then
-* march through the device switch probing for things.
-*/
-   i = efipart_inithandles();
-   if (i != 0 && i != ENOENT) {
-   printf("efipart_inithandles failed with ERRNO %d, expect "
-   "failures\n", i);
-   }
-
-   for (i = 0; devsw[i] != NULL; i++)
-   if (devsw[i]->dv_init != NULL)
-   (devsw[i]->dv_init)();
-
printf("%s\n", bootprog_info);
printf("   Command line arguments:");
for (i = 0; i < argc; i++)
@@ -877,8 +880,6 @@ main(int argc, CHAR16 *argv[])
printf("   EFI Firmware: %S (rev %d.%02d)\n", ST->FirmwareVendor,
ST->FirmwareRevision >> 16, ST->FirmwareRevision & 0x);
printf("   Console: %s (%#x)\n", getenv("console"), howto);
-
-
 
/* Determine the devpath of our image so we can prefer it. */
text = efi_devpath_name(boot_img->FilePath);
___
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: r346702 - in head/stand/efi: include libefi

2019-04-25 Thread Warner Losh
Author: imp
Date: Thu Apr 25 20:09:49 2019
New Revision: 346702
URL: https://svnweb.freebsd.org/changeset/base/346702

Log:
  Add efi_freebsd_delenv
  
  Add a wrapper around efi_delenv akin to efi_freebsd_getenv and
  efi_getenv.

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

Modified: head/stand/efi/include/efilib.h
==
--- head/stand/efi/include/efilib.h Thu Apr 25 20:08:43 2019
(r346701)
+++ head/stand/efi/include/efilib.h Thu Apr 25 20:09:49 2019
(r346702)
@@ -126,6 +126,7 @@ void cpy16to8(const CHAR16 *, char *, size_t);
  */
 
 EFI_STATUS efi_delenv(EFI_GUID *guid, const char *varname);
+EFI_STATUS efi_freebsd_delenv(const char *varname);
 EFI_STATUS efi_freebsd_getenv(const char *v, void *data, __size_t *len);
 EFI_STATUS efi_getenv(EFI_GUID *g, const char *v, void *data, __size_t *len);
 EFI_STATUS efi_global_getenv(const char *v, void *data, __size_t *len);

Modified: head/stand/efi/libefi/efienv.c
==
--- head/stand/efi/libefi/efienv.c  Thu Apr 25 20:08:43 2019
(r346701)
+++ head/stand/efi/libefi/efienv.c  Thu Apr 25 20:09:49 2019
(r346702)
@@ -119,5 +119,11 @@ efi_delenv(EFI_GUID *guid, const char *name)
 
rv = RS->SetVariable(var, guid, 0, 0, NULL);
free(var);
-   return rv;
+   return (rv);
+}
+
+EFI_STATUS
+efi_freebsd_delenv(const char *name)
+{
+   return (efi_delenv(, 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: r346701 - in head/stand: efi/loader fdt

2019-04-25 Thread Emmanuel Vadot
Author: manu
Date: Thu Apr 25 20:08:43 2019
New Revision: 346701
URL: https://svnweb.freebsd.org/changeset/base/346701

Log:
  loader: fdt: Add fdt_is_setup function
  
  When efi_autoload is called it will call fdt_setup_fdtp which setup the
  dtb and overlays. If a user already loaded at dtb or overlays or just
  printed the efi provided dtb, this will re-setup everything and also
  re-applying the overlays.
  Test that everything is setup before doing it again.
  
  Reviewed by:  kevans
  Differential Revision:https://reviews.freebsd.org/D20059

Modified:
  head/stand/efi/loader/autoload.c
  head/stand/fdt/fdt_loader_cmd.c
  head/stand/fdt/fdt_platform.h

Modified: head/stand/efi/loader/autoload.c
==
--- head/stand/efi/loader/autoload.cThu Apr 25 20:02:11 2019
(r346700)
+++ head/stand/efi/loader/autoload.cThu Apr 25 20:08:43 2019
(r346701)
@@ -50,7 +50,8 @@ efi_autoload(void)
 * imply that we're on a platform where FDT is a requirement.  If we
 * fix this, then the error handling here should be fixed accordingly.
 */
-   fdt_setup_fdtp();
+   if (fdt_is_setup() == 0)
+   fdt_setup_fdtp();
 #endif
return (0);
 }

Modified: head/stand/fdt/fdt_loader_cmd.c
==
--- head/stand/fdt/fdt_loader_cmd.c Thu Apr 25 20:02:11 2019
(r346700)
+++ head/stand/fdt/fdt_loader_cmd.c Thu Apr 25 20:08:43 2019
(r346701)
@@ -510,6 +510,16 @@ fdt_apply_overlays()
 }
 
 int
+fdt_is_setup(void)
+{
+
+   if (fdtp != NULL)
+   return (1);
+
+   return (0);
+}
+
+int
 fdt_setup_fdtp()
 {
struct preloaded_file *bfp;

Modified: head/stand/fdt/fdt_platform.h
==
--- head/stand/fdt/fdt_platform.h   Thu Apr 25 20:02:11 2019
(r346700)
+++ head/stand/fdt/fdt_platform.h   Thu Apr 25 20:08:43 2019
(r346701)
@@ -48,6 +48,7 @@ int fdt_load_dtb_addr(struct fdt_header *);
 int fdt_load_dtb_file(const char *);
 void fdt_load_dtb_overlays(const char *);
 int fdt_setup_fdtp(void);
+int fdt_is_setup(void);
 
 /* The platform library needs to implement these functions */
 int fdt_platform_load_dtb(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: r346700 - head/lib/libbe

2019-04-25 Thread Kyle Evans
Author: kevans
Date: Thu Apr 25 20:02:11 2019
New Revision: 346700
URL: https://svnweb.freebsd.org/changeset/base/346700

Log:
  libbe(3): Fix mis-application of patch (SHLIBDIR)
  
  Rob's patch in D18564 cemented the SHLIBDIR because bsd.own.mk (included by
  src.opts.mk) sets it to /usr/lib. r346546 did somehow not apply this part of
  the patch, leaving it to get installed to the wrong place and subsequently
  removed via ObsoleteFiles.
  
  Reported by:  jkim
  MFC after:3 days
  X-MFC-With:   r346546

Modified:
  head/lib/libbe/Makefile

Modified: head/lib/libbe/Makefile
==
--- head/lib/libbe/Makefile Thu Apr 25 18:49:29 2019(r346699)
+++ head/lib/libbe/Makefile Thu Apr 25 20:02:11 2019(r346700)
@@ -4,7 +4,7 @@
 
 PACKAGE=   lib${LIB}
 LIB=   be
-SHLIBDIR?= /lib
+SHLIBDIR=  /lib
 SHLIB_MAJOR=   1
 SHLIB_MINOR=   0
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r346386 - in head/sys: dev/bge dev/pci dev/twa x86/iommu

2019-04-25 Thread Ryan Stone
Following up, this is what will have to be re-instated in the aac driver:

http://svn.freebsd.org/changeset/base/232260

However, my biggest concern is that we have no idea how many new
devices with the broken behaviour might have been introduced since we
fixed the problem in general.  How does Linux handle the issue?

On Thu, Apr 25, 2019 at 3:17 PM Ryan Stone  wrote:
>
> This change makes me *very* uncomfortable.  It was originally brought
> in due to issues with Adaptec RAID cards using the aac(9) driver.  The
> symptoms of the bug included silent corruption of data as it was
> written to disk.  Are we sure that this change is a good idea, given
> how catastrophic it is when a device gets this wrong?
>
> On Fri, Apr 19, 2019 at 9:43 AM Tycho Nightingale  wrote:
> >
> > Author: tychon
> > Date: Fri Apr 19 13:43:33 2019
> > New Revision: 346386
> > URL: https://svnweb.freebsd.org/changeset/base/346386
> >
> > Log:
> >   remove the 4GB boundary requirement on PCI DMA segments
> >
> >   Reviewed by:  kib
> >   Discussed with:   jhb
> >   Sponsored by: Dell EMC Isilon
> >   Differential Revision:https://reviews.freebsd.org/D19867
> >
> > Modified:
> >   head/sys/dev/bge/if_bgereg.h
> >   head/sys/dev/pci/pci.c
> >   head/sys/dev/pci/pcivar.h
> >   head/sys/dev/twa/tw_osl.h
> >   head/sys/dev/twa/tw_osl_freebsd.c
> >   head/sys/x86/iommu/intel_ctx.c
> >
> > Modified: head/sys/dev/bge/if_bgereg.h
> > ==
> > --- head/sys/dev/bge/if_bgereg.hFri Apr 19 13:23:41 2019
> > (r346385)
> > +++ head/sys/dev/bge/if_bgereg.hFri Apr 19 13:43:33 2019
> > (r346386)
> > @@ -3067,3 +3067,11 @@ struct bge_softc {
> >  #defineBGE_LOCK_ASSERT(_sc)mtx_assert(&(_sc)->bge_mtx, 
> > MA_OWNED)
> >  #defineBGE_UNLOCK(_sc) mtx_unlock(&(_sc)->bge_mtx)
> >  #defineBGE_LOCK_DESTROY(_sc)   mtx_destroy(&(_sc)->bge_mtx)
> > +
> > +#ifdef BUS_SPACE_MAXADDR
> > +#if (BUS_SPACE_MAXADDR > 0x)
> > +#defineBGE_DMA_BOUNDARY(0x1)
> > +#else
> > +#defineBGE_DMA_BOUNDARY0
> > +#endif
> > +#endif
> >
> > Modified: head/sys/dev/pci/pci.c
> > ==
> > --- head/sys/dev/pci/pci.c  Fri Apr 19 13:23:41 2019(r346385)
> > +++ head/sys/dev/pci/pci.c  Fri Apr 19 13:43:33 2019(r346386)
> > @@ -4343,9 +4343,6 @@ pci_attach_common(device_t dev)
> >  {
> > struct pci_softc *sc;
> > int busno, domain;
> > -#ifdef PCI_DMA_BOUNDARY
> > -   int error, tag_valid;
> > -#endif
> >  #ifdef PCI_RES_BUS
> > int rid;
> >  #endif
> > @@ -4365,23 +4362,7 @@ pci_attach_common(device_t dev)
> > if (bootverbose)
> > device_printf(dev, "domain=%d, physical bus=%d\n",
> > domain, busno);
> > -#ifdef PCI_DMA_BOUNDARY
> > -   tag_valid = 0;
> > -   if (device_get_devclass(device_get_parent(device_get_parent(dev))) 
> > !=
> > -   devclass_find("pci")) {
> > -   error = bus_dma_tag_create(bus_get_dma_tag(dev), 1,
> > -   PCI_DMA_BOUNDARY, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR,
> > -   NULL, NULL, BUS_SPACE_MAXSIZE, BUS_SPACE_UNRESTRICTED,
> > -   BUS_SPACE_MAXSIZE, 0, NULL, NULL, >sc_dma_tag);
> > -   if (error)
> > -   device_printf(dev, "Failed to create DMA tag: %d\n",
> > -   error);
> > -   else
> > -   tag_valid = 1;
> > -   }
> > -   if (!tag_valid)
> > -#endif
> > -   sc->sc_dma_tag = bus_get_dma_tag(dev);
> > +   sc->sc_dma_tag = bus_get_dma_tag(dev);
> > return (0);
> >  }
> >
> >
> > Modified: head/sys/dev/pci/pcivar.h
> > ==
> > --- head/sys/dev/pci/pcivar.h   Fri Apr 19 13:23:41 2019(r346385)
> > +++ head/sys/dev/pci/pcivar.h   Fri Apr 19 13:43:33 2019(r346386)
> > @@ -693,14 +693,6 @@ intpcie_link_reset(device_t port, int 
> > pcie_location);
> >
> >  void   pci_print_faulted_dev(void);
> >
> > -#ifdef BUS_SPACE_MAXADDR
> > -#if (BUS_SPACE_MAXADDR > 0x)
> > -#definePCI_DMA_BOUNDARY0x1
> > -#else
> > -#definePCI_DMA_BOUNDARY0
> > -#endif
> > -#endif
> > -
> >  #endif /* _SYS_BUS_H_ */
> >
> >  /*
> >
> > Modified: head/sys/dev/twa/tw_osl.h
> > ==
> > --- head/sys/dev/twa/tw_osl.h   Fri Apr 19 13:23:41 2019(r346385)
> > +++ head/sys/dev/twa/tw_osl.h   Fri Apr 19 13:43:33 2019(r346386)
> > @@ -57,6 +57,12 @@
> >  #define TW_OSLI_MAX_NUM_IOS(TW_OSLI_MAX_NUM_REQUESTS - 2)
> >  #define TW_OSLI_MAX_NUM_AENS   0x100
> >
> > +#ifdef PAE
> > +#define

Re: svn commit: r346386 - in head/sys: dev/bge dev/pci dev/twa x86/iommu

2019-04-25 Thread Ryan Stone
This change makes me *very* uncomfortable.  It was originally brought
in due to issues with Adaptec RAID cards using the aac(9) driver.  The
symptoms of the bug included silent corruption of data as it was
written to disk.  Are we sure that this change is a good idea, given
how catastrophic it is when a device gets this wrong?

On Fri, Apr 19, 2019 at 9:43 AM Tycho Nightingale  wrote:
>
> Author: tychon
> Date: Fri Apr 19 13:43:33 2019
> New Revision: 346386
> URL: https://svnweb.freebsd.org/changeset/base/346386
>
> Log:
>   remove the 4GB boundary requirement on PCI DMA segments
>
>   Reviewed by:  kib
>   Discussed with:   jhb
>   Sponsored by: Dell EMC Isilon
>   Differential Revision:https://reviews.freebsd.org/D19867
>
> Modified:
>   head/sys/dev/bge/if_bgereg.h
>   head/sys/dev/pci/pci.c
>   head/sys/dev/pci/pcivar.h
>   head/sys/dev/twa/tw_osl.h
>   head/sys/dev/twa/tw_osl_freebsd.c
>   head/sys/x86/iommu/intel_ctx.c
>
> Modified: head/sys/dev/bge/if_bgereg.h
> ==
> --- head/sys/dev/bge/if_bgereg.hFri Apr 19 13:23:41 2019
> (r346385)
> +++ head/sys/dev/bge/if_bgereg.hFri Apr 19 13:43:33 2019
> (r346386)
> @@ -3067,3 +3067,11 @@ struct bge_softc {
>  #defineBGE_LOCK_ASSERT(_sc)mtx_assert(&(_sc)->bge_mtx, MA_OWNED)
>  #defineBGE_UNLOCK(_sc) mtx_unlock(&(_sc)->bge_mtx)
>  #defineBGE_LOCK_DESTROY(_sc)   mtx_destroy(&(_sc)->bge_mtx)
> +
> +#ifdef BUS_SPACE_MAXADDR
> +#if (BUS_SPACE_MAXADDR > 0x)
> +#defineBGE_DMA_BOUNDARY(0x1)
> +#else
> +#defineBGE_DMA_BOUNDARY0
> +#endif
> +#endif
>
> Modified: head/sys/dev/pci/pci.c
> ==
> --- head/sys/dev/pci/pci.c  Fri Apr 19 13:23:41 2019(r346385)
> +++ head/sys/dev/pci/pci.c  Fri Apr 19 13:43:33 2019(r346386)
> @@ -4343,9 +4343,6 @@ pci_attach_common(device_t dev)
>  {
> struct pci_softc *sc;
> int busno, domain;
> -#ifdef PCI_DMA_BOUNDARY
> -   int error, tag_valid;
> -#endif
>  #ifdef PCI_RES_BUS
> int rid;
>  #endif
> @@ -4365,23 +4362,7 @@ pci_attach_common(device_t dev)
> if (bootverbose)
> device_printf(dev, "domain=%d, physical bus=%d\n",
> domain, busno);
> -#ifdef PCI_DMA_BOUNDARY
> -   tag_valid = 0;
> -   if (device_get_devclass(device_get_parent(device_get_parent(dev))) !=
> -   devclass_find("pci")) {
> -   error = bus_dma_tag_create(bus_get_dma_tag(dev), 1,
> -   PCI_DMA_BOUNDARY, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR,
> -   NULL, NULL, BUS_SPACE_MAXSIZE, BUS_SPACE_UNRESTRICTED,
> -   BUS_SPACE_MAXSIZE, 0, NULL, NULL, >sc_dma_tag);
> -   if (error)
> -   device_printf(dev, "Failed to create DMA tag: %d\n",
> -   error);
> -   else
> -   tag_valid = 1;
> -   }
> -   if (!tag_valid)
> -#endif
> -   sc->sc_dma_tag = bus_get_dma_tag(dev);
> +   sc->sc_dma_tag = bus_get_dma_tag(dev);
> return (0);
>  }
>
>
> Modified: head/sys/dev/pci/pcivar.h
> ==
> --- head/sys/dev/pci/pcivar.h   Fri Apr 19 13:23:41 2019(r346385)
> +++ head/sys/dev/pci/pcivar.h   Fri Apr 19 13:43:33 2019(r346386)
> @@ -693,14 +693,6 @@ intpcie_link_reset(device_t port, int 
> pcie_location);
>
>  void   pci_print_faulted_dev(void);
>
> -#ifdef BUS_SPACE_MAXADDR
> -#if (BUS_SPACE_MAXADDR > 0x)
> -#definePCI_DMA_BOUNDARY0x1
> -#else
> -#definePCI_DMA_BOUNDARY0
> -#endif
> -#endif
> -
>  #endif /* _SYS_BUS_H_ */
>
>  /*
>
> Modified: head/sys/dev/twa/tw_osl.h
> ==
> --- head/sys/dev/twa/tw_osl.h   Fri Apr 19 13:23:41 2019(r346385)
> +++ head/sys/dev/twa/tw_osl.h   Fri Apr 19 13:43:33 2019(r346386)
> @@ -57,6 +57,12 @@
>  #define TW_OSLI_MAX_NUM_IOS(TW_OSLI_MAX_NUM_REQUESTS - 2)
>  #define TW_OSLI_MAX_NUM_AENS   0x100
>
> +#ifdef PAE
> +#defineTW_OSLI_DMA_BOUNDARY(1u << 31)
> +#else
> +#defineTW_OSLI_DMA_BOUNDARY((bus_size_t)((uint64_t)1 << 
> 32))
> +#endif
> +
>  /* Possible values of req->state. */
>  #define TW_OSLI_REQ_STATE_INIT 0x0 /* being initialized */
>  #define TW_OSLI_REQ_STATE_BUSY 0x1 /* submitted to CL */
>
> Modified: head/sys/dev/twa/tw_osl_freebsd.c
> ==
> --- head/sys/dev/twa/tw_osl_freebsd.c   Fri Apr 19 13:23:41 2019
> (r346385)
> +++ head/sys/dev/twa/tw_osl_freebsd.c   Fri Apr 19 13:43:33 2019
> 

Re: svn commit: r346687 - head/sys/compat/linuxkpi/common/src

2019-04-25 Thread Konstantin Belousov
On Thu, Apr 25, 2019 at 02:56:36PM -0400, Tycho Nightingale wrote:
> 
> 
> > On Apr 25, 2019, at 2:50 PM, John Baldwin  wrote:
> > 
> > On 4/25/19 11:43 AM, Konstantin Belousov wrote:
> >> On Thu, Apr 25, 2019 at 06:13:56PM +, Tycho Nightingale wrote:
> >>> Author: tychon
> >>> Date: Thu Apr 25 18:13:55 2019
> >>> New Revision: 346687
> >>> URL: https://svnweb.freebsd.org/changeset/base/346687
> >>> 
> >>> Log:
> >>>  LinuxKPI buildfix for ppc64 after r346645.
> >>> 
> >>>  Proposed by: hselasky
> >>>  Sponsored by:Dell EMC Isilon
> >>> 
> >>> Modified:
> >>>  head/sys/compat/linuxkpi/common/src/linux_pci.c
> >>> 
> >>> Modified: head/sys/compat/linuxkpi/common/src/linux_pci.c
> >>> ==
> >>> --- head/sys/compat/linuxkpi/common/src/linux_pci.c   Thu Apr 25 
> >>> 17:28:36 2019(r346686)
> >>> +++ head/sys/compat/linuxkpi/common/src/linux_pci.c   Thu Apr 25 
> >>> 18:13:55 2019(r346687)
> >>> @@ -137,9 +137,9 @@ linux_dma_tag_init(struct device *dev, u64 dma_mask)
> >>>   dma_mask,   /* lowaddr */
> >>>   BUS_SPACE_MAXADDR,  /* highaddr */
> >>>   NULL, NULL, /* filtfunc, filtfuncarg */
> >>> - BUS_SPACE_MAXADDR,  /* maxsize */
> >>> + BUS_SPACE_MAXSIZE,  /* maxsize */
> >>>   1,  /* nsegments */
> >>> - BUS_SPACE_MAXADDR,  /* maxsegsz */
> >>> + BUS_SPACE_MAXSIZE,  /* maxsegsz */
> >>>   0,  /* flags */
> >>>   NULL, NULL, /* lockfunc, lockfuncarg */
> >>>   >dmat);
> >> 
> >> It seems that amd64 BUS_SPACE_MAXSIZE is 4G, I do not know why.
> >> Either we should fix that, or the following fix is more appropriate.
> >> i386 and ppc both have PAE-like configs where maxaddr is 64bit but
> >> maxsize is 32bit.
> > 
> > I think we should fix amd64's maxsize.
> 
> That sounds reasonable.  Perhaps this was a conservative choice along with 
> the 4GB DMA boundary which I removed recently.
> 
> After some testing I can make this change.
Please do.
___
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: r346687 - head/sys/compat/linuxkpi/common/src

2019-04-25 Thread Tycho Nightingale



> On Apr 25, 2019, at 2:50 PM, John Baldwin  wrote:
> 
> On 4/25/19 11:43 AM, Konstantin Belousov wrote:
>> On Thu, Apr 25, 2019 at 06:13:56PM +, Tycho Nightingale wrote:
>>> Author: tychon
>>> Date: Thu Apr 25 18:13:55 2019
>>> New Revision: 346687
>>> URL: https://svnweb.freebsd.org/changeset/base/346687
>>> 
>>> Log:
>>>  LinuxKPI buildfix for ppc64 after r346645.
>>> 
>>>  Proposed by:   hselasky
>>>  Sponsored by:  Dell EMC Isilon
>>> 
>>> Modified:
>>>  head/sys/compat/linuxkpi/common/src/linux_pci.c
>>> 
>>> Modified: head/sys/compat/linuxkpi/common/src/linux_pci.c
>>> ==
>>> --- head/sys/compat/linuxkpi/common/src/linux_pci.c Thu Apr 25 17:28:36 
>>> 2019(r346686)
>>> +++ head/sys/compat/linuxkpi/common/src/linux_pci.c Thu Apr 25 18:13:55 
>>> 2019(r346687)
>>> @@ -137,9 +137,9 @@ linux_dma_tag_init(struct device *dev, u64 dma_mask)
>>> dma_mask,   /* lowaddr */
>>> BUS_SPACE_MAXADDR,  /* highaddr */
>>> NULL, NULL, /* filtfunc, filtfuncarg */
>>> -   BUS_SPACE_MAXADDR,  /* maxsize */
>>> +   BUS_SPACE_MAXSIZE,  /* maxsize */
>>> 1,  /* nsegments */
>>> -   BUS_SPACE_MAXADDR,  /* maxsegsz */
>>> +   BUS_SPACE_MAXSIZE,  /* maxsegsz */
>>> 0,  /* flags */
>>> NULL, NULL, /* lockfunc, lockfuncarg */
>>> >dmat);
>> 
>> It seems that amd64 BUS_SPACE_MAXSIZE is 4G, I do not know why.
>> Either we should fix that, or the following fix is more appropriate.
>> i386 and ppc both have PAE-like configs where maxaddr is 64bit but
>> maxsize is 32bit.
> 
> I think we should fix amd64's maxsize.

That sounds reasonable.  Perhaps this was a conservative choice along with the 
4GB DMA boundary which I removed recently.

After some testing I can make this change.

Tycho
___
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: r346687 - head/sys/compat/linuxkpi/common/src

2019-04-25 Thread John Baldwin
On 4/25/19 11:43 AM, Konstantin Belousov wrote:
> On Thu, Apr 25, 2019 at 06:13:56PM +, Tycho Nightingale wrote:
>> Author: tychon
>> Date: Thu Apr 25 18:13:55 2019
>> New Revision: 346687
>> URL: https://svnweb.freebsd.org/changeset/base/346687
>>
>> Log:
>>   LinuxKPI buildfix for ppc64 after r346645.
>>   
>>   Proposed by:   hselasky
>>   Sponsored by:  Dell EMC Isilon
>>
>> Modified:
>>   head/sys/compat/linuxkpi/common/src/linux_pci.c
>>
>> Modified: head/sys/compat/linuxkpi/common/src/linux_pci.c
>> ==
>> --- head/sys/compat/linuxkpi/common/src/linux_pci.c  Thu Apr 25 17:28:36 
>> 2019(r346686)
>> +++ head/sys/compat/linuxkpi/common/src/linux_pci.c  Thu Apr 25 18:13:55 
>> 2019(r346687)
>> @@ -137,9 +137,9 @@ linux_dma_tag_init(struct device *dev, u64 dma_mask)
>>  dma_mask,   /* lowaddr */
>>  BUS_SPACE_MAXADDR,  /* highaddr */
>>  NULL, NULL, /* filtfunc, filtfuncarg */
>> -BUS_SPACE_MAXADDR,  /* maxsize */
>> +BUS_SPACE_MAXSIZE,  /* maxsize */
>>  1,  /* nsegments */
>> -BUS_SPACE_MAXADDR,  /* maxsegsz */
>> +BUS_SPACE_MAXSIZE,  /* maxsegsz */
>>  0,  /* flags */
>>  NULL, NULL, /* lockfunc, lockfuncarg */
>>  >dmat);
> 
> It seems that amd64 BUS_SPACE_MAXSIZE is 4G, I do not know why.
> Either we should fix that, or the following fix is more appropriate.
> i386 and ppc both have PAE-like configs where maxaddr is 64bit but
> maxsize is 32bit.

I think we should fix amd64's maxsize.

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


svn commit: r346699 - stable/11/sys/cddl/compat/opensolaris/kern

2019-04-25 Thread Alexander Motin
Author: mav
Date: Thu Apr 25 18:49:29 2019
New Revision: 346699
URL: https://svnweb.freebsd.org/changeset/base/346699

Log:
  MFC r340731 (by markj): Use taskqueue_quiesce(9) to implement taskq_wait().

Modified:
  stable/11/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c
==
--- stable/11/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c  Thu Apr 
25 18:44:03 2019(r346698)
+++ stable/11/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c  Thu Apr 
25 18:49:29 2019(r346699)
@@ -171,11 +171,11 @@ taskq_dispatch_ent(taskq_t *tq, task_func_t func, void
 void
 taskq_wait(taskq_t *tq)
 {
-   taskqueue_drain_all(tq->tq_queue);
+   taskqueue_quiesce(tq->tq_queue);
 }
 
 void
 taskq_wait_id(taskq_t *tq, taskqid_t id)
 {
-taskq_wait(tq);
+   taskqueue_drain_all(tq->tq_queue);
 }
___
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: r346683 - head/usr.sbin/bsdinstall/scripts

2019-04-25 Thread Emmanuel Vadot
On Thu, 25 Apr 2019 11:22:34 -0700
Enji Cooper  wrote:

> 
> > On Apr 25, 2019, at 09:47, Emmanuel Vadot  wrote:
> > 
> > Author: manu
> > Date: Thu Apr 25 16:47:15 2019
> > New Revision: 346683
> > URL: https://svnweb.freebsd.org/changeset/base/346683
> > 
> > Log:
> >  bsdinstall: up the interface before calling dhclient
> 
> Hi Emmanuel!
> Just curious.. What issue did you see when the interface wasn?t UPed?
> Thank you!
> -Enji

 Hi Enji,

 dhclient cannot get the lease (obviously), and so the installer
doesn't store the dhcp configuration in rc.conf
 I don't know if it's related to the device (ix(4) in that case) but
since netconfig_ipv6 also ifconfig up when setting radv we might want
to do the same for ipv4.

 Cheers,

-- 
Emmanuel Vadot  
___
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: r346688 - head/sys/net

2019-04-25 Thread Rodney W. Grimes
> On Thu, Apr 25, 2019 at 1:24 PM Rodney W. Grimes
>  wrote:
> >
> > [ Charset UTF-8 unsupported, converting... ]
> > > Author: kevans
> > > Date: Thu Apr 25 18:22:22 2019
> > > New Revision: 346688
> > > URL: https://svnweb.freebsd.org/changeset/base/346688
> > >
> > > Log:
> > >   tap(4): Add a MODULE_VERSION
> > ^^^
> > >
> > >   Otherwise tap(4) can be loaded by loader despite being compiled into the
> > >   kernel, causing a panic as things try to double-initialize.
> > >
> > >   PR: 220867
> > >   MFC after:  3 days
> > >
> > > Modified:
> > >   head/sys/net/if_tap.c
> > ^^^
> > >
> > > Modified: head/sys/net/if_tap.c
> > > ==
> > > --- head/sys/net/if_tap.c Thu Apr 25 18:13:55 2019(r346687)
> > > +++ head/sys/net/if_tap.c Thu Apr 25 18:22:22 2019(r346688)
> > > @@ -180,6 +180,7 @@ SYSCTL_INT(_net_link_tap, OID_AUTO, devfs_cloning, CTL
> > >  SYSCTL_INT(_net_link_tap, OID_AUTO, debug, CTLFLAG_RW, , 0, "");
> > >
> > >  DEV_MODULE(if_tap, tapmodevent, NULL);
> >  ^^^
> > > +MODULE_VERSION(if_tun, 1);
> >  ^^^
> > If wrong, ok, please fix, if correct, please this needs a very
> > complete comment as to what it is if_tun.
> >
> 
> *sigh*
> 
> I had one job to do, and I goofed it. Thanks for pointing that out...

Well it is 25/27 correct :-)

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


svn commit: r346698 - in head/sys/modules/allwinner: . aw_pwm

2019-04-25 Thread Emmanuel Vadot
Author: manu
Date: Thu Apr 25 18:44:03 2019
New Revision: 346698
URL: https://svnweb.freebsd.org/changeset/base/346698

Log:
  arm: allwinner: aw_pwm: compile it as module too
  
  MFC after:1 month

Added:
  head/sys/modules/allwinner/aw_pwm/
  head/sys/modules/allwinner/aw_pwm/Makefile   (contents, props changed)
Modified:
  head/sys/modules/allwinner/Makefile

Modified: head/sys/modules/allwinner/Makefile
==
--- head/sys/modules/allwinner/Makefile Thu Apr 25 18:43:01 2019
(r346697)
+++ head/sys/modules/allwinner/Makefile Thu Apr 25 18:44:03 2019
(r346698)
@@ -2,6 +2,7 @@
 # Build modules specific to Allwinner.
 
 SUBDIR = \
+   aw_pwm \
aw_rtc \
aw_rsb \
aw_sid \

Added: head/sys/modules/allwinner/aw_pwm/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/modules/allwinner/aw_pwm/Makefile  Thu Apr 25 18:44:03 2019
(r346698)
@@ -0,0 +1,15 @@
+# $FreeBSD$
+
+.PATH: ${SRCTOP}/sys/arm/allwinner
+
+KMOD=  aw_pwm
+SRCS=  aw_pwm.c
+
+SRCS+= \
+   bus_if.h \
+   clknode_if.h \
+   device_if.h \
+   ofw_bus_if.h \
+   pwm_if.h
+
+.include 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r346697 - in head/sys: arm/allwinner modules/allwinner modules/allwinner/aw_rsb

2019-04-25 Thread Emmanuel Vadot
Author: manu
Date: Thu Apr 25 18:43:01 2019
New Revision: 346697
URL: https://svnweb.freebsd.org/changeset/base/346697

Log:
  arm: allwinner: Add pnp info to aw_rsb and compile it as module too
  
  MFC after:1 month

Added:
  head/sys/modules/allwinner/aw_rsb/
  head/sys/modules/allwinner/aw_rsb/Makefile   (contents, props changed)
Modified:
  head/sys/arm/allwinner/aw_rsb.c
  head/sys/modules/allwinner/Makefile

Modified: head/sys/arm/allwinner/aw_rsb.c
==
--- head/sys/arm/allwinner/aw_rsb.c Thu Apr 25 18:42:27 2019
(r346696)
+++ head/sys/arm/allwinner/aw_rsb.c Thu Apr 25 18:43:01 2019
(r346697)
@@ -496,3 +496,5 @@ EARLY_DRIVER_MODULE(iicbus, rsb, iicbus_driver, iicbus
 EARLY_DRIVER_MODULE(rsb, simplebus, rsb_driver, rsb_devclass, 0, 0,
 BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE);
 MODULE_VERSION(rsb, 1);
+MODULE_DEPEND(rsb, iicbus, 1, 1, 1);
+SIMPLEBUS_PNP_INFO(compat_data);

Modified: head/sys/modules/allwinner/Makefile
==
--- head/sys/modules/allwinner/Makefile Thu Apr 25 18:42:27 2019
(r346696)
+++ head/sys/modules/allwinner/Makefile Thu Apr 25 18:43:01 2019
(r346697)
@@ -3,6 +3,7 @@
 
 SUBDIR = \
aw_rtc \
+   aw_rsb \
aw_sid \
aw_spi \
aw_thermal \

Added: head/sys/modules/allwinner/aw_rsb/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/modules/allwinner/aw_rsb/Makefile  Thu Apr 25 18:43:01 2019
(r346697)
@@ -0,0 +1,15 @@
+# $FreeBSD$
+
+.PATH: ${SRCTOP}/sys/arm/allwinner
+
+KMOD=  aw_rsb
+SRCS=  aw_rsb.c
+
+SRCS+= \
+   bus_if.h \
+   clknode_if.h \
+   device_if.h \
+   ofw_bus_if.h \
+   iicbus_if.h
+
+.include 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r346687 - head/sys/compat/linuxkpi/common/src

2019-04-25 Thread Konstantin Belousov
On Thu, Apr 25, 2019 at 06:13:56PM +, Tycho Nightingale wrote:
> Author: tychon
> Date: Thu Apr 25 18:13:55 2019
> New Revision: 346687
> URL: https://svnweb.freebsd.org/changeset/base/346687
> 
> Log:
>   LinuxKPI buildfix for ppc64 after r346645.
>   
>   Proposed by:hselasky
>   Sponsored by:   Dell EMC Isilon
> 
> Modified:
>   head/sys/compat/linuxkpi/common/src/linux_pci.c
> 
> Modified: head/sys/compat/linuxkpi/common/src/linux_pci.c
> ==
> --- head/sys/compat/linuxkpi/common/src/linux_pci.c   Thu Apr 25 17:28:36 
> 2019(r346686)
> +++ head/sys/compat/linuxkpi/common/src/linux_pci.c   Thu Apr 25 18:13:55 
> 2019(r346687)
> @@ -137,9 +137,9 @@ linux_dma_tag_init(struct device *dev, u64 dma_mask)
>   dma_mask,   /* lowaddr */
>   BUS_SPACE_MAXADDR,  /* highaddr */
>   NULL, NULL, /* filtfunc, filtfuncarg */
> - BUS_SPACE_MAXADDR,  /* maxsize */
> + BUS_SPACE_MAXSIZE,  /* maxsize */
>   1,  /* nsegments */
> - BUS_SPACE_MAXADDR,  /* maxsegsz */
> + BUS_SPACE_MAXSIZE,  /* maxsegsz */
>   0,  /* flags */
>   NULL, NULL, /* lockfunc, lockfuncarg */
>   >dmat);

It seems that amd64 BUS_SPACE_MAXSIZE is 4G, I do not know why.
Either we should fix that, or the following fix is more appropriate.
i386 and ppc both have PAE-like configs where maxaddr is 64bit but
maxsize is 32bit.

diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c 
b/sys/compat/linuxkpi/common/src/linux_pci.c
index 4e93827e2e9..ed0d5575b05 100644
--- a/sys/compat/linuxkpi/common/src/linux_pci.c
+++ b/sys/compat/linuxkpi/common/src/linux_pci.c
@@ -137,9 +137,17 @@ linux_dma_tag_init(struct device *dev, u64 dma_mask)
dma_mask,   /* lowaddr */
BUS_SPACE_MAXADDR,  /* highaddr */
NULL, NULL, /* filtfunc, filtfuncarg */
+#if defined(__i386__) || defined(__powerpc__)
+   BUS_SPACE_MAXSIZE,
+#else
BUS_SPACE_MAXADDR,  /* maxsize */
+#endif
1,  /* nsegments */
+#if defined(__i386__) || defined(__powerpc__)
+   BUS_SPACE_MAXSIZE,
+#else
BUS_SPACE_MAXADDR,  /* maxsegsz */
+#endif
0,  /* flags */
NULL, NULL, /* lockfunc, lockfuncarg */
>dmat);


___
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: r346696 - in head/sys: arm/allwinner modules/allwinner modules/allwinner/if_awg

2019-04-25 Thread Emmanuel Vadot
Author: manu
Date: Thu Apr 25 18:42:27 2019
New Revision: 346696
URL: https://svnweb.freebsd.org/changeset/base/346696

Log:
  arm: allwinner: Add pnp info to if_awg and compile it as module too
  
  While here make it depend on aw_sid as it's needed for mac generation.
  
  MFC after:1 month

Added:
  head/sys/modules/allwinner/if_awg/
  head/sys/modules/allwinner/if_awg/Makefile   (contents, props changed)
Modified:
  head/sys/arm/allwinner/if_awg.c
  head/sys/modules/allwinner/Makefile

Modified: head/sys/arm/allwinner/if_awg.c
==
--- head/sys/arm/allwinner/if_awg.c Thu Apr 25 18:42:07 2019
(r346695)
+++ head/sys/arm/allwinner/if_awg.c Thu Apr 25 18:42:27 2019
(r346696)
@@ -1967,6 +1967,7 @@ static devclass_t awg_devclass;
 
 DRIVER_MODULE(awg, simplebus, awg_driver, awg_devclass, 0, 0);
 DRIVER_MODULE(miibus, awg, miibus_driver, miibus_devclass, 0, 0);
-
 MODULE_DEPEND(awg, ether, 1, 1, 1);
 MODULE_DEPEND(awg, miibus, 1, 1, 1);
+MODULE_DEPEND(awg, aw_sid, 1, 1, 1);
+SIMPLEBUS_PNP_INFO(compat_data);

Modified: head/sys/modules/allwinner/Makefile
==
--- head/sys/modules/allwinner/Makefile Thu Apr 25 18:42:07 2019
(r346695)
+++ head/sys/modules/allwinner/Makefile Thu Apr 25 18:42:27 2019
(r346696)
@@ -6,6 +6,7 @@ SUBDIR = \
aw_sid \
aw_spi \
aw_thermal \
-   axp81x
+   axp81x \
+   if_awg
 
 .include 

Added: head/sys/modules/allwinner/if_awg/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/modules/allwinner/if_awg/Makefile  Thu Apr 25 18:42:27 2019
(r346696)
@@ -0,0 +1,14 @@
+# $FreeBSD$
+
+.PATH: ${SRCTOP}/sys/arm/allwinner
+
+KMOD=  if_awg
+SRCS=  if_awg.c
+
+SRCS+= \
+   bus_if.h \
+   clknode_if.h \
+   device_if.h \
+   ofw_bus_if.h \
+
+.include 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r346694 - in head/sys: arm/allwinner modules/allwinner modules/allwinner/aw_rtc

2019-04-25 Thread Emmanuel Vadot
Author: manu
Date: Thu Apr 25 18:41:05 2019
New Revision: 346694
URL: https://svnweb.freebsd.org/changeset/base/346694

Log:
  arm: allwinner: Add pnp info to aw_rtc and compile it as module too
  
  MFC after:1 month

Added:
  head/sys/modules/allwinner/aw_rtc/
  head/sys/modules/allwinner/aw_rtc/Makefile   (contents, props changed)
Modified:
  head/sys/arm/allwinner/aw_rtc.c
  head/sys/modules/allwinner/Makefile

Modified: head/sys/arm/allwinner/aw_rtc.c
==
--- head/sys/arm/allwinner/aw_rtc.c Thu Apr 25 18:40:23 2019
(r346693)
+++ head/sys/arm/allwinner/aw_rtc.c Thu Apr 25 18:41:05 2019
(r346694)
@@ -185,6 +185,8 @@ static devclass_t aw_rtc_devclass;
 
 EARLY_DRIVER_MODULE(aw_rtc, simplebus, aw_rtc_driver, aw_rtc_devclass, 0, 0,
 BUS_PASS_BUS + BUS_PASS_ORDER_MIDDLE);
+MODULE_VERSION(aw_rtc, 1);
+SIMPLEBUS_PNP_INFO(compat_data);
 
 static int
 aw_rtc_probe(device_t dev)

Modified: head/sys/modules/allwinner/Makefile
==
--- head/sys/modules/allwinner/Makefile Thu Apr 25 18:40:23 2019
(r346693)
+++ head/sys/modules/allwinner/Makefile Thu Apr 25 18:41:05 2019
(r346694)
@@ -2,6 +2,7 @@
 # Build modules specific to Allwinner.
 
 SUBDIR = \
+   aw_rtc \
aw_sid \
aw_spi \
aw_thermal \

Added: head/sys/modules/allwinner/aw_rtc/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/modules/allwinner/aw_rtc/Makefile  Thu Apr 25 18:41:05 2019
(r346694)
@@ -0,0 +1,15 @@
+# $FreeBSD$
+
+.PATH: ${SRCTOP}/sys/arm/allwinner
+
+KMOD=  aw_rtc
+SRCS=  aw_rtc.c
+
+SRCS+= \
+   bus_if.h \
+   clknode_if.h \
+   device_if.h \
+   ofw_bus_if.h \
+   spibus_if.h \
+
+.include 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r346693 - in head/sys: arm/allwinner modules/allwinner modules/allwinner/axp81x

2019-04-25 Thread Emmanuel Vadot
Author: manu
Date: Thu Apr 25 18:40:23 2019
New Revision: 346693
URL: https://svnweb.freebsd.org/changeset/base/346693

Log:
  arm: allwinner: Add pnp info to axp81x and compile it as module too
  
  MFC after:1 month

Added:
  head/sys/modules/allwinner/axp81x/
  head/sys/modules/allwinner/axp81x/Makefile   (contents, props changed)
Modified:
  head/sys/arm/allwinner/axp81x.c
  head/sys/modules/allwinner/Makefile

Modified: head/sys/arm/allwinner/axp81x.c
==
--- head/sys/arm/allwinner/axp81x.c Thu Apr 25 18:39:41 2019
(r346692)
+++ head/sys/arm/allwinner/axp81x.c Thu Apr 25 18:40:23 2019
(r346693)
@@ -1619,3 +1619,4 @@ EARLY_DRIVER_MODULE(ofw_gpiobus, axp8xx_pmu, ofw_gpiob
 DRIVER_MODULE(gpioc, axp8xx_pmu, gpioc_driver, gpioc_devclass, 0, 0);
 MODULE_VERSION(axp8xx, 1);
 MODULE_DEPEND(axp8xx, iicbus, 1, 1, 1);
+SIMPLEBUS_PNP_INFO(compat_data);

Modified: head/sys/modules/allwinner/Makefile
==
--- head/sys/modules/allwinner/Makefile Thu Apr 25 18:39:41 2019
(r346692)
+++ head/sys/modules/allwinner/Makefile Thu Apr 25 18:40:23 2019
(r346693)
@@ -4,6 +4,7 @@
 SUBDIR = \
aw_sid \
aw_spi \
-   aw_thermal
+   aw_thermal \
+   axp81x
 
 .include 

Added: head/sys/modules/allwinner/axp81x/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/modules/allwinner/axp81x/Makefile  Thu Apr 25 18:40:23 2019
(r346693)
@@ -0,0 +1,15 @@
+# $FreeBSD$
+
+.PATH: ${SRCTOP}/sys/arm/allwinner
+
+KMOD=  axp81x
+SRCS=  axp81x.c
+
+SRCS+= \
+   bus_if.h \
+   clknode_if.h \
+   device_if.h \
+   ofw_bus_if.h \
+   iicbus_if.h
+
+.include 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r346695 - in head/sys: kern sys

2019-04-25 Thread John Baldwin
Author: jhb
Date: Thu Apr 25 18:42:07 2019
New Revision: 346695
URL: https://svnweb.freebsd.org/changeset/base/346695

Log:
  Remove p_code from struct proc.
  
  Contrary to the comments, it was never used by core dumps or
  debuggers.  Instead, it used to hold the signal code of a pending
  signal, but that was replaced by the 'ksi_code' member of ksiginfo_t
  when signal information was reworked in 7.0.
  
  Reviewed by:  kib
  Differential Revision:https://reviews.freebsd.org/D20047

Modified:
  head/sys/kern/kern_sig.c
  head/sys/kern/kern_thread.c
  head/sys/sys/proc.h

Modified: head/sys/kern/kern_sig.c
==
--- head/sys/kern/kern_sig.cThu Apr 25 18:41:05 2019(r346694)
+++ head/sys/kern/kern_sig.cThu Apr 25 18:42:07 2019(r346695)
@@ -1996,7 +1996,6 @@ trapsignal(struct thread *td, ksiginfo_t *ksi)
ps->ps_sigact[_SIG_IDX(sig)] = SIG_DFL;
}
mtx_unlock(>ps_mtx);
-   p->p_code = code;   /* XXX for core dump/debugger */
p->p_sig = sig; /* XXX to verify code */
tdsendsignal(p, td, sig, ksi);
}
@@ -3062,7 +3061,6 @@ postsig(int sig)
returnmask = td->td_sigmask;
 
if (p->p_sig == sig) {
-   p->p_code = 0;
p->p_sig = 0;
}
(*p->p_sysent->sv_sendsig)(action, , );

Modified: head/sys/kern/kern_thread.c
==
--- head/sys/kern/kern_thread.c Thu Apr 25 18:41:05 2019(r346694)
+++ head/sys/kern/kern_thread.c Thu Apr 25 18:42:07 2019(r346695)
@@ -90,11 +90,11 @@ _Static_assert(offsetof(struct proc, p_flag) == 0xb0,
 "struct proc KBI p_flag");
 _Static_assert(offsetof(struct proc, p_pid) == 0xbc,
 "struct proc KBI p_pid");
-_Static_assert(offsetof(struct proc, p_filemon) == 0x3d0,
+_Static_assert(offsetof(struct proc, p_filemon) == 0x3c8,
 "struct proc KBI p_filemon");
-_Static_assert(offsetof(struct proc, p_comm) == 0x3e8,
+_Static_assert(offsetof(struct proc, p_comm) == 0x3e0,
 "struct proc KBI p_comm");
-_Static_assert(offsetof(struct proc, p_emuldata) == 0x4c8,
+_Static_assert(offsetof(struct proc, p_emuldata) == 0x4c0,
 "struct proc KBI p_emuldata");
 #endif
 #ifdef __i386__
@@ -110,11 +110,11 @@ _Static_assert(offsetof(struct proc, p_flag) == 0x68,
 "struct proc KBI p_flag");
 _Static_assert(offsetof(struct proc, p_pid) == 0x74,
 "struct proc KBI p_pid");
-_Static_assert(offsetof(struct proc, p_filemon) == 0x27c,
+_Static_assert(offsetof(struct proc, p_filemon) == 0x278,
 "struct proc KBI p_filemon");
-_Static_assert(offsetof(struct proc, p_comm) == 0x290,
+_Static_assert(offsetof(struct proc, p_comm) == 0x28c,
 "struct proc KBI p_comm");
-_Static_assert(offsetof(struct proc, p_emuldata) == 0x31c,
+_Static_assert(offsetof(struct proc, p_emuldata) == 0x318,
 "struct proc KBI p_emuldata");
 #endif
 

Modified: head/sys/sys/proc.h
==
--- head/sys/sys/proc.h Thu Apr 25 18:41:05 2019(r346694)
+++ head/sys/sys/proc.h Thu Apr 25 18:42:07 2019(r346695)
@@ -617,7 +617,6 @@ struct proc {
struct sigiolst p_sigiolst; /* (c) List of sigio sources. */
int p_sigparent;/* (c) Signal to parent on exit. */
int p_sig;  /* (n) For core dump/debugger XXX. */
-   u_long  p_code; /* (n) For core dump/debugger XXX. */
u_int   p_stops;/* (c) Stop event bitmask. */
u_int   p_stype;/* (c) Stop event type. */
charp_step; /* (c) Process is stopped. */
___
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: r346692 - in head/sys: arm/allwinner modules/allwinner modules/allwinner/aw_thermal

2019-04-25 Thread Emmanuel Vadot
Author: manu
Date: Thu Apr 25 18:39:41 2019
New Revision: 346692
URL: https://svnweb.freebsd.org/changeset/base/346692

Log:
  arm: allwinner: Add pnp info to aw_thermal and compile it as module too
  
  MFC after:1 month

Added:
  head/sys/modules/allwinner/aw_thermal/
  head/sys/modules/allwinner/aw_thermal/Makefile   (contents, props changed)
Modified:
  head/sys/arm/allwinner/aw_thermal.c
  head/sys/modules/allwinner/Makefile

Modified: head/sys/arm/allwinner/aw_thermal.c
==
--- head/sys/arm/allwinner/aw_thermal.c Thu Apr 25 18:38:38 2019
(r346691)
+++ head/sys/arm/allwinner/aw_thermal.c Thu Apr 25 18:39:41 2019
(r346692)
@@ -728,3 +728,5 @@ static devclass_t aw_thermal_devclass;
 DRIVER_MODULE(aw_thermal, simplebus, aw_thermal_driver, aw_thermal_devclass,
 0, 0);
 MODULE_VERSION(aw_thermal, 1);
+MODULE_DEPEND(aw_thermal, aw_sid, 1, 1, 1);
+SIMPLEBUS_PNP_INFO(compat_data);

Modified: head/sys/modules/allwinner/Makefile
==
--- head/sys/modules/allwinner/Makefile Thu Apr 25 18:38:38 2019
(r346691)
+++ head/sys/modules/allwinner/Makefile Thu Apr 25 18:39:41 2019
(r346692)
@@ -4,5 +4,6 @@
 SUBDIR = \
aw_sid \
aw_spi \
+   aw_thermal
 
 .include 

Added: head/sys/modules/allwinner/aw_thermal/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/modules/allwinner/aw_thermal/Makefile  Thu Apr 25 18:39:41 
2019(r346692)
@@ -0,0 +1,14 @@
+# $FreeBSD$
+
+.PATH: ${SRCTOP}/sys/arm/allwinner
+
+KMOD=  aw_thermal
+SRCS=  aw_thermal.c
+
+SRCS+= \
+   bus_if.h \
+   clknode_if.h \
+   device_if.h \
+   ofw_bus_if.h \
+
+.include 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r346691 - in head/sys: arm/allwinner modules/allwinner modules/allwinner/aw_sid

2019-04-25 Thread Emmanuel Vadot
Author: manu
Date: Thu Apr 25 18:38:38 2019
New Revision: 346691
URL: https://svnweb.freebsd.org/changeset/base/346691

Log:
  arm: allwinner: Add pnpinfo for aw_sid and add module Makefile
  
  MFC after:1 month

Added:
  head/sys/modules/allwinner/aw_sid/
  head/sys/modules/allwinner/aw_sid/Makefile   (contents, props changed)
Modified:
  head/sys/arm/allwinner/aw_sid.c
  head/sys/modules/allwinner/Makefile

Modified: head/sys/arm/allwinner/aw_sid.c
==
--- head/sys/arm/allwinner/aw_sid.c Thu Apr 25 18:30:47 2019
(r346690)
+++ head/sys/arm/allwinner/aw_sid.c Thu Apr 25 18:38:38 2019
(r346691)
@@ -414,3 +414,4 @@ static devclass_t aw_sid_devclass;
 EARLY_DRIVER_MODULE(aw_sid, simplebus, aw_sid_driver, aw_sid_devclass, 0, 0,
 BUS_PASS_RESOURCE + BUS_PASS_ORDER_FIRST);
 MODULE_VERSION(aw_sid, 1);
+SIMPLEBUS_PNP_INFO(compat_data);

Modified: head/sys/modules/allwinner/Makefile
==
--- head/sys/modules/allwinner/Makefile Thu Apr 25 18:30:47 2019
(r346690)
+++ head/sys/modules/allwinner/Makefile Thu Apr 25 18:38:38 2019
(r346691)
@@ -2,6 +2,7 @@
 # Build modules specific to Allwinner.
 
 SUBDIR = \
+   aw_sid \
aw_spi \
 
 .include 

Added: head/sys/modules/allwinner/aw_sid/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/modules/allwinner/aw_sid/Makefile  Thu Apr 25 18:38:38 2019
(r346691)
@@ -0,0 +1,14 @@
+# $FreeBSD$
+
+.PATH: ${SRCTOP}/sys/arm/allwinner
+
+KMOD=  aw_sid
+SRCS=  aw_sid.c
+
+SRCS+= \
+   bus_if.h \
+   clknode_if.h \
+   device_if.h \
+   ofw_bus_if.h \
+
+.include 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r346690 - in stable/11/cddl/contrib/opensolaris: cmd/zfs lib/libzfs/common

2019-04-25 Thread Alexander Motin
Author: mav
Date: Thu Apr 25 18:30:47 2019
New Revision: 346690
URL: https://svnweb.freebsd.org/changeset/base/346690

Log:
  MFC r344569, r344618, r344621 (by bapt):
  
  r344569:
  Implement parallel mounting for ZFS filesystem
  
  It was first implemented on Illumos and then ported to ZoL.
  This patch is a port to FreeBSD of the ZoL version.
  This patch also includes a fix for a race condition that was amended
  
  With such patch Delphix has seen a huge decrease in latency of the mount phase
  (https://github.com/openzfs/openzfs/commit/a3f0e2b569 for details).
  With that current change Gandi has measured improvments that are on par with
  those reported by Delphix.
  
  Zol commits incorporated:
  
https://github.com/zfsonlinux/zfs/commit/a10d50f999511d304f910852c7825c70c9c9e303
  
https://github.com/zfsonlinux/zfs/commit/e63ac16d25fbe991a356489c86d4077567dfea21
  
  Reviewed by: avg, sef
  Approved by: avg, sef
  Obtained from: ZoL
  Relnotes: yes
  Sponsored by: Gandi.net
  Differential Revision: https://reviews.freebsd.org/D19098
  
  r344618:
  Fix regression introduced in r344569
  
  Reported by: cy
  Tested by: cy
  Submitted by: Fatih Acar 
  
  r344621:
  Fix a regression introduced in r344569
  
  Import a fix from illumos (thanks Toomas Soomas for pointing at it)
  
  See https://www.illumos.org/issues/10205 for more details
  Illumos commit: 
https://github.com/illumos/illumos-gate/commit/247b7da039fd88350c50e3d7fef15bdab6bef215
  
  Submitted by: j...@gandi.net
  Reported by: cy
  Reviewed by: tsoome, cy, bapt
  Obtained from: Illumos

Modified:
  stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
  stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
  stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
  stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h
  stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
==
--- stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c   Thu Apr 25 
18:26:34 2019(r346689)
+++ stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c   Thu Apr 25 
18:30:47 2019(r346690)
@@ -5816,8 +5816,13 @@ zfs_do_holds(int argc, char **argv)
 
 #defineCHECK_SPINNER 30
 #defineSPINNER_TIME 3  /* seconds */
-#defineMOUNT_TIME 5/* seconds */
+#defineMOUNT_TIME 1/* seconds */
 
+typedef struct get_all_state {
+   boolean_t   ga_verbose;
+   get_all_cb_t*ga_cbp;
+} get_all_state_t;
+
 static int
 get_one_dataset(zfs_handle_t *zhp, void *data)
 {
@@ -5825,10 +5830,10 @@ get_one_dataset(zfs_handle_t *zhp, void *data)
static int spinval = 0;
static int spincheck = 0;
static time_t last_spin_time = (time_t)0;
-   get_all_cb_t *cbp = data;
+   get_all_state_t *state = data;
zfs_type_t type = zfs_get_type(zhp);
 
-   if (cbp->cb_verbose) {
+   if (state->ga_verbose) {
if (--spincheck < 0) {
time_t now = time(NULL);
if (last_spin_time + SPINNER_TIME < now) {
@@ -5854,26 +5859,24 @@ get_one_dataset(zfs_handle_t *zhp, void *data)
zfs_close(zhp);
return (0);
}
-   libzfs_add_handle(cbp, zhp);
-   assert(cbp->cb_used <= cbp->cb_alloc);
+   libzfs_add_handle(state->ga_cbp, zhp);
+   assert(state->ga_cbp->cb_used <= state->ga_cbp->cb_alloc);
 
return (0);
 }
 
 static void
-get_all_datasets(zfs_handle_t ***dslist, size_t *count, boolean_t verbose)
+get_all_datasets(get_all_cb_t *cbp, boolean_t verbose)
 {
-   get_all_cb_t cb = { 0 };
-   cb.cb_verbose = verbose;
-   cb.cb_getone = get_one_dataset;
+   get_all_state_t state = {
+   .ga_verbose = verbose,
+   .ga_cbp = cbp
+   };
 
if (verbose)
set_progress_header(gettext("Reading ZFS config"));
-   (void) zfs_iter_root(g_zfs, get_one_dataset, );
+   (void) zfs_iter_root(g_zfs, get_one_dataset, );
 
-   *dslist = cb.cb_handles;
-   *count = cb.cb_used;
-
if (verbose)
finish_progress(gettext("done."));
 }
@@ -5883,9 +5886,20 @@ get_all_datasets(zfs_handle_t ***dslist, size_t *count
  * similar, we have a common function with an extra parameter to determine 
which
  * mode we are using.
  */
-#defineOP_SHARE0x1
-#defineOP_MOUNT0x2
+typedef enum { OP_SHARE, OP_MOUNT } share_mount_op_t;
 
+typedef struct share_mount_state {
+   share_mount_op_tsm_op;
+   boolean_t   sm_verbose;
+   int sm_flags;
+   char*sm_options;
+   char*sm_proto; /* only valid for OP_SHARE */
+   pthread_mutex_t sm_lock; /* protects the remaining fields */
+ 

Re: svn commit: r346688 - head/sys/net

2019-04-25 Thread Kyle Evans
On Thu, Apr 25, 2019 at 1:24 PM Rodney W. Grimes
 wrote:
>
> [ Charset UTF-8 unsupported, converting... ]
> > Author: kevans
> > Date: Thu Apr 25 18:22:22 2019
> > New Revision: 346688
> > URL: https://svnweb.freebsd.org/changeset/base/346688
> >
> > Log:
> >   tap(4): Add a MODULE_VERSION
> ^^^
> >
> >   Otherwise tap(4) can be loaded by loader despite being compiled into the
> >   kernel, causing a panic as things try to double-initialize.
> >
> >   PR: 220867
> >   MFC after:  3 days
> >
> > Modified:
> >   head/sys/net/if_tap.c
> ^^^
> >
> > Modified: head/sys/net/if_tap.c
> > ==
> > --- head/sys/net/if_tap.c Thu Apr 25 18:13:55 2019(r346687)
> > +++ head/sys/net/if_tap.c Thu Apr 25 18:22:22 2019(r346688)
> > @@ -180,6 +180,7 @@ SYSCTL_INT(_net_link_tap, OID_AUTO, devfs_cloning, CTL
> >  SYSCTL_INT(_net_link_tap, OID_AUTO, debug, CTLFLAG_RW, , 0, "");
> >
> >  DEV_MODULE(if_tap, tapmodevent, NULL);
>  ^^^
> > +MODULE_VERSION(if_tun, 1);
>  ^^^
> If wrong, ok, please fix, if correct, please this needs a very
> complete comment as to what it is if_tun.
>

*sigh*

I had one job to do, and I goofed it. Thanks for pointing that out...

Kyle Evans
___
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: r346689 - head/sys/net

2019-04-25 Thread Kyle Evans
Author: kevans
Date: Thu Apr 25 18:26:34 2019
New Revision: 346689
URL: https://svnweb.freebsd.org/changeset/base/346689

Log:
  tap(4): Correct driver name...
  
  Reported by:  rgrimes
  Pointy hat to:kevans
  MFC after:3 days
  X-MFC-With:   r346688

Modified:
  head/sys/net/if_tap.c

Modified: head/sys/net/if_tap.c
==
--- head/sys/net/if_tap.c   Thu Apr 25 18:22:22 2019(r346688)
+++ head/sys/net/if_tap.c   Thu Apr 25 18:26:34 2019(r346689)
@@ -180,7 +180,7 @@ SYSCTL_INT(_net_link_tap, OID_AUTO, devfs_cloning, CTL
 SYSCTL_INT(_net_link_tap, OID_AUTO, debug, CTLFLAG_RW, , 0, "");
 
 DEV_MODULE(if_tap, tapmodevent, NULL);
-MODULE_VERSION(if_tun, 1);
+MODULE_VERSION(if_tap, 1);
 
 static int
 tap_clone_create(struct if_clone *ifc, int unit, caddr_t params)
___
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: r346688 - head/sys/net

2019-04-25 Thread Rodney W. Grimes
[ Charset UTF-8 unsupported, converting... ]
> Author: kevans
> Date: Thu Apr 25 18:22:22 2019
> New Revision: 346688
> URL: https://svnweb.freebsd.org/changeset/base/346688
> 
> Log:
>   tap(4): Add a MODULE_VERSION
^^^
>   
>   Otherwise tap(4) can be loaded by loader despite being compiled into the
>   kernel, causing a panic as things try to double-initialize.
>   
>   PR: 220867
>   MFC after:  3 days
> 
> Modified:
>   head/sys/net/if_tap.c
^^^
> 
> Modified: head/sys/net/if_tap.c
> ==
> --- head/sys/net/if_tap.c Thu Apr 25 18:13:55 2019(r346687)
> +++ head/sys/net/if_tap.c Thu Apr 25 18:22:22 2019(r346688)
> @@ -180,6 +180,7 @@ SYSCTL_INT(_net_link_tap, OID_AUTO, devfs_cloning, CTL
>  SYSCTL_INT(_net_link_tap, OID_AUTO, debug, CTLFLAG_RW, , 0, "");
>  
>  DEV_MODULE(if_tap, tapmodevent, NULL);
 ^^^
> +MODULE_VERSION(if_tun, 1);
 ^^^
If wrong, ok, please fix, if correct, please this needs a very 
complete comment as to what it is if_tun.


>  static int
>  tap_clone_create(struct if_clone *ifc, int unit, caddr_t params)
> 
> 

-- 
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: r346683 - head/usr.sbin/bsdinstall/scripts

2019-04-25 Thread Enji Cooper

> On Apr 25, 2019, at 09:47, Emmanuel Vadot  wrote:
> 
> Author: manu
> Date: Thu Apr 25 16:47:15 2019
> New Revision: 346683
> URL: https://svnweb.freebsd.org/changeset/base/346683
> 
> Log:
>  bsdinstall: up the interface before calling dhclient

Hi Emmanuel!
Just curious.. What issue did you see when the interface wasn’t UPed?
Thank you!
-Enji
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r346688 - head/sys/net

2019-04-25 Thread Kyle Evans
Author: kevans
Date: Thu Apr 25 18:22:22 2019
New Revision: 346688
URL: https://svnweb.freebsd.org/changeset/base/346688

Log:
  tap(4): Add a MODULE_VERSION
  
  Otherwise tap(4) can be loaded by loader despite being compiled into the
  kernel, causing a panic as things try to double-initialize.
  
  PR:   220867
  MFC after:3 days

Modified:
  head/sys/net/if_tap.c

Modified: head/sys/net/if_tap.c
==
--- head/sys/net/if_tap.c   Thu Apr 25 18:13:55 2019(r346687)
+++ head/sys/net/if_tap.c   Thu Apr 25 18:22:22 2019(r346688)
@@ -180,6 +180,7 @@ SYSCTL_INT(_net_link_tap, OID_AUTO, devfs_cloning, CTL
 SYSCTL_INT(_net_link_tap, OID_AUTO, debug, CTLFLAG_RW, , 0, "");
 
 DEV_MODULE(if_tap, tapmodevent, NULL);
+MODULE_VERSION(if_tun, 1);
 
 static int
 tap_clone_create(struct if_clone *ifc, int unit, caddr_t params)
___
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: r346687 - head/sys/compat/linuxkpi/common/src

2019-04-25 Thread Tycho Nightingale
Author: tychon
Date: Thu Apr 25 18:13:55 2019
New Revision: 346687
URL: https://svnweb.freebsd.org/changeset/base/346687

Log:
  LinuxKPI buildfix for ppc64 after r346645.
  
  Proposed by:  hselasky
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/compat/linuxkpi/common/src/linux_pci.c

Modified: head/sys/compat/linuxkpi/common/src/linux_pci.c
==
--- head/sys/compat/linuxkpi/common/src/linux_pci.c Thu Apr 25 17:28:36 
2019(r346686)
+++ head/sys/compat/linuxkpi/common/src/linux_pci.c Thu Apr 25 18:13:55 
2019(r346687)
@@ -137,9 +137,9 @@ linux_dma_tag_init(struct device *dev, u64 dma_mask)
dma_mask,   /* lowaddr */
BUS_SPACE_MAXADDR,  /* highaddr */
NULL, NULL, /* filtfunc, filtfuncarg */
-   BUS_SPACE_MAXADDR,  /* maxsize */
+   BUS_SPACE_MAXSIZE,  /* maxsize */
1,  /* nsegments */
-   BUS_SPACE_MAXADDR,  /* maxsegsz */
+   BUS_SPACE_MAXSIZE,  /* maxsegsz */
0,  /* flags */
NULL, NULL, /* lockfunc, lockfuncarg */
>dmat);
___
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: r346686 - in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2019-04-25 Thread Alexander Motin
Author: mav
Date: Thu Apr 25 17:28:36 2019
New Revision: 346686
URL: https://svnweb.freebsd.org/changeset/base/346686

Log:
  MFC r345200: MFV r336930: 9284 arc_reclaim_thread has 2 jobs
  
  `arc_reclaim_thread()` calls `arc_adjust()` after calling
  `arc_kmem_reap_now()`; `arc_adjust()` signals `arc_get_data_buf()` to
  indicate that we may no longer be `arc_is_overflowing()`.
  
  The problem is, `arc_kmem_reap_now()` can take several seconds to
  complete, has no impact on `arc_is_overflowing()`, but due to how the
  code is structured, can impact how long the ARC will remain in the
  `arc_is_overflowing()` state.
  
  The fix is to use seperate threads to:
  
  1. keep `arc_size` under `arc_c`, by calling `arc_adjust()`, which
  improves `arc_is_overflowing()`
  
  2. keep enough free memory in the system, by calling
   `arc_kmem_reap_now()` plus `arc_shrink()`, which improves
   `arc_available_memory()`.
  
  illumos/illumos-gate@de753e34f9c399037936e8bc547d823bba9d4b0d
  
  Reviewed by: Matt Ahrens 
  Reviewed by: Serapheim Dimitropoulos 
  Reviewed by: Pavel Zakharov 
  Reviewed by: Dan Kimmel 
  Reviewed by: Paul Dagnelie 
  Reviewed by: Dan McDonald 
  Reviewed by: Tim Kordas 
  Approved by: Garrett D'Amore 
  Author: Brad Lewis 

Modified:
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zthr.h
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zthr.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c  Thu Apr 
25 17:25:13 2019(r346685)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c  Thu Apr 
25 17:28:36 2019(r346686)
@@ -273,6 +273,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -288,11 +289,23 @@ int arc_procfd;
 #endif
 #endif /* illumos */
 
-static kmutex_tarc_reclaim_lock;
-static kcondvar_t  arc_reclaim_thread_cv;
-static boolean_t   arc_reclaim_thread_exit;
-static kcondvar_t  arc_reclaim_waiters_cv;
+/*
+ * This thread's job is to keep enough free memory in the system, by
+ * calling arc_kmem_reap_now() plus arc_shrink(), which improves
+ * arc_available_memory().
+ */
+static zthr_t  *arc_reap_zthr;
 
+/*
+ * This thread's job is to keep arc_size under arc_c, by calling
+ * arc_adjust(), which improves arc_is_overflowing().
+ */
+static zthr_t  *arc_adjust_zthr;
+
+static kmutex_tarc_adjust_lock;
+static kcondvar_t  arc_adjust_waiters_cv;
+static boolean_t   arc_adjust_needed = B_FALSE;
+
 static kmutex_tarc_dnlc_evicts_lock;
 static kcondvar_t  arc_dnlc_evicts_cv;
 static boolean_t   arc_dnlc_evicts_thread_exit;
@@ -309,19 +322,23 @@ uint_t arc_reduce_dnlc_percent = 3;
 int zfs_arc_evict_batch_limit = 10;
 
 /* number of seconds before growing cache again */
-static int arc_grow_retry = 60;
+int arc_grow_retry = 60;
 
-/* number of milliseconds before attempting a kmem-cache-reap */
-static int arc_kmem_cache_reap_retry_ms = 0;
+/*
+ * Minimum time between calls to arc_kmem_reap_soon().  Note that this will
+ * be converted to ticks, so with the default hz=100, a setting of 15 ms
+ * will actually wait 2 ticks, or 20ms.
+ */
+int arc_kmem_cache_reap_retry_ms = 1000;
 
 /* shift of arc_c for calculating overflow limit in arc_get_data_impl */
-intzfs_arc_overflow_shift = 8;
+int zfs_arc_overflow_shift = 8;
 
 /* shift of arc_c for calculating both min and max arc_p */
-static int arc_p_min_shift = 4;
+int arc_p_min_shift = 4;
 
 /* log2(fraction of arc to reclaim) */
-static int arc_shrink_shift = 7;
+int arc_shrink_shift = 7;
 
 /*
  * log2(fraction of ARC which must be free to allow growing).
@@ -347,7 +364,7 @@ static int  zfs_arc_min_prescient_prefetch_ms = 6;
  */
 int arc_lotsfree_percent = 10;
 
-static int arc_dead;
+static boolean_t arc_initialized;
 extern boolean_t zfs_prefetch_disable;
 
 /*
@@ -981,6 +998,7 @@ aggsum_t astat_other_size;
 aggsum_t astat_l2_hdr_size;
 
 static int arc_no_grow;/* Don't try to grow cache size */
+static hrtime_tarc_growtime;
 static uint64_tarc_tempreserve;
 static uint64_tarc_loaned_bytes;
 
@@ -1741,8 +1759,8 @@ hdr_recl(void *unused)
 * umem calls the reclaim func when we destroy the buf cache,
 * which is after we do arc_fini().
 */
-   if (!arc_dead)
-   cv_signal(_reclaim_thread_cv);
+   if (arc_initialized)
+   zthr_wakeup(arc_reap_zthr);
 }
 
 static void
@@ -3766,13 +3784,14 @@ arc_evict_state_impl(multilist_t *ml, int idx, arc_buf
 * function should 

svn commit: r346685 - in stable/11/cddl/contrib/opensolaris: cmd/zfs lib/libzfs/common

2019-04-25 Thread Alexander Motin
Author: mav
Date: Thu Apr 25 17:25:13 2019
New Revision: 346685
URL: https://svnweb.freebsd.org/changeset/base/346685

Log:
  MFC r344601 (by sef): Set process title during zfs send.
  
  This adds a '-V' option to 'zfs send', which sets the process title once a
  second to the progress information.
  
  This code has been in FreeNAS for a long time now; this is just upstreaming
  it here.  It was originially written by delphij.

Modified:
  stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs.8
  stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
  stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
  stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs.8
==
--- stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs.8Thu Apr 25 17:22:41 
2019(r346684)
+++ stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs.8Thu Apr 25 17:25:13 
2019(r346685)
@@ -32,7 +32,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 6, 2017
+.Dd February 15, 2018
 .Dt ZFS 8
 .Os
 .Sh NAME
@@ -184,7 +184,7 @@
 .Ar bookmark
 .Nm
 .Cm send
-.Op Fl DLPRcenpv
+.Op Fl DLPRVcenpv
 .Op Fl i Ar snapshot | Fl I Ar snapshot
 .Ar snapshot
 .Nm
@@ -194,7 +194,7 @@
 .Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot
 .Nm
 .Cm send
-.Op Fl Penv
+.Op Fl PVenv
 .Fl t Ar receive_resume_token
 .Nm
 .Cm receive Ns | Ns Cm recv
@@ -2604,7 +2604,7 @@ feature.
 .It Xo
 .Nm
 .Cm send
-.Op Fl DLPRcenpv
+.Op Fl DLPRVcenpv
 .Op Fl i Ar snapshot | Fl I Ar snapshot
 .Ar snapshot
 .Xc
@@ -2748,6 +2748,8 @@ Print machine-parsable verbose information about the s
 .It Fl v, -verbose
 Print verbose information about the stream package generated.
 This information includes a per-second report of how much data has been sent.
+.It Fl V
+Set the process title to a per-second report of how much data has been sent.
 .El
 .Pp
 The format of the stream is committed. You will be able to receive your streams

Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
==
--- stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c   Thu Apr 25 
17:22:41 2019(r346684)
+++ stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c   Thu Apr 25 
17:25:13 2019(r346685)
@@ -3813,7 +3813,7 @@ zfs_do_send(int argc, char **argv)
};
 
/* check options */
-   while ((c = getopt_long(argc, argv, ":i:I:RbDpvnPLet:c", long_options,
+   while ((c = getopt_long(argc, argv, ":i:I:RbDpVvnPLet:c", long_options,
NULL)) != -1) {
switch (c) {
case 'i':
@@ -3836,6 +3836,10 @@ zfs_do_send(int argc, char **argv)
case 'P':
flags.parsable = B_TRUE;
flags.verbose = B_TRUE;
+   break;
+   case 'V':
+   flags.progress = B_TRUE;
+   flags.progressastitle = B_TRUE;
break;
case 'v':
if (flags.verbose)

Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
==
--- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h   Thu Apr 
25 17:22:41 2019(r346684)
+++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h   Thu Apr 
25 17:25:13 2019(r346685)
@@ -651,6 +651,9 @@ typedef struct sendflags {
 
/* compressed WRITE records are permitted */
boolean_t compress;
+
+   /* show progress as process title(ie. -V) */
+   boolean_t progressastitle;
 } sendflags_t;
 
 typedef boolean_t (snapfilter_cb_t)(zfs_handle_t *, void *);

Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
==
--- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c  
Thu Apr 25 17:22:41 2019(r346684)
+++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c  
Thu Apr 25 17:25:13 2019(r346685)
@@ -85,6 +85,8 @@ typedef struct progress_arg {
zfs_handle_t *pa_zhp;
int pa_fd;
boolean_t pa_parsable;
+   boolean_t pa_astitle;
+   uint64_t pa_size;
 } progress_arg_t;
 
 typedef struct dataref {
@@ -930,6 +932,7 @@ typedef struct send_dump_data {
uint64_t prevsnap_obj;
boolean_t seenfrom, seento, replicate, doall, fromorigin;
boolean_t verbose, dryrun, parsable, progress, embed_data, std_out;
+   boolean_t progressastitle;
boolean_t large_block, compress;
int outfd;
boolean_t err;
@@ -1110,14 +1113,14 @@ send_progress_thread(void *arg)
zfs_cmd_t zc = { 0 };
zfs_handle_t 

svn commit: r346684 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2019-04-25 Thread Alexander Motin
Author: mav
Date: Thu Apr 25 17:22:41 2019
New Revision: 346684
URL: https://svnweb.freebsd.org/changeset/base/346684

Log:
  MFC r340311: Do not ignore arc_adjust() return value.
  
  This covers scenario when ARC may not shrink as fast as it could:
  1. arc_size < arc_c and arc_adjust() does not evict anything, returning
 zero to arc_reclaim_thread();
  2. arc_available_memory() reports memory pressure, which can not be
 satisfied by arc_kmem_reap_now();
  3. arc_shrink() reduces arc_c and calls arc_adjust(), return of which is
 ignored;
  4. even if the last arc_adjust() could not satisfy arc_size < arc_c,
 arc_reclaim_thread() will still go to sleep, since the first one
 returned zero.

Modified:
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c  Thu Apr 
25 16:47:15 2019(r346683)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c  Thu Apr 
25 17:22:41 2019(r346684)
@@ -4251,7 +4251,7 @@ arc_flush(spa_t *spa, boolean_t retry)
(void) arc_flush_state(arc_mfu_ghost, guid, ARC_BUFC_METADATA, retry);
 }
 
-void
+uint64_t
 arc_shrink(int64_t to_free)
 {
uint64_t asize = aggsum_value(_size);
@@ -4279,8 +4279,9 @@ arc_shrink(int64_t to_free)
if (asize > arc_c) {
DTRACE_PROBE2(arc__shrink_adjust, uint64_t, asize,
uint64_t, arc_c);
-   (void) arc_adjust();
+   return (arc_adjust());
}
+   return (0);
 }
 
 typedef enum free_memory_reason_t {
@@ -4622,7 +4623,7 @@ arc_reclaim_thread(void *unused __unused)
to_free = MAX(to_free, ptob(needfree));
 #endif
 #endif
-   arc_shrink(to_free);
+   evicted += arc_shrink(to_free);
}
} else if (free_memory < arc_c >> arc_no_grow_shift) {
arc_no_grow = B_TRUE;
___
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: r346683 - head/usr.sbin/bsdinstall/scripts

2019-04-25 Thread Emmanuel Vadot
Author: manu
Date: Thu Apr 25 16:47:15 2019
New Revision: 346683
URL: https://svnweb.freebsd.org/changeset/base/346683

Log:
  bsdinstall: up the interface before calling dhclient
  
  MFC after:1 week

Modified:
  head/usr.sbin/bsdinstall/scripts/netconfig_ipv4

Modified: head/usr.sbin/bsdinstall/scripts/netconfig_ipv4
==
--- head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 Thu Apr 25 16:45:24 
2019(r346682)
+++ head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 Thu Apr 25 16:47:15 
2019(r346683)
@@ -49,6 +49,7 @@ esac
 dialog --backtitle 'FreeBSD Installer' --title 'Network Configuration' --yesno 
'Would you like to use DHCP to configure this interface?' 0 0
 if [ $? -eq $DIALOG_OK ]; then
if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then
+   ifconfig $INTERFACE up
dialog --backtitle 'FreeBSD Installer' --infobox "Acquiring 
DHCP lease..." 0 0
err=$( dhclient $INTERFACE 2>&1 )
if [ $? -ne 0 ]; then
___
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: r346682 - head/etc/mtree

2019-04-25 Thread Emmanuel Vadot
Author: manu
Date: Thu Apr 25 16:45:24 2019
New Revision: 346682
URL: https://svnweb.freebsd.org/changeset/base/346682

Log:
  mtree: Add more runtime package tag
  
  When using pkgbase those empty directories aren't packaged otherwise.
  
  Reviewed by:  bapt
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D20056

Modified:
  head/etc/mtree/BSD.sendmail.dist
  head/etc/mtree/BSD.usr.dist
  head/etc/mtree/BSD.var.dist

Modified: head/etc/mtree/BSD.sendmail.dist
==
--- head/etc/mtree/BSD.sendmail.distThu Apr 25 15:56:32 2019
(r346681)
+++ head/etc/mtree/BSD.sendmail.distThu Apr 25 16:45:24 2019
(r346682)
@@ -6,7 +6,7 @@
 /set type=dir uname=root gname=wheel mode=0755
 .   nochange
 var nochange
-spool   nochange
+spool   nochange tags=package=runtime
 clientmqueueuname=smmsp gname=smmsp mode=0770
 ..
 ..

Modified: head/etc/mtree/BSD.usr.dist
==
--- head/etc/mtree/BSD.usr.dist Thu Apr 25 15:56:32 2019(r346681)
+++ head/etc/mtree/BSD.usr.dist Thu Apr 25 16:45:24 2019(r346682)
@@ -428,9 +428,9 @@
 ..
 keys
 pkg
-revoked
+revoked tags=package=runtime
 ..
-trusted
+trusted tags=package=runtime
 ..
 ..
 ..

Modified: head/etc/mtree/BSD.var.dist
==
--- head/etc/mtree/BSD.var.dist Thu Apr 25 15:56:32 2019(r346681)
+++ head/etc/mtree/BSD.var.dist Thu Apr 25 16:45:24 2019(r346682)
@@ -32,7 +32,7 @@
 ..
 crash
 ..
-cron
+crontags=package=runtime
 tabsmode=0700
 ..
 ..
@@ -59,21 +59,21 @@
 ..
 ..
 ..
-empty   mode=0555 flags=schg
+empty   mode=0555 flags=schg tags=package=runtime
 ..
 games   gname=games mode=0775
 ..
 heimdal mode=0700
 ..
-log
+log tags=package=runtime
 ..
-mailgname=mail mode=0775
+mailgname=mail mode=0775 tags=package=runtime
 ..
 msgsuname=daemon
 ..
 preserve
 ..
-run
+run tags=package=runtime
 dhclient
 ..
 ppp gname=network mode=0770
@@ -101,7 +101,7 @@
 ..
 /set gname=wheel
 ..
-tmp mode=01777
+tmp mode=01777 tags=package=runtime
 vi.recover  mode=01777
 ..
 ..
___
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: r346681 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2019-04-25 Thread Alexander Motin
Author: mav
Date: Thu Apr 25 15:56:32 2019
New Revision: 346681
URL: https://svnweb.freebsd.org/changeset/base/346681

Log:
  MFC r339298 (by allanjude):
  Add missing sysctls for tuning vdev queue depths for new I/O types
  
  This connects new tunables that were added but not exposed in:
  r329502 (zpool remove)
  r337007 (zpool initialize)

Modified:
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c   
Thu Apr 25 15:51:09 2019(r346680)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c   
Thu Apr 25 15:56:32 2019(r346681)
@@ -253,6 +253,10 @@ ZFS_VDEV_QUEUE_KNOB_MIN(scrub);
 ZFS_VDEV_QUEUE_KNOB_MAX(scrub);
 ZFS_VDEV_QUEUE_KNOB_MIN(trim);
 ZFS_VDEV_QUEUE_KNOB_MAX(trim);
+ZFS_VDEV_QUEUE_KNOB_MIN(removal);
+ZFS_VDEV_QUEUE_KNOB_MAX(removal);
+ZFS_VDEV_QUEUE_KNOB_MIN(initializing);
+ZFS_VDEV_QUEUE_KNOB_MAX(initializing);
 
 #undef ZFS_VDEV_QUEUE_KNOB
 
___
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: r346679 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2019-04-25 Thread Alexander Motin
Author: mav
Date: Thu Apr 25 15:51:00 2019
New Revision: 346679
URL: https://svnweb.freebsd.org/changeset/base/346679

Log:
  MFC r339009 (by allanjude):
  Avoid panic when adjusting priority of a read in the face of an IO error
  
  PR: 231516
  Reported by:sbruno
  Approved by:re (rgrimes)
  Obtained from:  ZFS-on-Linux
  X-MFC-with: 334844
  Sponsored by:   Klara Systems
  
  MFV/ZoL:Fix zio->io_priority failed (7 < 6) assert
  
  commit c26cf0966d131b722c32f8ccecfe5791a789d975
  Author: Tony Hutter 
  Date:   Tue May 29 18:13:48 2018 -0700
  
Fix zio->io_priority failed (7 < 6) assert
  
This fixes an assert in vdev_queue_change_io_priority():
  
  VERIFY3(zio->io_priority < ZIO_PRIORITY_NUM_QUEUEABLE) failed (7 < 6)
  PANIC at vdev_queue.c:832:vdev_queue_change_io_priority()
  
Reviewed-by: Tom Caputi 
Reviewed-by: George Melikov 
Reviewed-by: Brian Behlendorf 
Signed-off-by: Tony Hutter 

Modified:
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c   
Thu Apr 25 15:48:23 2019(r346678)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c   
Thu Apr 25 15:51:00 2019(r346679)
@@ -982,6 +982,15 @@ vdev_queue_change_io_priority(zio_t *zio, zio_priority
vdev_queue_t *vq = >io_vd->vdev_queue;
avl_tree_t *tree;
 
+   /*
+* ZIO_PRIORITY_NOW is used by the vdev cache code and the aggregate zio
+* code to issue IOs without adding them to the vdev queue. In this
+* case, the zio is already going to be issued as quickly as possible
+* and so it doesn't need any reprioitization to help.
+*/
+   if (zio->io_priority == ZIO_PRIORITY_NOW)
+   return;
+
ASSERT3U(zio->io_priority, <, ZIO_PRIORITY_NUM_QUEUEABLE);
ASSERT3U(priority, <, ZIO_PRIORITY_NUM_QUEUEABLE);
 
___
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: r346680 - head/lib/libbe

2019-04-25 Thread Kyle Evans
Author: kevans
Date: Thu Apr 25 15:51:09 2019
New Revision: 346680
URL: https://svnweb.freebsd.org/changeset/base/346680

Log:
  libbe(3): Copy received properties as well
  
  This was inherently broken on send|recv datasets.
  
  Reported and tested by:   Wes Maag 
  MFC after:3 days

Modified:
  head/lib/libbe/be.c

Modified: head/lib/libbe/be.c
==
--- head/lib/libbe/be.c Thu Apr 25 15:51:00 2019(r346679)
+++ head/lib/libbe/be.c Thu Apr 25 15:51:09 2019(r346680)
@@ -431,8 +431,12 @@ be_deep_clone_prop(int prop, void *cb)
/* Just continue if we fail to read a property */
return (ZPROP_CONT);
 
-   /* Only copy locally defined properties */
-   if (src != ZPROP_SRC_LOCAL)
+   /*
+* Only copy locally defined or received properties.  This continues
+* to avoid temporary/default/local properties intentionally without
+* breaking received datasets.
+*/
+   if (src != ZPROP_SRC_LOCAL && src != ZPROP_SRC_RECEIVED)
return (ZPROP_CONT);
 
/* Augment mountpoint with altroot, if needed */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r346678 - head/lib/libvgl

2019-04-25 Thread Bruce Evans
Author: bde
Date: Thu Apr 25 15:48:23 2019
New Revision: 346678
URL: https://svnweb.freebsd.org/changeset/base/346678

Log:
  Restore doing nothing for calls to VGLEnd() after the first. I broke this
  in r346631.  VGLEnd() clears some state variables as it restores state,
  but not all of them, so it still needs to clear a single state variable
  to indicate that it has completed.  Put this clearing back where it was
  (at the start instead of the end) to avoid moving bugs in the signal
  handling.

Modified:
  head/lib/libvgl/main.c

Modified: head/lib/libvgl/main.c
==
--- head/lib/libvgl/main.c  Thu Apr 25 15:37:28 2019(r346677)
+++ head/lib/libvgl/main.c  Thu Apr 25 15:48:23 2019(r346678)
@@ -73,6 +73,7 @@ struct vt_mode smode;
 
   if (!VGLInitDone)
 return;
+  VGLInitDone = 0;
   signal(SIGUSR1, SIG_IGN);
   signal(SIGUSR2, SIG_IGN);
   VGLSwitchPending = 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: r346677 - in head/sys: dev/cxgbe dev/mlx5/mlx5_en kern netinet netinet6

2019-04-25 Thread Andrew Gallatin
Author: gallatin
Date: Thu Apr 25 15:37:28 2019
New Revision: 346677
URL: https://svnweb.freebsd.org/changeset/base/346677

Log:
  Track TCP connection's NUMA domain in the inpcb
  
  Drivers can now pass up numa domain information via the
  mbuf numa domain field.  This information is then used
  by TCP syncache_socket() to associate that information
  with the inpcb. The domain information is then fed back
  into transmitted mbufs in ip{6}_output(). This mechanism
  is nearly identical to what is done to track RSS hash values
  in the inp_flowid.
  
  Follow on changes will use this information for lacp egress
  port selection, binding TCP pacers to the appropriate NUMA
  domain, etc.
  
  Reviewed by:  markj, kib, slavash, bz, scottl, jtl, tuexen
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D20028

Modified:
  head/sys/dev/cxgbe/t4_sge.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c
  head/sys/kern/uipc_mbuf.c
  head/sys/netinet/in_pcb.c
  head/sys/netinet/in_pcb.h
  head/sys/netinet/ip_output.c
  head/sys/netinet/tcp_syncache.c
  head/sys/netinet6/ip6_output.c

Modified: head/sys/dev/cxgbe/t4_sge.c
==
--- head/sys/dev/cxgbe/t4_sge.c Thu Apr 25 15:31:35 2019(r346676)
+++ head/sys/dev/cxgbe/t4_sge.c Thu Apr 25 15:37:28 2019(r346677)
@@ -2046,6 +2046,9 @@ t4_eth_rx(struct sge_iq *iq, const struct rss_header *
rxq->vlan_extraction++;
}
 
+#ifdef NUMA
+   m0->m_pkthdr.numa_domain = ifp->if_numa_domain;
+#endif
 #if defined(INET) || defined(INET6)
if (iq->flags & IQ_LRO_ENABLED) {
if (sort_before_lro(lro)) {

Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c
==
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c  Thu Apr 25 15:31:35 2019
(r346676)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c  Thu Apr 25 15:37:28 2019
(r346677)
@@ -520,6 +520,9 @@ rx_common:
mlx5e_build_rx_mbuf(cqe, rq, mb, byte_cnt);
rq->stats.bytes += byte_cnt;
rq->stats.packets++;
+#ifdef NUMA
+   mb->m_pkthdr.numa_domain = rq->ifp->if_numa_domain;
+#endif
 
 #if !defined(HAVE_TCP_LRO_RX)
tcp_lro_queue_mbuf(>lro, mb);

Modified: head/sys/kern/uipc_mbuf.c
==
--- head/sys/kern/uipc_mbuf.c   Thu Apr 25 15:31:35 2019(r346676)
+++ head/sys/kern/uipc_mbuf.c   Thu Apr 25 15:37:28 2019(r346677)
@@ -341,6 +341,9 @@ m_pkthdr_init(struct mbuf *m, int how)
 #endif
m->m_data = m->m_pktdat;
bzero(>m_pkthdr, sizeof(m->m_pkthdr));
+#ifdef NUMA
+   m->m_pkthdr.numa_domain = M_NODOM;
+#endif
 #ifdef MAC
/* If the label init fails, fail the alloc */
error = mac_mbuf_init(m, how);

Modified: head/sys/netinet/in_pcb.c
==
--- head/sys/netinet/in_pcb.c   Thu Apr 25 15:31:35 2019(r346676)
+++ head/sys/netinet/in_pcb.c   Thu Apr 25 15:37:28 2019(r346677)
@@ -510,6 +510,9 @@ in_pcballoc(struct socket *so, struct inpcbinfo *pcbin
if (inp == NULL)
return (ENOBUFS);
bzero(>inp_start_zero, inp_zero_size);
+#ifdef NUMA
+   inp->inp_numa_domain = M_NODOM;
+#endif
inp->inp_pcbinfo = pcbinfo;
inp->inp_socket = so;
inp->inp_cred = crhold(so->so_cred);

Modified: head/sys/netinet/in_pcb.h
==
--- head/sys/netinet/in_pcb.h   Thu Apr 25 15:31:35 2019(r346676)
+++ head/sys/netinet/in_pcb.h   Thu Apr 25 15:37:28 2019(r346677)
@@ -272,7 +272,7 @@ struct inpcb {
 inp_hpts_calls :1, /* (i) from output hpts */
 inp_input_calls :1,/* (i) from input hpts */
 inp_spare_bits2 : 4;
-   uint8_t inp_spare_byte; /* Compiler hole */
+   uint8_t inp_numa_domain;/* numa domain */
void*inp_ppcb;  /* (i) pointer to per-protocol pcb */
struct  socket *inp_socket; /* (i) back pointer to socket */
uint32_t inp_hptsslot;  /* Hpts wheel slot this tcb is 
Lock(i) */

Modified: head/sys/netinet/ip_output.c
==
--- head/sys/netinet/ip_output.cThu Apr 25 15:31:35 2019
(r346676)
+++ head/sys/netinet/ip_output.cThu Apr 25 15:37:28 2019
(r346677)
@@ -247,6 +247,9 @@ ip_output(struct mbuf *m, struct mbuf *opt, struct rou
m->m_pkthdr.flowid = inp->inp_flowid;
M_HASHTYPE_SET(m, inp->inp_flowtype);
}
+#ifdef NUMA
+   m->m_pkthdr.numa_domain = inp->inp_numa_domain;
+#endif
   

svn commit: r346676 - in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2019-04-25 Thread Alexander Motin
Author: mav
Date: Thu Apr 25 15:31:35 2019
New Revision: 346676
URL: https://svnweb.freebsd.org/changeset/base/346676

Log:
  MFC r337594 (by mmacy):
  ZFS/MFV:Use cached feature info in spa_add_feature_stats()
  
  commit 417104bdd3c7ce07ec58674dd078f9891c3bc780
  Author: Ned Bass 
  Date:   Thu Feb 26 12:24:11 2015 -0800
  
  Use cached feature info in spa_add_feature_stats()
  
  Avoid issuing I/O to the pool when retrieving feature flags information.
  Trying to read the ZAPs from disk means that zpool clear would hang if
  the pool is suspended and recovery would require a reboot. To keep the
  feature stats resident in memory, we hang a cached nvlist off of the
  spa.  It is built up from disk the first time spa_add_feature_stats() is
  called, and refreshed thereafter using the cached feature reference
  counts. spa_add_feature_stats() gets called at pool import time so we
  can be sure the cached nvlist will be available if the pool is later
  suspended.
  
  Signed-off-by: Ned Bass 
  Signed-off-by: Brian Behlendorf 
  Closes #3082

Modified:
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfeature.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c  Thu Apr 
25 15:09:21 2019(r346675)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c  Thu Apr 
25 15:31:35 2019(r346676)
@@ -4372,18 +4372,14 @@ spa_add_l2cache(spa_t *spa, nvlist_t *config)
 }
 
 static void
-spa_add_feature_stats(spa_t *spa, nvlist_t *config)
+spa_feature_stats_from_disk(spa_t *spa, nvlist_t *features)
 {
-   nvlist_t *features;
zap_cursor_t zc;
zap_attribute_t za;
 
-   ASSERT(spa_config_held(spa, SCL_CONFIG, RW_READER));
-   VERIFY(nvlist_alloc(, NV_UNIQUE_NAME, KM_SLEEP) == 0);
-
/* We may be unable to read features if pool is suspended. */
if (spa_suspended(spa))
-   goto out;
+   return;
 
if (spa->spa_feat_for_read_obj != 0) {
for (zap_cursor_init(, spa->spa_meta_objset,
@@ -4392,7 +4388,7 @@ spa_add_feature_stats(spa_t *spa, nvlist_t *config)
zap_cursor_advance()) {
ASSERT(za.za_integer_length == sizeof (uint64_t) &&
za.za_num_integers == 1);
-   VERIFY3U(0, ==, nvlist_add_uint64(features, za.za_name,
+   VERIFY0(nvlist_add_uint64(features, za.za_name,
za.za_first_integer));
}
zap_cursor_fini();
@@ -4405,16 +4401,62 @@ spa_add_feature_stats(spa_t *spa, nvlist_t *config)
zap_cursor_advance()) {
ASSERT(za.za_integer_length == sizeof (uint64_t) &&
za.za_num_integers == 1);
-   VERIFY3U(0, ==, nvlist_add_uint64(features, za.za_name,
+   VERIFY0(nvlist_add_uint64(features, za.za_name,
za.za_first_integer));
}
zap_cursor_fini();
}
+}
 
-out:
-   VERIFY(nvlist_add_nvlist(config, ZPOOL_CONFIG_FEATURE_STATS,
-   features) == 0);
-   nvlist_free(features);
+static void
+spa_feature_stats_from_cache(spa_t *spa, nvlist_t *features)
+{
+   int i;
+
+   for (i = 0; i < SPA_FEATURES; i++) {
+   zfeature_info_t feature = spa_feature_table[i];
+   uint64_t refcount;
+
+   if (feature_get_refcount(spa, , ) != 0)
+   continue;
+
+   VERIFY0(nvlist_add_uint64(features, feature.fi_guid, refcount));
+   }
+}
+
+/*
+ * Store a list of pool features and their reference counts in the
+ * config.
+ *
+ * The first time this is called on a spa, allocate a new nvlist, fetch
+ * the pool features and reference counts from disk, then save the list
+ * in the spa. In subsequent calls on the same spa use the saved nvlist
+ * and refresh its values from the cached reference counts.  This
+ * ensures we don't block here on I/O on a suspended pool so 'zpool
+ * clear' can resume the pool.
+ */
+static void
+spa_add_feature_stats(spa_t *spa, nvlist_t *config)
+{
+   nvlist_t *features;
+
+   ASSERT(spa_config_held(spa, SCL_CONFIG, RW_READER));
+
+   mutex_enter(>spa_feat_stats_lock);
+   features = spa->spa_feat_stats;
+
+   if (features != NULL) {
+   spa_feature_stats_from_cache(spa, features);
+   } else {
+   VERIFY0(nvlist_alloc(, NV_UNIQUE_NAME, 

svn commit: r346675 - head/stand/common

2019-04-25 Thread Ian Lepore
Author: ian
Date: Thu Apr 25 15:09:21 2019
New Revision: 346675
URL: https://svnweb.freebsd.org/changeset/base/346675

Log:
  Restore the ability to open a raw disk or partition in loader(8).
  
  The disk_open() function searches for "the best partition" when slice and
  partition information is not provided as part of the device name.  As of
  r345477 the slice and partition fields of a disk_devdesc are initialized to
  D_SLICEWILD and D_PARTWILD; in the past they were initialized to -1, which
  was sometimes interpreted as meaning 'wildcard' and sometimes as 'open the
  raw partition' depending on the context.  So as an unintended side effect of
  r345477 it became basically impossible to ever open a disk or partition
  without doing the 'best partition' search.  One visible effect of that was
  the inability to open the raw disk to read the partition table correctly in
  zfs_probe_dev(), leading to failures to find the zfs pool unless it was on
  the first partition.
  
  Now instead of always initializing slice and partition to wildcards, the
  disk_parsedev() function initializes them based on the presence of a
  path/file name following the device.  If there is any path or filename
  following the ':' that ends the device name, then slice and partition are
  initialized to D_SLICEWILD and D_PARTWILD.  If there is nothing after the
  ':' then it is considered to be a request to open the raw device or
  partition itself (not a file stored within it), and the fields are
  initialized to D_SLICENONE and D_PARTNONE.
  
  With this change in place, all the tests in src/tools/boot are succesful
  again, including the recently-added cases of booting from a zfs pool on
  a partition other than slice 1 of the device.
  
  PR:   236981

Modified:
  head/stand/common/disk.c

Modified: head/stand/common/disk.c
==
--- head/stand/common/disk.cThu Apr 25 14:41:29 2019(r346674)
+++ head/stand/common/disk.cThu Apr 25 15:09:21 2019(r346675)
@@ -392,8 +392,20 @@ disk_parsedev(struct disk_devdesc *dev, const char *de
 
np = devspec;
unit = -1;
-   slice = D_SLICEWILD;
-   partition = D_PARTWILD;
+   /*
+* If there is path/file info after the device info, then any missing
+* slice or partition info should be considered a request to search for
+* an appropriate partition.  Otherwise we want to open the raw device
+* itself and not try to fill in missing info by searching.
+*/
+   if ((cp = strchr(np, ':')) != NULL && cp[1] != '\0') {
+   slice = D_SLICEWILD;
+   partition = D_PARTWILD;
+   } else {
+   slice = D_SLICENONE;
+   partition = D_PARTNONE;
+   }
+
if (*np != '\0' && *np != ':') {
unit = strtol(np, , 10);
if (cp == np)
___
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: r346674 - in stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2019-04-25 Thread Alexander Motin
Author: mav
Date: Thu Apr 25 14:41:29 2019
New Revision: 346674
URL: https://svnweb.freebsd.org/changeset/base/346674

Log:
  MFC r345200: MFV r336930: 9284 arc_reclaim_thread has 2 jobs
  
  `arc_reclaim_thread()` calls `arc_adjust()` after calling
  `arc_kmem_reap_now()`; `arc_adjust()` signals `arc_get_data_buf()` to
  indicate that we may no longer be `arc_is_overflowing()`.
  
  The problem is, `arc_kmem_reap_now()` can take several seconds to
  complete, has no impact on `arc_is_overflowing()`, but due to how the
  code is structured, can impact how long the ARC will remain in the
  `arc_is_overflowing()` state.
  
  The fix is to use seperate threads to:
  
  1. keep `arc_size` under `arc_c`, by calling `arc_adjust()`, which
  improves `arc_is_overflowing()`
  
  2. keep enough free memory in the system, by calling
   `arc_kmem_reap_now()` plus `arc_shrink()`, which improves
   `arc_available_memory()`.
  
  illumos/illumos-gate@de753e34f9c399037936e8bc547d823bba9d4b0d
  
  Reviewed by: Matt Ahrens 
  Reviewed by: Serapheim Dimitropoulos 
  Reviewed by: Pavel Zakharov 
  Reviewed by: Dan Kimmel 
  Reviewed by: Paul Dagnelie 
  Reviewed by: Dan McDonald 
  Reviewed by: Tim Kordas 
  Approved by: Garrett D'Amore 

Modified:
  stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
  stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zthr.h
  stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zthr.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
==
--- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c  Thu Apr 
25 14:39:52 2019(r346673)
+++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c  Thu Apr 
25 14:41:29 2019(r346674)
@@ -281,6 +281,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -296,11 +297,23 @@ int arc_procfd;
 #endif
 #endif /* illumos */
 
-static kmutex_tarc_reclaim_lock;
-static kcondvar_t  arc_reclaim_thread_cv;
-static boolean_t   arc_reclaim_thread_exit;
-static kcondvar_t  arc_reclaim_waiters_cv;
+/*
+ * This thread's job is to keep enough free memory in the system, by
+ * calling arc_kmem_reap_now() plus arc_shrink(), which improves
+ * arc_available_memory().
+ */
+static zthr_t  *arc_reap_zthr;
 
+/*
+ * This thread's job is to keep arc_size under arc_c, by calling
+ * arc_adjust(), which improves arc_is_overflowing().
+ */
+static zthr_t  *arc_adjust_zthr;
+
+static kmutex_tarc_adjust_lock;
+static kcondvar_t  arc_adjust_waiters_cv;
+static boolean_t   arc_adjust_needed = B_FALSE;
+
 static kmutex_tarc_dnlc_evicts_lock;
 static kcondvar_t  arc_dnlc_evicts_cv;
 static boolean_t   arc_dnlc_evicts_thread_exit;
@@ -317,19 +330,23 @@ uint_t arc_reduce_dnlc_percent = 3;
 int zfs_arc_evict_batch_limit = 10;
 
 /* number of seconds before growing cache again */
-static int arc_grow_retry = 60;
+int arc_grow_retry = 60;
 
-/* number of milliseconds before attempting a kmem-cache-reap */
-static int arc_kmem_cache_reap_retry_ms = 0;
+/*
+ * Minimum time between calls to arc_kmem_reap_soon().  Note that this will
+ * be converted to ticks, so with the default hz=100, a setting of 15 ms
+ * will actually wait 2 ticks, or 20ms.
+ */
+int arc_kmem_cache_reap_retry_ms = 1000;
 
 /* shift of arc_c for calculating overflow limit in arc_get_data_impl */
-intzfs_arc_overflow_shift = 8;
+int zfs_arc_overflow_shift = 8;
 
 /* shift of arc_c for calculating both min and max arc_p */
-static int arc_p_min_shift = 4;
+int arc_p_min_shift = 4;
 
 /* log2(fraction of arc to reclaim) */
-static int arc_shrink_shift = 7;
+int arc_shrink_shift = 7;
 
 /*
  * log2(fraction of ARC which must be free to allow growing).
@@ -355,7 +372,7 @@ static int  zfs_arc_min_prescient_prefetch_ms = 6;
  */
 int arc_lotsfree_percent = 10;
 
-static int arc_dead;
+static boolean_t arc_initialized;
 extern boolean_t zfs_prefetch_disable;
 
 /*
@@ -1052,6 +1069,7 @@ static kmutex_t arc_prune_mtx;
 static taskq_t *arc_prune_taskq;
 
 static int arc_no_grow;/* Don't try to grow cache size */
+static hrtime_tarc_growtime;
 static uint64_tarc_tempreserve;
 static uint64_tarc_loaned_bytes;
 
@@ -1819,8 +1837,8 @@ hdr_recl(void *unused)
 * umem calls the reclaim func when we destroy the buf cache,
 * which is after we do arc_fini().
 */
-   if (!arc_dead)
-   cv_signal(_reclaim_thread_cv);
+   if (arc_initialized)
+   zthr_wakeup(arc_reap_zthr);
 }
 
 static void
@@ -3905,13 +3923,14 @@ arc_evict_state_impl(multilist_t *ml, int idx, arc_buf
 * function should proceed in 

svn commit: r346673 - in stable/12/cddl/contrib/opensolaris: cmd/zfs lib/libzfs/common

2019-04-25 Thread Alexander Motin
Author: mav
Date: Thu Apr 25 14:39:52 2019
New Revision: 346673
URL: https://svnweb.freebsd.org/changeset/base/346673

Log:
  MFC r344601 (by sef): Set process title during zfs send.
  
  This adds a '-V' option to 'zfs send', which sets the process title once a
  second to the progress information.
  
  This code has been in FreeNAS for a long time now; this is just upstreaming
  it here.  It was originially written by delphij.

Modified:
  stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs.8
  stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
  stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
  stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs.8
==
--- stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs.8Thu Apr 25 14:33:38 
2019(r346672)
+++ stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs.8Thu Apr 25 14:39:52 
2019(r346673)
@@ -32,7 +32,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 11, 2018
+.Dd February 15, 2018
 .Dt ZFS 8
 .Os
 .Sh NAME
@@ -184,7 +184,7 @@
 .Ar bookmark
 .Nm
 .Cm send
-.Op Fl DLPRcenpv
+.Op Fl DLPRVcenpv
 .Op Fl i Ar snapshot | Fl I Ar snapshot
 .Ar snapshot
 .Nm
@@ -194,7 +194,7 @@
 .Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot
 .Nm
 .Cm send
-.Op Fl Penv
+.Op Fl PVenv
 .Fl t Ar receive_resume_token
 .Nm
 .Cm receive Ns | Ns Cm recv
@@ -2607,7 +2607,7 @@ feature.
 .It Xo
 .Nm
 .Cm send
-.Op Fl DLPRcenpv
+.Op Fl DLPRVcenpv
 .Op Fl i Ar snapshot | Fl I Ar snapshot
 .Ar snapshot
 .Xc
@@ -2753,6 +2753,8 @@ Print machine-parsable verbose information about the s
 .It Fl v, -verbose
 Print verbose information about the stream package generated.
 This information includes a per-second report of how much data has been sent.
+.It Fl V
+Set the process title to a per-second report of how much data has been sent.
 .El
 .Pp
 The format of the stream is committed. You will be able to receive your streams

Modified: stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
==
--- stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c   Thu Apr 25 
14:33:38 2019(r346672)
+++ stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c   Thu Apr 25 
14:39:52 2019(r346673)
@@ -3813,7 +3813,7 @@ zfs_do_send(int argc, char **argv)
};
 
/* check options */
-   while ((c = getopt_long(argc, argv, ":i:I:RbDpvnPLet:c", long_options,
+   while ((c = getopt_long(argc, argv, ":i:I:RbDpVvnPLet:c", long_options,
NULL)) != -1) {
switch (c) {
case 'i':
@@ -3836,6 +3836,10 @@ zfs_do_send(int argc, char **argv)
case 'P':
flags.parsable = B_TRUE;
flags.verbose = B_TRUE;
+   break;
+   case 'V':
+   flags.progress = B_TRUE;
+   flags.progressastitle = B_TRUE;
break;
case 'v':
if (flags.verbose)

Modified: stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
==
--- stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h   Thu Apr 
25 14:33:38 2019(r346672)
+++ stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h   Thu Apr 
25 14:39:52 2019(r346673)
@@ -651,6 +651,9 @@ typedef struct sendflags {
 
/* compressed WRITE records are permitted */
boolean_t compress;
+
+   /* show progress as process title(ie. -V) */
+   boolean_t progressastitle;
 } sendflags_t;
 
 typedef boolean_t (snapfilter_cb_t)(zfs_handle_t *, void *);

Modified: stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
==
--- stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c  
Thu Apr 25 14:33:38 2019(r346672)
+++ stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c  
Thu Apr 25 14:39:52 2019(r346673)
@@ -85,6 +85,8 @@ typedef struct progress_arg {
zfs_handle_t *pa_zhp;
int pa_fd;
boolean_t pa_parsable;
+   boolean_t pa_astitle;
+   uint64_t pa_size;
 } progress_arg_t;
 
 typedef struct dataref {
@@ -930,6 +932,7 @@ typedef struct send_dump_data {
uint64_t prevsnap_obj;
boolean_t seenfrom, seento, replicate, doall, fromorigin;
boolean_t verbose, dryrun, parsable, progress, embed_data, std_out;
+   boolean_t progressastitle;
boolean_t large_block, compress;
int outfd;
boolean_t err;
@@ -1110,14 +1113,14 @@ send_progress_thread(void *arg)
zfs_cmd_t zc = { 0 };
zfs_handle_t 

svn commit: r346672 - stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2019-04-25 Thread Alexander Motin
Author: mav
Date: Thu Apr 25 14:33:38 2019
New Revision: 346672
URL: https://svnweb.freebsd.org/changeset/base/346672

Log:
  MFC r340311: Do not ignore arc_adjust() return value.
  
  This covers scenario when ARC may not shrink as fast as it could:
  1. arc_size < arc_c and arc_adjust() does not evict anything, returning
 zero to arc_reclaim_thread();
  2. arc_available_memory() reports memory pressure, which can not be
 satisfied by arc_kmem_reap_now();
  3. arc_shrink() reduces arc_c and calls arc_adjust(), return of which is
 ignored;
  4. even if the last arc_adjust() could not satisfy arc_size < arc_c,
 arc_reclaim_thread() will still go to sleep, since the first one
 returned zero.

Modified:
  stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
==
--- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c  Thu Apr 
25 13:46:12 2019(r346671)
+++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c  Thu Apr 
25 14:33:38 2019(r346672)
@@ -4565,7 +4565,7 @@ arc_flush(spa_t *spa, boolean_t retry)
(void) arc_flush_state(arc_mfu_ghost, guid, ARC_BUFC_METADATA, retry);
 }
 
-void
+uint64_t
 arc_shrink(int64_t to_free)
 {
uint64_t asize = aggsum_value(_size);
@@ -4593,8 +4593,9 @@ arc_shrink(int64_t to_free)
if (asize > arc_c) {
DTRACE_PROBE2(arc__shrink_adjust, uint64_t, asize,
uint64_t, arc_c);
-   (void) arc_adjust();
+   return (arc_adjust());
}
+   return (0);
 }
 
 typedef enum free_memory_reason_t {
@@ -4917,7 +4918,7 @@ arc_reclaim_thread(void *unused __unused)
to_free = MAX(to_free, ptob(needfree));
 #endif
 #endif
-   arc_shrink(to_free);
+   evicted += arc_shrink(to_free);
}
} else if (free_memory < arc_c >> arc_no_grow_shift) {
arc_no_grow = B_TRUE;
___
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: r346671 - head/sys/net

2019-04-25 Thread Kyle Evans
Author: kevans
Date: Thu Apr 25 13:46:12 2019
New Revision: 346671
URL: https://svnweb.freebsd.org/changeset/base/346671

Log:
  tun(4): Don't allow open of open or dying devices
  
  Previously, a pid check was used to prevent open of the tun(4); this works,
  but may not make the most sense as we don't prevent the owner process from
  opening the tun device multiple times.
  
  The potential race described near tun_pid should not be an issue: if a
  tun(4) is to be handed off, its fd has to have been sent via control message
  or some other mechanism that duplicates the fd to the receiving process so
  that it may set the pid. Otherwise, the pid gets cleared when the original
  process closes it and you have no effective handoff mechanism.
  
  Close up another potential issue with handing a tun(4) off by not clobbering
  state if the closer isn't the controller anymore. If we want some state to
  be cleared, we should do that a little more surgically.
  
  Additionally, nothing prevents a dying tun(4) from being "reopened" in the
  middle of tun_destroy as soon as the mutex is unlocked, quickly leading to a
  bad time. Return EBUSY if we're marked for destruction, as well, and the
  consumer will need to deal with it. The associated character device will be
  destroyed in short order.
  
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D20033

Modified:
  head/sys/net/if_tun.c

Modified: head/sys/net/if_tun.c
==
--- head/sys/net/if_tun.c   Thu Apr 25 12:44:08 2019(r346670)
+++ head/sys/net/if_tun.c   Thu Apr 25 13:46:12 2019(r346671)
@@ -81,16 +81,10 @@ struct tun_softc {
 #defineTUN_RWAIT   0x0040
 #defineTUN_ASYNC   0x0080
 #defineTUN_IFHEAD  0x0100
+#defineTUN_DYING   0x0200
 
 #define TUN_READY   (TUN_OPEN | TUN_INITED)
 
-   /*
-* XXXRW: tun_pid is used to exclusively lock /dev/tun.  Is this
-* actually needed?  Can we just return EBUSY if already open?
-* Problem is that this involved inherent races when a tun device
-* is handed off from one process to another, as opposed to just
-* being slightly stale informationally.
-*/
pid_t   tun_pid;/* owning pid */
struct  ifnet *tun_ifp; /* the interface */
struct  sigio *tun_sigio;   /* information for async I/O */
@@ -277,6 +271,7 @@ tun_destroy(struct tun_softc *tp)
struct cdev *dev;
 
mtx_lock(>tun_mtx);
+   tp->tun_flags |= TUN_DYING;
if ((tp->tun_flags & TUN_OPEN) != 0)
cv_wait_unlock(>tun_cv, >tun_mtx);
else
@@ -473,19 +468,13 @@ tunopen(struct cdev *dev, int flag, int mode, struct t
tp = dev->si_drv1;
}
 
-   /*
-* XXXRW: This use of tun_pid is subject to error due to the
-* fact that a reference to the tunnel can live beyond the
-* death of the process that created it.  Can we replace this
-* with a simple busy flag?
-*/
mtx_lock(>tun_mtx);
-   if (tp->tun_pid != 0 && tp->tun_pid != td->td_proc->p_pid) {
+   if ((tp->tun_flags & (TUN_OPEN | TUN_DYING)) != 0) {
mtx_unlock(>tun_mtx);
return (EBUSY);
}
-   tp->tun_pid = td->td_proc->p_pid;
 
+   tp->tun_pid = td->td_proc->p_pid;
tp->tun_flags |= TUN_OPEN;
ifp = TUN2IFP(tp);
if_link_state_change(ifp, LINK_STATE_UP);
@@ -509,6 +498,16 @@ tunclose(struct cdev *dev, int foo, int bar, struct th
ifp = TUN2IFP(tp);
 
mtx_lock(>tun_mtx);
+   /*
+* Simply close the device if this isn't the controlling process.  This
+* may happen if, for instance, the tunnel has been handed off to
+* another process.  The original controller should be able to close it
+* without putting us into an inconsistent state.
+*/
+   if (td->td_proc->p_pid != tp->tun_pid) {
+   mtx_unlock(>tun_mtx);
+   return (0);
+   }
 
/*
 * junk all pending output
___
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: r346670 - head/sys/net

2019-04-25 Thread Kyle Evans
Author: kevans
Date: Thu Apr 25 12:44:08 2019
New Revision: 346670
URL: https://svnweb.freebsd.org/changeset/base/346670

Log:
  tun/tap: close race between destroy/ioctl handler
  
  It seems that there should be a better way to handle this, but this seems to
  be the more common approach and it should likely get replaced in all of the
  places it happens... Basically, thread 1 is in the process of destroying the
  tun/tap while thread 2 is executing one of the ioctls that requires the
  tun/tap mutex and the mutex is destroyed before the ioctl handler can
  acquire it.
  
  This is only one of the races described/found in PR 233955.
  
  PR:   233955
  Reviewed by:  ae
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D20027

Modified:
  head/sys/net/if_tap.c
  head/sys/net/if_tun.c

Modified: head/sys/net/if_tap.c
==
--- head/sys/net/if_tap.c   Thu Apr 25 12:02:17 2019(r346669)
+++ head/sys/net/if_tap.c   Thu Apr 25 12:44:08 2019(r346670)
@@ -41,6 +41,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -55,6 +56,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -163,6 +165,9 @@ MALLOC_DECLARE(M_TAP);
 MALLOC_DEFINE(M_TAP, CDEV_NAME, "Ethernet tunnel interface");
 SYSCTL_INT(_debug, OID_AUTO, if_tap_debug, CTLFLAG_RW, , 0, "");
 
+static struct sx tap_ioctl_sx;
+SX_SYSINIT(tap_ioctl_sx, _ioctl_sx, "tap_ioctl");
+
 SYSCTL_DECL(_net_link);
 static SYSCTL_NODE(_net_link, OID_AUTO, tap, CTLFLAG_RW, 0,
 "Ethernet tunnel software network interface");
@@ -217,6 +222,10 @@ tap_destroy(struct tap_softc *tp)
struct ifnet *ifp = tp->tap_ifp;
 
CURVNET_SET(ifp->if_vnet);
+   sx_xlock(_ioctl_sx);
+   ifp->if_softc = NULL;
+   sx_xunlock(_ioctl_sx);
+
destroy_dev(tp->tap_dev);
seldrain(>tap_rsel);
knlist_clear(>tap_rsel.si_note, 0);
@@ -600,12 +609,18 @@ tapifinit(void *xtp)
 static int
 tapifioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
 {
-   struct tap_softc*tp = ifp->if_softc;
+   struct tap_softc*tp;
struct ifreq*ifr = (struct ifreq *)data;
struct ifstat   *ifs = NULL;
struct ifmediareq   *ifmr = NULL;
int  dummy, error = 0;
 
+   sx_xlock(_ioctl_sx);
+   tp = ifp->if_softc;
+   if (tp == NULL) {
+   error = ENXIO;
+   goto bad;
+   }
switch (cmd) {
case SIOCSIFFLAGS: /* XXX -- just like vmnet does */
case SIOCADDMULTI:
@@ -648,6 +663,8 @@ tapifioctl(struct ifnet *ifp, u_long cmd, caddr_t data
break;
}
 
+bad:
+   sx_xunlock(_ioctl_sx);
return (error);
 } /* tapifioctl */
 

Modified: head/sys/net/if_tun.c
==
--- head/sys/net/if_tun.c   Thu Apr 25 12:02:17 2019(r346669)
+++ head/sys/net/if_tun.c   Thu Apr 25 12:44:08 2019(r346670)
@@ -20,6 +20,7 @@
 #include "opt_inet6.h"
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -30,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -115,6 +117,9 @@ static struct clonedevs *tunclones;
 static TAILQ_HEAD(,tun_softc)  tunhead = TAILQ_HEAD_INITIALIZER(tunhead);
 SYSCTL_INT(_debug, OID_AUTO, if_tun_debug, CTLFLAG_RW, , 0, "");
 
+static struct sx tun_ioctl_sx;
+SX_SYSINIT(tun_ioctl_sx, _ioctl_sx, "tun_ioctl");
+
 SYSCTL_DECL(_net_link);
 static SYSCTL_NODE(_net_link, OID_AUTO, tun, CTLFLAG_RW, 0,
 "IP tunnel software network interface.");
@@ -278,6 +283,10 @@ tun_destroy(struct tun_softc *tp)
mtx_unlock(>tun_mtx);
 
CURVNET_SET(TUN2IFP(tp)->if_vnet);
+   sx_xlock(_ioctl_sx);
+   TUN2IFP(tp)->if_softc = NULL;
+   sx_xunlock(_ioctl_sx);
+
dev = tp->tun_dev;
bpfdetach(TUN2IFP(tp));
if_detach(TUN2IFP(tp));
@@ -588,10 +597,16 @@ static int
 tunifioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
 {
struct ifreq *ifr = (struct ifreq *)data;
-   struct tun_softc *tp = ifp->if_softc;
+   struct tun_softc *tp;
struct ifstat *ifs;
int error = 0;
 
+   sx_xlock(_ioctl_sx);
+   tp = ifp->if_softc;
+   if (tp == NULL) {
+   error = ENXIO;
+   goto bad;
+   }
switch(cmd) {
case SIOCGIFSTATUS:
ifs = (struct ifstat *)data;
@@ -618,6 +633,8 @@ tunifioctl(struct ifnet *ifp, u_long cmd, caddr_t data
default:
error = EINVAL;
}
+bad:
+   sx_xunlock(_ioctl_sx);
return (error);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to 

svn commit: r346669 - stable/10/sys/dev/usb/controller

2019-04-25 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Apr 25 12:02:17 2019
New Revision: 346669
URL: https://svnweb.freebsd.org/changeset/base/346669

Log:
  MFC r346229 and r346248:
  Fix spelling and remove superfluous USB keyword.
  
  Submitted by: Dmitry Luhtionov 
  Sponsored by: Mellanox Technologies

Modified:
  stable/10/sys/dev/usb/controller/ehci_pci.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/usb/controller/ehci_pci.c
==
--- stable/10/sys/dev/usb/controller/ehci_pci.c Thu Apr 25 12:01:11 2019
(r346668)
+++ stable/10/sys/dev/usb/controller/ehci_pci.c Thu Apr 25 12:02:17 2019
(r346669)
@@ -179,7 +179,7 @@ ehci_pci_match(device_t self)
case 0x8d2d8086:
return ("Intel Wellsburg USB 2.0 controller");
case 0x9c268086:
-   return ("Intel Lynx Point LP USB 2.0 controller USB");
+   return ("Intel Lynx Point-LP USB 2.0 controller");
 
case 0x00e01033:
return ("NEC uPD 72010x USB 2.0 controller");
___
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: r346667 - stable/12/sys/dev/usb/controller

2019-04-25 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Apr 25 12:00:06 2019
New Revision: 346667
URL: https://svnweb.freebsd.org/changeset/base/346667

Log:
  MFC r346229 and r346248:
  Fix spelling and remove superfluous USB keyword.
  
  Submitted by: Dmitry Luhtionov 
  Sponsored by: Mellanox Technologies

Modified:
  stable/12/sys/dev/usb/controller/ehci_pci.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/usb/controller/ehci_pci.c
==
--- stable/12/sys/dev/usb/controller/ehci_pci.c Thu Apr 25 11:57:34 2019
(r34)
+++ stable/12/sys/dev/usb/controller/ehci_pci.c Thu Apr 25 12:00:06 2019
(r346667)
@@ -181,7 +181,7 @@ ehci_pci_match(device_t self)
case 0x8d2d8086:
return ("Intel Wellsburg USB 2.0 controller");
case 0x9c268086:
-   return ("Intel Lynx Point LP USB 2.0 controller USB");
+   return ("Intel Lynx Point-LP USB 2.0 controller");
 
case 0x00e01033:
return ("NEC uPD 72010x USB 2.0 controller");
___
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: r346668 - stable/11/sys/dev/usb/controller

2019-04-25 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Apr 25 12:01:11 2019
New Revision: 346668
URL: https://svnweb.freebsd.org/changeset/base/346668

Log:
  MFC r346229 and r346248:
  Fix spelling and remove superfluous USB keyword.
  
  Submitted by: Dmitry Luhtionov 
  Sponsored by: Mellanox Technologies

Modified:
  stable/11/sys/dev/usb/controller/ehci_pci.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/usb/controller/ehci_pci.c
==
--- stable/11/sys/dev/usb/controller/ehci_pci.c Thu Apr 25 12:00:06 2019
(r346667)
+++ stable/11/sys/dev/usb/controller/ehci_pci.c Thu Apr 25 12:01:11 2019
(r346668)
@@ -179,7 +179,7 @@ ehci_pci_match(device_t self)
case 0x8d2d8086:
return ("Intel Wellsburg USB 2.0 controller");
case 0x9c268086:
-   return ("Intel Lynx Point LP USB 2.0 controller USB");
+   return ("Intel Lynx Point-LP USB 2.0 controller");
 
case 0x00e01033:
return ("NEC uPD 72010x USB 2.0 controller");
___
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: r346666 - in stable/11: lib/libcuse sys/fs/cuse

2019-04-25 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Apr 25 11:57:34 2019
New Revision: 34
URL: https://svnweb.freebsd.org/changeset/base/34

Log:
  MFC r346356:
  Implement flag for telling cuse(3) clients if the peer is running in 32-bit
  compat mode or not. This is useful when implementing compatibility ioctl(2)
  handlers in userspace.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/11/lib/libcuse/cuse.3
  stable/11/sys/fs/cuse/cuse.c
  stable/11/sys/fs/cuse/cuse_defs.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libcuse/cuse.3
==
--- stable/11/lib/libcuse/cuse.3Thu Apr 25 11:56:07 2019
(r346665)
+++ stable/11/lib/libcuse/cuse.3Thu Apr 25 11:57:34 2019
(r34)
@@ -25,7 +25,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd October 5, 2017
+.Dd April 17, 2019
 .Dt CUSE 3
 .Os
 .Sh NAME
@@ -303,6 +303,7 @@ enum {
   CUSE_FFLAG_READ
   CUSE_FFLAG_WRITE
   CUSE_FFLAG_NONBLOCK
+  CUSE_FFLAG_COMPAT32
 
   CUSE_CMD_NONE
   CUSE_CMD_OPEN

Modified: stable/11/sys/fs/cuse/cuse.c
==
--- stable/11/sys/fs/cuse/cuse.cThu Apr 25 11:56:07 2019
(r346665)
+++ stable/11/sys/fs/cuse/cuse.cThu Apr 25 11:57:34 2019
(r34)
@@ -53,6 +53,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -538,7 +539,10 @@ cuse_client_send_command_locked(struct cuse_client_com
 
if (ioflag & IO_NDELAY)
cuse_fflags |= CUSE_FFLAG_NONBLOCK;
-
+#if defined(__LP64__)
+   if (SV_CURPROC_FLAG(SV_ILP32))
+   cuse_fflags |= CUSE_FFLAG_COMPAT32;
+#endif
pccmd->sub.fflags = cuse_fflags;
pccmd->sub.data_pointer = data_ptr;
pccmd->sub.argument = arg;

Modified: stable/11/sys/fs/cuse/cuse_defs.h
==
--- stable/11/sys/fs/cuse/cuse_defs.h   Thu Apr 25 11:56:07 2019
(r346665)
+++ stable/11/sys/fs/cuse/cuse_defs.h   Thu Apr 25 11:57:34 2019
(r34)
@@ -27,7 +27,7 @@
 #ifndef _CUSE_DEFS_H_
 #define_CUSE_DEFS_H_
 
-#defineCUSE_VERSION0x000123
+#defineCUSE_VERSION0x000124
 
 #defineCUSE_ERR_NONE   0
 #defineCUSE_ERR_BUSY   -1
@@ -49,6 +49,7 @@
 #defineCUSE_FFLAG_READ 1
 #defineCUSE_FFLAG_WRITE2
 #defineCUSE_FFLAG_NONBLOCK 4
+#defineCUSE_FFLAG_COMPAT32 8 /* peer is running in 32-bit compat 
mode */
 
 #defineCUSE_DBG_NONE   0
 #defineCUSE_DBG_FULL   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: r346665 - in stable/12: lib/libcuse sys/fs/cuse

2019-04-25 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Apr 25 11:56:07 2019
New Revision: 346665
URL: https://svnweb.freebsd.org/changeset/base/346665

Log:
  MFC r346356:
  Implement flag for telling cuse(3) clients if the peer is running in 32-bit
  compat mode or not. This is useful when implementing compatibility ioctl(2)
  handlers in userspace.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/12/lib/libcuse/cuse.3
  stable/12/sys/fs/cuse/cuse.c
  stable/12/sys/fs/cuse/cuse_defs.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libcuse/cuse.3
==
--- stable/12/lib/libcuse/cuse.3Thu Apr 25 09:13:15 2019
(r346664)
+++ stable/12/lib/libcuse/cuse.3Thu Apr 25 11:56:07 2019
(r346665)
@@ -25,7 +25,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd October 5, 2017
+.Dd April 17, 2019
 .Dt CUSE 3
 .Os
 .Sh NAME
@@ -303,6 +303,7 @@ enum {
   CUSE_FFLAG_READ
   CUSE_FFLAG_WRITE
   CUSE_FFLAG_NONBLOCK
+  CUSE_FFLAG_COMPAT32
 
   CUSE_CMD_NONE
   CUSE_CMD_OPEN

Modified: stable/12/sys/fs/cuse/cuse.c
==
--- stable/12/sys/fs/cuse/cuse.cThu Apr 25 09:13:15 2019
(r346664)
+++ stable/12/sys/fs/cuse/cuse.cThu Apr 25 11:56:07 2019
(r346665)
@@ -51,6 +51,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -536,7 +537,10 @@ cuse_client_send_command_locked(struct cuse_client_com
 
if (ioflag & IO_NDELAY)
cuse_fflags |= CUSE_FFLAG_NONBLOCK;
-
+#if defined(__LP64__)
+   if (SV_CURPROC_FLAG(SV_ILP32))
+   cuse_fflags |= CUSE_FFLAG_COMPAT32;
+#endif
pccmd->sub.fflags = cuse_fflags;
pccmd->sub.data_pointer = data_ptr;
pccmd->sub.argument = arg;

Modified: stable/12/sys/fs/cuse/cuse_defs.h
==
--- stable/12/sys/fs/cuse/cuse_defs.h   Thu Apr 25 09:13:15 2019
(r346664)
+++ stable/12/sys/fs/cuse/cuse_defs.h   Thu Apr 25 11:56:07 2019
(r346665)
@@ -27,7 +27,7 @@
 #ifndef _CUSE_DEFS_H_
 #define_CUSE_DEFS_H_
 
-#defineCUSE_VERSION0x000123
+#defineCUSE_VERSION0x000124
 
 #defineCUSE_ERR_NONE   0
 #defineCUSE_ERR_BUSY   -1
@@ -49,6 +49,7 @@
 #defineCUSE_FFLAG_READ 1
 #defineCUSE_FFLAG_WRITE2
 #defineCUSE_FFLAG_NONBLOCK 4
+#defineCUSE_FFLAG_COMPAT32 8 /* peer is running in 32-bit compat 
mode */
 
 #defineCUSE_DBG_NONE   0
 #defineCUSE_DBG_FULL   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"


Re: svn commit: r346645 - in head/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src sys

2019-04-25 Thread Tycho Nightingale


> On Apr 25, 2019, at 5:13 AM, Hans Petter Selasky  wrote:
> 
> On 4/25/19 8:09 AM, Li-Wen Hsu wrote:
>> On Thu, Apr 25, 2019 at 5:31 AM Tycho Nightingale  wrote:
>>> 
>>> Author: tychon
>>> Date: Wed Apr 24 20:30:45 2019
>>> New Revision: 346645
>>> URL: https://svnweb.freebsd.org/changeset/base/346645
>> ...
>>> Modified: head/sys/compat/linuxkpi/common/src/linux_pci.c
>>> ==
>>> --- head/sys/compat/linuxkpi/common/src/linux_pci.c Wed Apr 24 19:56:02 
>>> 2019(r346644)
>>> +++ head/sys/compat/linuxkpi/common/src/linux_pci.c Wed Apr 24 20:30:45 
>>> 2019(r346645)
>> ...
>>> +PCTRIE_DEFINE(LINUX_DMA, linux_dma_obj, dma_addr, linux_dma_trie_alloc,
>>> +linux_dma_trie_free);
>> Here we got errors in build on 32-bit platforms use gcc:
> 
> Should be fixed by r346664.

Sorry about that.  Thanks for fixing it!

Tycho
___
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: r346645 - in head/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src sys

2019-04-25 Thread Hans Petter Selasky

On 4/25/19 8:09 AM, Li-Wen Hsu wrote:

On Thu, Apr 25, 2019 at 5:31 AM Tycho Nightingale  wrote:


Author: tychon
Date: Wed Apr 24 20:30:45 2019
New Revision: 346645
URL: https://svnweb.freebsd.org/changeset/base/346645

...

Modified: head/sys/compat/linuxkpi/common/src/linux_pci.c
==
--- head/sys/compat/linuxkpi/common/src/linux_pci.c Wed Apr 24 19:56:02 
2019(r346644)
+++ head/sys/compat/linuxkpi/common/src/linux_pci.c Wed Apr 24 20:30:45 
2019(r346645)

...

+PCTRIE_DEFINE(LINUX_DMA, linux_dma_obj, dma_addr, linux_dma_trie_alloc,
+linux_dma_trie_free);


Here we got errors in build on 32-bit platforms use gcc:



Should be fixed by r346664.

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


svn commit: r346664 - head/sys/compat/linuxkpi/common/src

2019-04-25 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Apr 25 09:13:15 2019
New Revision: 346664
URL: https://svnweb.freebsd.org/changeset/base/346664

Log:
  LinuxKPI buildfix for 32-bit DMA architectures after r346645.
  
  The  APIs expect a 64-bit DMA key.
  This is fine as long as the DMA is less than or equal to 64 bits, which
  is currently the case.
  
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/src/linux_pci.c

Modified: head/sys/compat/linuxkpi/common/src/linux_pci.c
==
--- head/sys/compat/linuxkpi/common/src/linux_pci.c Thu Apr 25 08:28:54 
2019(r346663)
+++ head/sys/compat/linuxkpi/common/src/linux_pci.c Thu Apr 25 09:13:15 
2019(r346664)
@@ -406,9 +406,11 @@ linux_pci_unregister_driver(struct pci_driver *pdrv)
mtx_unlock();
 }
 
+CTASSERT(sizeof(dma_addr_t) <= sizeof(uint64_t));
+
 struct linux_dma_obj {
void*vaddr;
-   dma_addr_t  dma_addr;
+   uint64_tdma_addr;
bus_dmamap_tdmamap;
 };
 
___
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: r346663 - stable/12/sys/x86/iommu

2019-04-25 Thread Konstantin Belousov
Author: kib
Date: Thu Apr 25 08:28:54 2019
New Revision: 346663
URL: https://svnweb.freebsd.org/changeset/base/346663

Log:
  MFC r346352, r346355:
  Correct handling of RMRR during early enumeration stages.

Modified:
  stable/12/sys/x86/iommu/busdma_dmar.c
  stable/12/sys/x86/iommu/intel_ctx.c
  stable/12/sys/x86/iommu/intel_dmar.h
  stable/12/sys/x86/iommu/intel_drv.c
  stable/12/sys/x86/iommu/intel_intrmap.c
  stable/12/sys/x86/iommu/intel_utils.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/x86/iommu/busdma_dmar.c
==
--- stable/12/sys/x86/iommu/busdma_dmar.c   Thu Apr 25 08:27:00 2019
(r346662)
+++ stable/12/sys/x86/iommu/busdma_dmar.c   Thu Apr 25 08:28:54 2019
(r346663)
@@ -275,7 +275,7 @@ dmar_get_dma_tag(device_t dev, device_t child)
struct dmar_ctx *ctx;
bus_dma_tag_t res;
 
-   dmar = dmar_find(child);
+   dmar = dmar_find(child, bootverbose);
/* Not in scope of any DMAR ? */
if (dmar == NULL)
return (NULL);

Modified: stable/12/sys/x86/iommu/intel_ctx.c
==
--- stable/12/sys/x86/iommu/intel_ctx.c Thu Apr 25 08:27:00 2019
(r346662)
+++ stable/12/sys/x86/iommu/intel_ctx.c Thu Apr 25 08:28:54 2019
(r346663)
@@ -62,6 +62,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -203,7 +205,9 @@ dmar_flush_for_ctx_entry(struct dmar_unit *dmar, bool 
 }
 
 static int
-domain_init_rmrr(struct dmar_domain *domain, device_t dev)
+domain_init_rmrr(struct dmar_domain *domain, device_t dev, int bus,
+int slot, int func, int dev_domain, int dev_busno,
+const void *dev_path, int dev_path_len)
 {
struct dmar_map_entries_tailq rmrr_entries;
struct dmar_map_entry *entry, *entry1;
@@ -214,7 +218,8 @@ domain_init_rmrr(struct dmar_domain *domain, device_t 
 
error = 0;
TAILQ_INIT(_entries);
-   dmar_dev_parse_rmrr(domain, dev, _entries);
+   dmar_dev_parse_rmrr(domain, dev_domain, dev_busno, dev_path,
+   dev_path_len, _entries);
TAILQ_FOREACH_SAFE(entry, _entries, unroll_link, entry1) {
/*
 * VT-d specification requires that the start of an
@@ -227,12 +232,19 @@ domain_init_rmrr(struct dmar_domain *domain, device_t 
 */
start = entry->start;
end = entry->end;
+   if (bootverbose)
+   printf("dmar%d ctx pci%d:%d:%d RMRR [%#jx, %#jx]\n",
+   domain->dmar->unit, bus, slot, func,
+   (uintmax_t)start, (uintmax_t)end);
entry->start = trunc_page(start);
entry->end = round_page(end);
if (entry->start == entry->end) {
/* Workaround for some AMI (?) BIOSes */
if (bootverbose) {
-   device_printf(dev, "BIOS bug: dmar%d RMRR "
+   if (dev != NULL)
+   device_printf(dev, "");
+   printf("pci%d:%d:%d ", bus, slot, func);
+   printf("BIOS bug: dmar%d RMRR "
"region (%jx, %jx) corrected\n",
domain->dmar->unit, start, end);
}
@@ -260,9 +272,13 @@ domain_init_rmrr(struct dmar_domain *domain, device_t 
DMAR_UNLOCK(domain->dmar);
} else {
if (error1 != 0) {
-   device_printf(dev,
+   if (dev != NULL)
+   device_printf(dev, "");
+   printf("pci%d:%d:%d ", bus, slot, func);
+   printf(
"dmar%d failed to map RMRR region (%jx, %jx) %d\n",
-   domain->dmar->unit, start, end, error1);
+   domain->dmar->unit, start, end,
+   error1);
error = error1;
}
TAILQ_REMOVE(_entries, entry, unroll_link);
@@ -404,8 +420,9 @@ dmar_domain_destroy(struct dmar_domain *domain)
free(domain, M_DMAR_DOMAIN);
 }
 
-struct dmar_ctx *
-dmar_get_ctx_for_dev(struct dmar_unit *dmar, device_t dev, uint16_t rid,
+static struct dmar_ctx *
+dmar_get_ctx_for_dev1(struct dmar_unit *dmar, device_t dev, uint16_t rid,
+int dev_domain, int dev_busno, const void *dev_path, int dev_path_len,
 bool id_mapped, bool rmrr_init)
 {
struct dmar_domain *domain, *domain1;
@@ -415,9 +432,15 @@ dmar_get_ctx_for_dev(struct dmar_unit *dmar, device_t 
int bus, 

svn commit: r346662 - stable/12/sys/x86/iommu

2019-04-25 Thread Konstantin Belousov
Author: kib
Date: Thu Apr 25 08:27:00 2019
New Revision: 346662
URL: https://svnweb.freebsd.org/changeset/base/346662

Log:
  MFC r346351:
  Remove witness warning. dmar_bus_dmamap_create() does not sleep.

Modified:
  stable/12/sys/x86/iommu/busdma_dmar.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/x86/iommu/busdma_dmar.c
==
--- stable/12/sys/x86/iommu/busdma_dmar.c   Thu Apr 25 08:25:48 2019
(r346661)
+++ stable/12/sys/x86/iommu/busdma_dmar.c   Thu Apr 25 08:27:00 2019
(r346662)
@@ -371,8 +371,6 @@ dmar_bus_dmamap_create(bus_dma_tag_t dmat, int flags, 
struct bus_dma_tag_dmar *tag;
struct bus_dmamap_dmar *map;
 
-   WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "%s", __func__);
-
tag = (struct bus_dma_tag_dmar *)dmat;
map = malloc_domainset(sizeof(*map), M_DMAR_DMAMAP,
DOMAINSET_PREF(tag->common.domain), M_NOWAIT | M_ZERO);
___
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: r346661 - stable/12/sys/x86/iommu

2019-04-25 Thread Konstantin Belousov
Author: kib
Date: Thu Apr 25 08:25:48 2019
New Revision: 346661
URL: https://svnweb.freebsd.org/changeset/base/346661

Log:
  MFC r346350:
  Reduce verbosity, do not announce details of irte programming by default.

Modified:
  stable/12/sys/x86/iommu/intel_intrmap.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/x86/iommu/intel_intrmap.c
==
--- stable/12/sys/x86/iommu/intel_intrmap.c Thu Apr 25 03:48:37 2019
(r346660)
+++ stable/12/sys/x86/iommu/intel_intrmap.c Thu Apr 25 08:25:48 2019
(r346661)
@@ -270,9 +270,11 @@ dmar_ir_program_irte(struct dmar_unit *unit, u_int idx
irte = &(unit->irt[idx]);
high = DMAR_IRTE2_SVT_RID | DMAR_IRTE2_SQ_RID |
DMAR_IRTE2_SID_RID(rid);
-   device_printf(unit->dev,
-   "programming irte[%d] rid %#x high %#jx low %#jx\n",
-   idx, rid, (uintmax_t)high, (uintmax_t)low);
+   if (bootverbose) {
+   device_printf(unit->dev,
+   "programming irte[%d] rid %#x high %#jx low %#jx\n",
+   idx, rid, (uintmax_t)high, (uintmax_t)low);
+   }
DMAR_LOCK(unit);
if ((irte->irte1 & DMAR_IRTE1_P) != 0) {
/*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r346593 - head/sys/sys

2019-04-25 Thread Konstantin Belousov
On Thu, Apr 25, 2019 at 07:38:21AM +0200, Wojciech Macek wrote:
> Intel does not reorder reads against the condition "if" here. I know for
> sure that ARM does, but therestill might be some other architectures that
> also suffers such behavior - I just don't have any means to verify.
> I remember the discussion for rS302292 where we agreed that this kind of
> patches should be the least impacting in perfomrance as possible. Adding
> unconditional memory barrier causes significant performance drop on Intel,
> where in fact, the issue was never seen.
> 
Atomic_thread_fence_acq() is nop on x86, or rather, it is compiler memory
barrier.  If you need read/read fence on some architectures, I am sure
that you need compiler barrier on all.

> Wojtek
> 
> czw., 25 kwi 2019 o 06:08 Mark Johnston  napisał(a):
> 
> > On Tue, Apr 23, 2019 at 06:36:32AM +, Wojciech Macek wrote:
> > > Author: wma
> > > Date: Tue Apr 23 06:36:32 2019
> > > New Revision: 346593
> > > URL: https://svnweb.freebsd.org/changeset/base/346593
> > >
> > > Log:
> > >   This patch offers a workaround to buf_ring reordering
> > >   visible on armv7 and armv8. Similar issue to rS302292.
> > >
> > >   Obtained from: Semihalf
> > >   Authored by:   Michal Krawczyk 
> > >   Approved by:   wma
> > >   Differential Revision: https://reviews.freebsd.org/D19932
> > >
> > > Modified:
> > >   head/sys/sys/buf_ring.h
> > >
> > > Modified: head/sys/sys/buf_ring.h
> > >
> > ==
> > > --- head/sys/sys/buf_ring.h   Tue Apr 23 04:06:26 2019(r346592)
> > > +++ head/sys/sys/buf_ring.h   Tue Apr 23 06:36:32 2019(r346593)
> > > @@ -310,14 +310,23 @@ buf_ring_peek_clear_sc(struct buf_ring *br)
> > >   if (!mtx_owned(br->br_lock))
> > >   panic("lock not held on single consumer dequeue");
> > >  #endif
> > > - /*
> > > -  * I believe it is safe to not have a memory barrier
> > > -  * here because we control cons and tail is worst case
> > > -  * a lagging indicator so we worst case we might
> > > -  * return NULL immediately after a buffer has been enqueued
> > > -  */
> > > +
> > >   if (br->br_cons_head == br->br_prod_tail)
> > >   return (NULL);
> > > +
> > > +#if defined(__arm__) || defined(__aarch64__)
> > > + /*
> > > +  * The barrier is required there on ARM and ARM64 to ensure, that
> > > +  * br->br_ring[br->br_cons_head] will not be fetched before the
> > above
> > > +  * condition is checked.
> > > +  * Without the barrier, it is possible, that buffer will be fetched
> > > +  * before the enqueue will put mbuf into br, then, in the
> > meantime, the
> > > +  * enqueue will update the array and the br_prod_tail, and the
> > > +  * conditional check will be true, so we will return previously
> > fetched
> > > +  * (and invalid) buffer.
> > > +  */
> > > + atomic_thread_fence_acq();
> > > +#endif
> >
> > Why is it specific to ARM?
> >
___
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: r341586 - head/sys/dev/mlx5/mlx5_en

2019-04-25 Thread Slava Shwartsman




On 17-Apr-19 00:28, John Baldwin wrote:

On 4/16/19 8:32 AM, Hans Petter Selasky wrote:

On 4/16/19 4:39 PM, Andrey V. Elsukov wrote:

On 05.12.2018 17:25, Slava Shwartsman wrote:

Author: slavash
Date: Wed Dec  5 14:25:03 2018
New Revision: 341586
URL: https://svnweb.freebsd.org/changeset/base/341586

Log:
mlx5en: Implement backpressure indication.

The backpressure indication is implemented using an unlimited rate type of

mbuf send tag. When the upper layers typically the socket layer has 
obtained such
a tag, it can then query the destination driver queue for the current
amount of space available in the send queue.

A single mbuf send tag may be referenced multiple times and a refcount has been added

to the mlx5e_priv structure to track its usage. Because the send tag resides
in the mlx5e_channel structure, there is no need to wait for refcounts to 
reach
zero until the mlx4en(4) driver is detached. The channels structure is 
persistant
during the lifetime of the mlx5en(4) driver it belongs to and can so be 
accessed
without any need of synchronization.

The mlx5e_snd_tag structure was extended to contain a type field, because there are now

two different tag types which end up in the driver which need to be 
distinguished.

Submitted by:   hselasky@

Approved by:hselasky (mentor)
MFC after:  1 week
Sponsored by:   Mellanox Technologies
@@ -587,27 +609,33 @@ mlx5e_xmit(struct ifnet *ifp, struct mbuf *mb)
struct mlx5e_sq *sq;
int ret;
   
-	sq = mlx5e_select_queue(ifp, mb);

-   if (unlikely(sq == NULL)) {
-#ifdef RATELIMIT
-   /* Check for route change */
-   if (mb->m_pkthdr.snd_tag != NULL &&
-   mb->m_pkthdr.snd_tag->ifp != ifp) {
+   if (mb->m_pkthdr.snd_tag != NULL) {
+   sq = mlx5e_select_queue_by_send_tag(ifp, mb);
+   if (unlikely(sq == NULL)) {
+   /* Check for route change */
+   if (mb->m_pkthdr.snd_tag->ifp != ifp) {
+   /* Free mbuf */
+   m_freem(mb);
+
+   /*
+* Tell upper layers about route
+* change and to re-transmit this
+* packet:
+*/
+   return (EAGAIN);
+   }


Hi,

I just discovered something strange and found that this commit is the
cause.
The test system has mlx5en 100G interface. It has two vlans: vlan500 and
vlan100.
Via vlan500 it receives some packets flows. Then it routes these packets
into vlan100.
But packets are dropped in mlx5e_xmit() with EAGAIN error code.

# dtrace -n 'fbt::ip6_output:return {printf("%d", arg1);}'
dtrace: description 'fbt::ip6_output:return ' matched 1 probe
CPU IDFUNCTION:NAME
   23  54338ip6_output:return 35
   16  54338ip6_output:return 35
   21  54338ip6_output:return 35
   22  54338ip6_output:return 35
   24  54338ip6_output:return 35
   23  54338ip6_output:return 35
   14  54338ip6_output:return 35
^C

# dtrace -n 'fbt::mlx5e_xmit:return {printf("%d", arg1);}'
dtrace: description 'fbt::mlx5e_xmit:return ' matched 1 probe
CPU IDFUNCTION:NAME
   16  69030mlx5e_xmit:return 35
   23  69030mlx5e_xmit:return 35
   26  69030mlx5e_xmit:return 35
   25  69030mlx5e_xmit:return 35
   24  69030mlx5e_xmit:return 35
   21  69030mlx5e_xmit:return 35
   26  69030mlx5e_xmit:return 35
^C

The kernel config is GENERIC.
13.0-CURRENT #9 r345758+82f3d57(svn_head)-dirty



Hi,

This might be a case where rcvif in the mbuf's pktheader is not cleared
before the packet is fed back on the wire.

John Baldwin is working on the send tags implementation, to eliminate
the EAGAIN handling in the network drivers.


I will try to push this branch sooner then since it affects more than just
TLS.  Part of the change includes a new flag we can use to assert that we

Thanks John!

aren't just getting a stale rcvif (though there are also now assertions in
ip_output that should catch this case I think).





Hi Andrey,

Yes, we were able to reproduce this issue in house. If you don't mind, I 
prefer to wait for John's update - where he eliminates the EAGAIN 
handling in the network drivers.



Slava
___
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: r346645 - in head/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src sys

2019-04-25 Thread Li-Wen Hsu
On Thu, Apr 25, 2019 at 5:31 AM Tycho Nightingale  wrote:
>
> Author: tychon
> Date: Wed Apr 24 20:30:45 2019
> New Revision: 346645
> URL: https://svnweb.freebsd.org/changeset/base/346645
...
> Modified: head/sys/compat/linuxkpi/common/src/linux_pci.c
> ==
> --- head/sys/compat/linuxkpi/common/src/linux_pci.c Wed Apr 24 19:56:02 
> 2019(r346644)
> +++ head/sys/compat/linuxkpi/common/src/linux_pci.c Wed Apr 24 20:30:45 
> 2019(r346645)
...
> +PCTRIE_DEFINE(LINUX_DMA, linux_dma_obj, dma_addr, linux_dma_trie_alloc,
> +linux_dma_trie_free);

Here we got errors in build on 32-bit platforms use gcc:

/usr/src/sys/compat/linuxkpi/common/src/linux_pci.c:456:1: error:
static_assert failed due to requirement 'sizeof (((struct
linux_dma_obj *)0)->dma_addr) == sizeof(unsigned long long)'
"compile-time assertion failed"
PCTRIE_DEFINE(LINUX_DMA, linux_dma_obj, dma_addr, linux_dma_trie_alloc,
^~~
/usr/src/sys/sys/pctrie.h:41:10: note: expanded from macro 'PCTRIE_DEFINE'
\
^
/usr/src/sys/sys/systm.h:120:21: note: expanded from macro '\
CTASSERT'
#define CTASSERT(x) _Static_assert(x, "compile-time assertion failed")
^  ~
/usr/src/sys/compat/linuxkpi/common/src/linux_pci.c:456:1: error:
incompatible pointer types returning 'dma_addr_t *' (aka 'unsigned int
*') from a function with result type 'uint64_t *' (aka 'unsigned long
long *') [-Werror,-Wincompatible-pointer-types]
PCTRIE_DEFINE(LINUX_DMA, linux_dma_obj, dma_addr, linux_dma_trie_alloc,
^~~
/usr/src/sys/sys/pctrie.h:63:9: note: expanded from macro 'PCTRIE_DEFINE'
return >field; \
   ^~~
2 errors generated.
*** [linux_pci.o] Error code 1

make[4]: stopped in /usr/src/sys/modules/linuxkpi

Can you check this?  Full build log is available at:
https://ci.freebsd.org/job/FreeBSD-head-armv7-build/4250/console

Thanks,
Li-Wen
___
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"