svn commit: r362042 - head/sys/dev/iicbus

2020-06-10 Thread Andriy Gapon
Author: avg
Date: Thu Jun 11 05:34:31 2020
New Revision: 362042
URL: https://svnweb.freebsd.org/changeset/base/362042

Log:
  iicbb: rebuild the bit-banging algorithms using different primitives
  
  I2C_SET was quite inflexible, it used too long delays as well as some
  unnecessary delays.  The new building blocks are iicbb_clockin and
  iicbb_clockout.  The former sets SDA and starts the high period of SCL,
  the latter executes the low period of SCL.  What happens during the high
  phase depends on the operation.  For writes we just hold both lines, for
  reads we poll SDA.  S, Sr and P change SDA in the middle of the high
  period.
  
  Also, the calculation of udelay has been updated, so that the resulting
  period more closely corresponds the requested bus frequency.  There is a
  new knob, io_delay, that allows to further adjust udelay based on the
  estimated latency of pin toggling operations.
  
  Finally, I slightly changed debug tracing and added error indicators to
  it.  The debug prints are compiled in but disabled by default.  This can
  be of use if there is any fallout from this change.
  
  Some ideas for further improvements:
  - add a function for sub-microsecond delays (e.g., in units of 1/10th of
a microsecond) and use it for more precise timing of short delays;
  - account for the actual time spent in the pin I/O.
  
  Some sample debug output with the new code follows.
  
  Reading temperature and humidity from HTU21 in the bus hold mode:
<>
<>
  where '<<' is S, '<' is Sr, '>>' is P, '.' is one millisecond of clock
  stretching by the slave.
  
  Reading temperature and humidity in the no-hold mode:
<>
<>
<>
<>
<>
<>
  where '+' is Ack and '-' is NoAck.
  We see that first read attempts are not acknowledged.
  
  MFC after:4 weeks
  Differential Revision: https://reviews.freebsd.org/D22206

Modified:
  head/sys/dev/iicbus/iicbb.c

Modified: head/sys/dev/iicbus/iicbb.c
==
--- head/sys/dev/iicbus/iicbb.c Thu Jun 11 05:28:08 2020(r362041)
+++ head/sys/dev/iicbus/iicbb.c Thu Jun 11 05:34:31 2020(r362042)
@@ -75,6 +75,7 @@ __FBSDID("$FreeBSD$");
 struct iicbb_softc {
device_t iicbus;
u_int udelay;   /* signal toggle delay in usec */
+   u_int io_latency;   /* approximate pin toggling latency */
u_int scl_low_timeout;
 };
 
@@ -86,6 +87,7 @@ static int iicbb_probe(device_t);
 
 static int iicbb_callback(device_t, int, caddr_t);
 static int iicbb_start(device_t, u_char, int);
+static int iicbb_repstart(device_t, u_char, int);
 static int iicbb_stop(device_t);
 static int iicbb_write(device_t, const char *, int, int *, int);
 static int iicbb_read(device_t, char *, int, int *, int, int);
@@ -109,7 +111,7 @@ static device_method_t iicbb_methods[] = {
/* iicbus interface */
DEVMETHOD(iicbus_callback,  iicbb_callback),
DEVMETHOD(iicbus_start, iicbb_start),
-   DEVMETHOD(iicbus_repeated_start, iicbb_start),
+   DEVMETHOD(iicbus_repeated_start, iicbb_repstart),
DEVMETHOD(iicbus_stop,  iicbb_stop),
DEVMETHOD(iicbus_write, iicbb_write),
DEVMETHOD(iicbus_read,  iicbb_read),
@@ -160,6 +162,11 @@ iicbb_attach(device_t dev)
SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO,
"scl_low_timeout", CTLFLAG_RWTUN, >scl_low_timeout,
0, "SCL low timeout, microseconds");
+   SYSCTL_ADD_UINT(device_get_sysctl_ctx(dev),
+   SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO,
+   "io_latency", CTLFLAG_RWTUN, >io_latency,
+   0, "Estimate of pin toggling latency, microseconds");
+
bus_generic_attach(dev);
return (0);
 }
@@ -217,80 +224,105 @@ iicbb_print_child(device_t bus, device_t dev)
return (retval);
 }
 
+#define IICBB_DEBUG
+#ifdef IICBB_DEBUG
+static int i2c_debug = 0;
+
+static SYSCTL_NODE(_hw, OID_AUTO, i2c, CTLFLAG_RW, 0, "i2c debug");
+SYSCTL_INT(_hw_i2c, OID_AUTO, iicbb_debug, CTLFLAG_RWTUN,
+_debug, 0, "Enable i2c bit-banging driver debug");
+
+#define I2C_DEBUG(x)   do {\
+   if (i2c_debug) (x); \
+   } while (0)
+#else
+#define I2C_DEBUG(x)
+#endif
+
 #defineI2C_GETSDA(dev) (IICBB_GETSDA(device_get_parent(dev)))
 #defineI2C_SETSDA(dev, x)  (IICBB_SETSDA(device_get_parent(dev), 
x))
 #defineI2C_GETSCL(dev) (IICBB_GETSCL(device_get_parent(dev)))
 #defineI2C_SETSCL(dev, x)  (IICBB_SETSCL(device_get_parent(dev), 
x))
 
-#define I2C_SET(sc, dev, ctrl, val) do {   \
-   iicbb_setscl(dev, ctrl);\
-   I2C_SETSDA(dev, val);   \
-   DELAY(sc->udelay);  \
-   } while (0)
-
-static int i2c_debug = 0;
-#define I2C_DEBUG(x)   do {

svn commit: r362039 - head/usr.bin/sed/tests

2020-06-10 Thread Mateusz Piotrowski
Author: 0mp (doc,ports committer)
Date: Thu Jun 11 03:03:52 2020
New Revision: 362039
URL: https://svnweb.freebsd.org/changeset/base/362039

Log:
  Remove duplicate lines from sed tests
  
  Reported by:  yuripv
  Approved by:  pfg (src)
  MFC after:2 weeks
  X-MFC-With:   362017

Modified:
  head/usr.bin/sed/tests/sed2_test.sh

Modified: head/usr.bin/sed/tests/sed2_test.sh
==
--- head/usr.bin/sed/tests/sed2_test.sh Thu Jun 11 00:36:35 2020
(r362038)
+++ head/usr.bin/sed/tests/sed2_test.sh Thu Jun 11 03:03:52 2020
(r362039)
@@ -177,7 +177,5 @@ atf_init_test_cases()
atf_add_test_case inplace_symlink_src
atf_add_test_case escape_subst
atf_add_test_case commands_on_stdin
-   atf_add_test_case commands_on_stdin
-   atf_add_test_case commands_on_stdin
atf_add_test_case hex_subst
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r360233 - in head: contrib/jemalloc . . . : This partially breaks a 2-socket 32-bit powerpc (old PowerMac G4) based on head -r360311

2020-06-10 Thread Mark Millard via svn-src-head



On 2020-May-13, at 08:56, Justin Hibbits  wrote:

> Hi Mark,

Hello Justin.

> On Wed, 13 May 2020 01:43:23 -0700
> Mark Millard  wrote:
> 
>> [I'm adding a reference to an old arm64/aarch64 bug that had
>> pages turning to zero, in case this 32-bit powerpc issue is
>> somewhat analogous.]
>> 
>>> . . .
> ...
>> . . .
>> 
>> (Note: dsl-only.net closed down, so the E-mail
>> address reference is no longer valid.)
>> 
>> Author: kib
>> Date: Mon Apr 10 15:32:26 2017
>> New Revision: 316679
>> URL: 
>> https://svnweb.freebsd.org/changeset/base/316679
>> 
>> 
>> Log:
>> Do not lose dirty bits for removing PROT_WRITE on arm64.
>> 
>> Arm64 pmap interprets accessed writable ptes as modified, since
>> ARMv8.0 does not track Dirty Bit Modifier in hardware. If writable
>> bit is removed, page must be marked as dirty for MI VM.
>> 
>> This change is most important for COW, where fork caused losing
>> content of the dirty pages which were not yet scanned by pagedaemon.
>> 
>> Reviewed by: alc, andrew
>> Reported and tested by:  Mark Millard 
>> PR:  217138, 217239
>> Sponsored by:The FreeBSD Foundation
>> MFC after:   2 weeks
>> 
>> Modified:
>> head/sys/arm64/arm64/pmap.c
>> 
>> Modified: head/sys/arm64/arm64/pmap.c
>> ==
>> --- head/sys/arm64/arm64/pmap.c  Mon Apr 10 12:35:58
>> 2017 (r316678) +++ head/sys/arm64/arm64/pmap.c   Mon Apr
>> 10 15:32:26 2017 (r316679) @@ -2481,6 +2481,11 @@
>> pmap_protect(pmap_t pmap, vm_offset_t sv sva += L3_SIZE) {
>>  l3 = pmap_load(l3p);
>>  if (pmap_l3_valid(l3)) {
>> +if ((l3 & ATTR_SW_MANAGED) &&
>> +pmap_page_dirty(l3)) {
>> +
>> vm_page_dirty(PHYS_TO_VM_PAGE(l3 &
>> +~ATTR_MASK));
>> +}
>>  pmap_set(l3p, ATTR_AP(ATTR_AP_RO));
>>  PTE_SYNC(l3p);
>>  /* XXX: Use pmap_invalidate_range */
>> 
>> . . .
>> 
> 
> Thanks for this reference.  I took a quick look at the 3 pmap
> implementations we have (haven't check the new radix pmap yet), and it
> looks like only mmu_oea.c (32-bit AIM pmap, for G3 and G4) is missing
> vm_page_dirty() calls in its pmap_protect() implementation, analogous
> to the change you posted right above. Given this, I think it's safe to
> say that this missing piece is necessary.  We'll work on a fix for
> this; looking at moea64_protect(), there may be additional work needed
> to support this as well, so it may take a few days.

Ping? Any clue when the above might happen?

I've been avoiding the old PowerMacs and leaving
them at head -r360311 , pending an update that
would avoid the kernel zeroing pages that it
should not zero. But I've seen that you were busy
with more modern contexts this last about a month.

And, clearly, my own context has left pending
(for much longer) other more involved activities
(compared to just periodically updating to
more recent FreeBSD vintages).

===
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)

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


svn commit: r362038 - head/sys/modules/ice_ddp

2020-06-10 Thread Mark Johnston
Author: markj
Date: Thu Jun 11 00:36:35 2020
New Revision: 362038
URL: https://svnweb.freebsd.org/changeset/base/362038

Log:
  Hard-code the ice_ddp firmware version.
  
  Like every other firmware image in the tree, the makefile will need to
  be updated to point to the newest import.
  
  Reviewed by:  erj, imp (previous version)
  Differential Revision:https://reviews.freebsd.org/D25222

Modified:
  head/sys/modules/ice_ddp/Makefile

Modified: head/sys/modules/ice_ddp/Makefile
==
--- head/sys/modules/ice_ddp/Makefile   Wed Jun 10 23:52:50 2020
(r362037)
+++ head/sys/modules/ice_ddp/Makefile   Thu Jun 11 00:36:35 2020
(r362038)
@@ -1,24 +1,6 @@
 # $FreeBSD$
 
-# Find the highest version DDP package file and build a .ko for it
-PKG_FILE != find ${SRCTOP}/sys/contrib/dev/ice -name 'ice-*.pkg' | sort -V | 
tail -1
+KMOD=  ice_ddp
+FIRMWS=${SRCTOP}/sys/contrib/dev/ice/ice-1.3.9.0.pkg:ice_ddp:0x01030900
 
-.if empty(PKG_FILE)
-.error Unable to locate the DDP package binary file
-.endif
-
-.info Found ${PKG_FILE}
-
-PKG_NAME != basename ${PKG_FILE}
-PKG_VER_STR != basename -s .pkg ${PKG_NAME}
-PKG_VER_STR := ${PKG_VER_STR:S/^ice-//}
-PKG_VER_STR := ${PKG_VER_STR:S/-signed$//}
-PKG_VER_MAJ != echo ${PKG_VER_STR} | cut -d. -f1
-PKG_VER_MIN != echo ${PKG_VER_STR} | cut -d. -f2
-PKG_VER_UPD != echo ${PKG_VER_STR} | cut -d. -f3
-PKG_VER_DFT != echo ${PKG_VER_STR} | cut -d. -f4
-PKG_VERSION != printf "0x%02x%02x%02x%02x" "${PKG_VER_MAJ}" "${PKG_VER_MIN}" 
"${PKG_VER_UPD}" "${PKG_VER_DFT}"
-
-KMOD := ice_ddp
-FIRMWS := ${PKG_FILE}:ice_ddp:${PKG_VERSION}
 .include 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362037 - head/sys/compat/linux

2020-06-10 Thread Mark Johnston
Author: markj
Date: Wed Jun 10 23:52:50 2020
New Revision: 362037
URL: https://svnweb.freebsd.org/changeset/base/362037

Log:
  Fix a couple of nits in Linux sysinfo(2) emulation.
  
  - Use the same definition of free memory as Linux.
  - Rename the totalbig and freebig fields to match the corresponding
names on Linux.
  
  Discussed with:   alc
  MFC after:1 week

Modified:
  head/sys/compat/linux/linux_misc.c

Modified: head/sys/compat/linux/linux_misc.c
==
--- head/sys/compat/linux/linux_misc.c  Wed Jun 10 23:52:39 2020
(r362036)
+++ head/sys/compat/linux/linux_misc.c  Wed Jun 10 23:52:50 2020
(r362037)
@@ -132,8 +132,8 @@ struct l_sysinfo {
l_ulong freeswap;   /* swap space still available */
l_ushortprocs;  /* Number of current processes */
l_ushortpads;
-   l_ulong totalbig;
-   l_ulong freebig;
+   l_ulong totalhigh;
+   l_ulong freehigh;
l_uint  mem_unit;
char_f[20-2*sizeof(l_long)-sizeof(l_int)];  /* padding */
 };
@@ -165,7 +165,7 @@ linux_sysinfo(struct thread *td, struct linux_sysinfo_
LINUX_SYSINFO_LOADS_SCALE / averunnable.fscale;
 
sysinfo.totalram = physmem * PAGE_SIZE;
-   sysinfo.freeram = sysinfo.totalram - vm_wire_count() * PAGE_SIZE;
+   sysinfo.freeram = (u_long)vm_free_count() * PAGE_SIZE;
 
/*
 * sharedram counts pages allocated to named, swap-backed objects such
@@ -182,9 +182,13 @@ linux_sysinfo(struct thread *td, struct linux_sysinfo_
 
sysinfo.procs = nprocs;
 
-   /* The following are only present in newer Linux kernels. */
-   sysinfo.totalbig = 0;
-   sysinfo.freebig = 0;
+   /*
+* Platforms supported by the emulation layer do not have a notion of
+* high memory.
+*/
+   sysinfo.totalhigh = 0;
+   sysinfo.freehigh = 0;
+
sysinfo.mem_unit = 1;
 
return (copyout(, args->info, sizeof(sysinfo)));
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362036 - head/sys/compat/linux

2020-06-10 Thread Mark Johnston
Author: markj
Date: Wed Jun 10 23:52:39 2020
New Revision: 362036
URL: https://svnweb.freebsd.org/changeset/base/362036

Log:
  Add a comment reflecting the commit log for r361945.
  
  Suggested by: alc
  Reviewed by:  alc
  MFC with: r361945

Modified:
  head/sys/compat/linux/linux_misc.c

Modified: head/sys/compat/linux/linux_misc.c
==
--- head/sys/compat/linux/linux_misc.c  Wed Jun 10 23:52:29 2020
(r362035)
+++ head/sys/compat/linux/linux_misc.c  Wed Jun 10 23:52:39 2020
(r362036)
@@ -167,6 +167,12 @@ linux_sysinfo(struct thread *td, struct linux_sysinfo_
sysinfo.totalram = physmem * PAGE_SIZE;
sysinfo.freeram = sysinfo.totalram - vm_wire_count() * PAGE_SIZE;
 
+   /*
+* sharedram counts pages allocated to named, swap-backed objects such
+* as shared memory segments and tmpfs files.  There is no cheap way to
+* compute this, so just leave the field unpopulated.  Linux itself only
+* started setting this field in the 3.x timeframe.
+*/
sysinfo.sharedram = 0;
sysinfo.bufferram = 0;
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362035 - head/sys/kern

2020-06-10 Thread Mark Johnston
Author: markj
Date: Wed Jun 10 23:52:29 2020
New Revision: 362035
URL: https://svnweb.freebsd.org/changeset/base/362035

Log:
  Remove the FIRMWARE_MAX limit.
  
  The firmware module arbitrarily limits us to at most 50 images.  It is
  possible to hit this limit on platforms that preload many firmware
  images, or link all of the firmware images for a set of devices into the
  kernel.
  
  Convert the table into a linked list, removing the limit.
  
  Reported by:  Steve Wheeler
  Reviewed by:  rpokala
  MFC after:1 week
  Sponsored by: Rubicon Communications, LLC (Netgate)
  Differential Revision:https://reviews.freebsd.org/D25161

Modified:
  head/sys/kern/subr_firmware.c

Modified: head/sys/kern/subr_firmware.c
==
--- head/sys/kern/subr_firmware.c   Wed Jun 10 23:03:35 2020
(r362034)
+++ head/sys/kern/subr_firmware.c   Wed Jun 10 23:52:29 2020
(r362035)
@@ -53,12 +53,10 @@ __FBSDID("$FreeBSD$");
  * form more details on the subsystem.
  *
  * 'struct firmware' is the user-visible part of the firmware table.
- * Additional internal information is stored in a 'struct priv_fw'
- * (currently a static array). A slot is in use if FW_INUSE is true:
+ * Additional internal information is stored in a 'struct priv_fw',
+ * which embeds the public firmware structure.
  */
 
-#define FW_INUSE(p)((p)->file != NULL || (p)->fw.name != NULL)
-
 /*
  * fw.name != NULL when an image is registered; file != NULL for
  * autoloaded images whose handling has not been completed.
@@ -82,6 +80,7 @@ __FBSDID("$FreeBSD$");
 
 struct priv_fw {
int refcnt; /* reference count */
+   LIST_ENTRY(priv_fw) link;   /* table linkage */
 
/*
 * parent entry, see above. Set on firmware_register(),
@@ -118,13 +117,9 @@ struct priv_fw {
((intptr_t)(x) - offsetof(struct priv_fw, fw)) )
 
 /*
- * At the moment we use a static array as backing store for the registry.
- * Should we move to a dynamic structure, keep in mind that we cannot
- * reallocate the array because pointers are held externally.
- * A list may work, though.
+ * Global firmware image registry.
  */
-#defineFIRMWARE_MAX50
-static struct priv_fw firmware_table[FIRMWARE_MAX];
+static LIST_HEAD(, priv_fw) firmware_table;
 
 /*
  * Firmware module operations are handled in a separate task as they
@@ -139,6 +134,8 @@ static struct task firmware_unload_task;
 static struct mtx firmware_mtx;
 MTX_SYSINIT(firmware, _mtx, "firmware table", MTX_DEF);
 
+static MALLOC_DEFINE(M_FIRMWARE, "firmware", "device firmware images");
+
 /*
  * Helper function to lookup a name.
  * As a side effect, it sets the pointer to a free slot, if any.
@@ -147,23 +144,17 @@ MTX_SYSINIT(firmware, _mtx, "firmware table",
  * with some other data structure.
  */
 static struct priv_fw *
-lookup(const char *name, struct priv_fw **empty_slot)
+lookup(const char *name)
 {
-   struct priv_fw *fp = NULL;
-   struct priv_fw *dummy;
-   int i;
+   struct priv_fw *fp;
 
-   if (empty_slot == NULL)
-   empty_slot = 
-   *empty_slot = NULL;
-   for (i = 0; i < FIRMWARE_MAX; i++) {
-   fp = _table[i];
+   mtx_assert(_mtx, MA_OWNED);
+
+   LIST_FOREACH(fp, _table, link) {
if (fp->fw.name != NULL && strcasecmp(name, fp->fw.name) == 0)
break;
-   else if (!FW_INUSE(fp))
-   *empty_slot = fp;
}
-   return (i < FIRMWARE_MAX ) ? fp : NULL;
+   return (fp);
 }
 
 /*
@@ -176,42 +167,42 @@ const struct firmware *
 firmware_register(const char *imagename, const void *data, size_t datasize,
 unsigned int version, const struct firmware *parent)
 {
-   struct priv_fw *match, *frp;
-   char *str;
+   struct priv_fw *frp;
+   char *name;
 
-   str = strdup(imagename, M_TEMP);
-
mtx_lock(_mtx);
-   /*
-* Do a lookup to make sure the name is unique or find a free slot.
-*/
-   match = lookup(imagename, );
-   if (match != NULL) {
+   frp = lookup(imagename);
+   if (frp != NULL) {
mtx_unlock(_mtx);
printf("%s: image %s already registered!\n",
-   __func__, imagename);
-   free(str, M_TEMP);
-   return NULL;
+   __func__, imagename);
+   return (NULL);
}
-   if (frp == NULL) {
+   mtx_unlock(_mtx);
+
+   frp = malloc(sizeof(*frp), M_FIRMWARE, M_WAITOK | M_ZERO);
+   name = strdup(imagename, M_FIRMWARE);
+
+   mtx_lock(_mtx);
+   if (lookup(imagename) != NULL) {
+   /* We lost a race. */
mtx_unlock(_mtx);
-   printf("%s: cannot register image %s, firmware table full!\n",
-   __func__, imagename);
-   free(str, M_TEMP);
-   return 

Re: svn commit: r362017 - in head/usr.bin/sed: . tests

2020-06-10 Thread Mateusz Piotrowski
On 6/10/20 11:44 PM, Yuri Pankov wrote:
> Mateusz Piotrowski wrote:
>> Author: 0mp (doc,ports committer)
>> Date: Wed Jun 10 19:23:58 2020
>> New Revision: 362017
>> URL: https://svnweb.freebsd.org/changeset/base/362017
>>
>> Log:
>>    Read commands from stdin when -f - is passed to sed(1)
[...]
>> Modified: head/usr.bin/sed/tests/sed2_test.sh
[...]
>>   atf_init_test_cases()
>>   {
>>   atf_add_test_case inplace_command_q
>>   atf_add_test_case inplace_hardlink_src
>>   atf_add_test_case inplace_symlink_src
>>   atf_add_test_case escape_subst
>> +    atf_add_test_case commands_on_stdin
>> +    atf_add_test_case commands_on_stdin
>> +    atf_add_test_case commands_on_stdin
>>   atf_add_test_case hex_subst
>>   }
>>
>
> Am I reading it wrong, or is it the same test case added 3 times?

Sigh, yes, it does not make any sense. Thanks for spotting.

Removing those 2 extra lines should do, right? Can I commit it?

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


Re: svn commit: r362017 - in head/usr.bin/sed: . tests

2020-06-10 Thread Mateusz Piotrowski
Hi,

On 6/11/20 12:06 AM, Steffen Nurpmeso wrote:
> Yuri Pankov wrote in
> :
>  |Mateusz Piotrowski wrote:
>  |> Author: 0mp (doc,ports committer)
>  |> Date: Wed Jun 10 19:23:58 2020
>  |> New Revision: 362017
>  |> URL: https://svnweb.freebsd.org/changeset/base/362017
>  |> 
>  |> Log:
>  |>Read commands from stdin when -f - is passed to sed(1)
>  ..
>  |Am I reading it wrong, or is it the same test case added 3 times?
>
> It also used "Fl f Cm -" instead of "Fl f Ar -".  Just saying..
Which is correct. "-" is not a variable here. It is a fixed string hence
the use of Cm.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362034 - head/sys/powerpc/booke

2020-06-10 Thread Justin Hibbits
Author: jhibbits
Date: Wed Jun 10 23:03:35 2020
New Revision: 362034
URL: https://svnweb.freebsd.org/changeset/base/362034

Log:
  powerpc/pmap: Fix pte_find_next() iterators for booke64 pmap
  
  After r361988 fixed the reference count leak on booke64, it became possible
  for an iteration somewhere in the middle of a page to become stale, with the
  page vanishing (correctly) due to all PTEs on that page going away.
  pte_find_next() would start at that iterator, and move along 'higher' order
  directory pages until it finds a valid one, without zeroing out the lower
  order pages.  For instance:
  
/* Find next pte at or above 0x10002000. */
pte = pte_find_next(pmap, &(0x10002000));
pte_remove(pmap, pte);
/* This pte was the last reference in the page table page, page is
 * gone.
 */
pte = pte_find_next(pmap, 0x10002000);
/* pte_find_next will see 0x10002000's page is gone, and jump to the
 * next one, but starting iteration at the '0x2000' slot, skipping
 * 0x and 0x1000.
 */
  
  This caused some processes, like git, to trip the KASSERT() in
  pmap_release().
  
  Fix this by zeroing all lower order iterators at each level.

Modified:
  head/sys/powerpc/booke/pmap_64.c

Modified: head/sys/powerpc/booke/pmap_64.c
==
--- head/sys/powerpc/booke/pmap_64.cWed Jun 10 22:30:32 2020
(r362033)
+++ head/sys/powerpc/booke/pmap_64.cWed Jun 10 23:03:35 2020
(r362034)
@@ -220,12 +220,13 @@ pte_find_next(pmap_t pmap, vm_offset_t *pva)
k = PDIR_IDX(va);
l = PTBL_IDX(va);
pm_root = pmap->pm_root;
+
/* truncate the VA for later. */
va &= ~((1UL << (PG_ROOT_H + 1)) - 1);
-   for (; i < PG_ROOT_NENTRIES; i++, j = 0) {
+   for (; i < PG_ROOT_NENTRIES; i++, j = 0, k = 0, l = 0) {
if (pm_root[i] == 0)
continue;
-   for (; j < PDIR_L1_NENTRIES; j++, k = 0) {
+   for (; j < PDIR_L1_NENTRIES; j++, k = 0, l = 0) {
if (pm_root[i][j] == 0)
continue;
for (; k < PDIR_NENTRIES; k++, l = 0) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362033 - in head/sys: dev/acpica dev/xen/control kern

2020-06-10 Thread Konstantin Belousov
Author: kib
Date: Wed Jun 10 22:30:32 2020
New Revision: 362033
URL: https://svnweb.freebsd.org/changeset/base/362033

Log:
  Remove double-calls to tc_get_timecount() to warm timecounters.
  
  It seems that second call does not add any useful state change for all
  implemented timecounters.
  
  Discussed with:   bde
  Sponsored by: The FreeBSD Foundation
  MFC after:3 weeks

Modified:
  head/sys/dev/acpica/acpi.c
  head/sys/dev/acpica/acpi_timer.c
  head/sys/dev/xen/control/control.c
  head/sys/kern/kern_tc.c

Modified: head/sys/dev/acpica/acpi.c
==
--- head/sys/dev/acpica/acpi.c  Wed Jun 10 22:13:24 2020(r362032)
+++ head/sys/dev/acpica/acpi.c  Wed Jun 10 22:30:32 2020(r362033)
@@ -3220,7 +3220,6 @@ acpi_resync_clock(struct acpi_softc *sc)
  * Warm up timecounter again and reset system clock.
  */
 (void)timecounter->tc_get_timecount(timecounter);
-(void)timecounter->tc_get_timecount(timecounter);
 inittodr(time_second + sc->acpi_sleep_delay);
 }
 

Modified: head/sys/dev/acpica/acpi_timer.c
==
--- head/sys/dev/acpica/acpi_timer.cWed Jun 10 22:13:24 2020
(r362032)
+++ head/sys/dev/acpica/acpi_timer.cWed Jun 10 22:30:32 2020
(r362033)
@@ -274,7 +274,6 @@ acpi_timer_resume_handler(struct timecounter *newtc)
"restoring timecounter, %s -> %s\n",
tc->tc_name, newtc->tc_name);
(void)newtc->tc_get_timecount(newtc);
-   (void)newtc->tc_get_timecount(newtc);
timecounter = newtc;
}
 }

Modified: head/sys/dev/xen/control/control.c
==
--- head/sys/dev/xen/control/control.c  Wed Jun 10 22:13:24 2020
(r362032)
+++ head/sys/dev/xen/control/control.c  Wed Jun 10 22:30:32 2020
(r362033)
@@ -303,7 +303,6 @@ xctrl_suspend()
 * Warm up timecounter again and reset system clock.
 */
timecounter->tc_get_timecount(timecounter);
-   timecounter->tc_get_timecount(timecounter);
inittodr(time_second);
 
 #ifdef EARLY_AP_STARTUP

Modified: head/sys/kern/kern_tc.c
==
--- head/sys/kern/kern_tc.c Wed Jun 10 22:13:24 2020(r362032)
+++ head/sys/kern/kern_tc.c Wed Jun 10 22:30:32 2020(r362033)
@@ -1206,7 +1206,6 @@ tc_init(struct timecounter *tc)
tc->tc_frequency < timecounter->tc_frequency)
return;
(void)tc->tc_get_timecount(tc);
-   (void)tc->tc_get_timecount(tc);
timecounter = tc;
 }
 
@@ -1469,7 +1468,6 @@ sysctl_kern_timecounter_hardware(SYSCTL_HANDLER_ARGS)
 
/* Warm up new timecounter. */
(void)newtc->tc_get_timecount(newtc);
-   (void)newtc->tc_get_timecount(newtc);
 
timecounter = newtc;
 
@@ -1962,7 +1960,6 @@ inittimecounter(void *dummy)
 #endif
 
/* warm up new timecounter (again) and get rolling. */
-   (void)timecounter->tc_get_timecount(timecounter);
(void)timecounter->tc_get_timecount(timecounter);
mtx_lock_spin(_setclock_mtx);
tc_windup(NULL);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r362017 - in head/usr.bin/sed: . tests

2020-06-10 Thread Steffen Nurpmeso
Yuri Pankov wrote in
:
 |Mateusz Piotrowski wrote:
 |> Author: 0mp (doc,ports committer)
 |> Date: Wed Jun 10 19:23:58 2020
 |> New Revision: 362017
 |> URL: https://svnweb.freebsd.org/changeset/base/362017
 |> 
 |> Log:
 |>Read commands from stdin when -f - is passed to sed(1)
 ..
 |Am I reading it wrong, or is it the same test case added 3 times?

It also used "Fl f Cm -" instead of "Fl f Ar -".  Just saying..

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362032 - in head: include lib/libc/include lib/libthr lib/libthr/thread share/man/man3

2020-06-10 Thread Konstantin Belousov
Author: kib
Date: Wed Jun 10 22:13:24 2020
New Revision: 362032
URL: https://svnweb.freebsd.org/changeset/base/362032

Log:
  Add pthread_getname_np() and pthread_setname_np() aliases for
  pthread_get_name_np() and pthread_set_name_np().
  
  This re-applies r361770 after compatibility fixes.
  
  Reviewed by:  antoine, jkim, markj
  Tested by:antoine (exp-run)
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week
  Differential revision:https://reviews.freebsd.org/D25117

Modified:
  head/include/pthread.h
  head/lib/libc/include/namespace.h
  head/lib/libc/include/un-namespace.h
  head/lib/libthr/pthread.map
  head/lib/libthr/thread/thr_info.c
  head/share/man/man3/Makefile
  head/share/man/man3/pthread_set_name_np.3

Modified: head/include/pthread.h
==
--- head/include/pthread.h  Wed Jun 10 22:07:57 2020(r362031)
+++ head/include/pthread.h  Wed Jun 10 22:13:24 2020(r362032)
@@ -301,6 +301,9 @@ voidpthread_testcancel(void);
 intpthread_getprio(pthread_t);
 intpthread_setprio(pthread_t, int);
 void   pthread_yield(void);
+
+intpthread_getname_np(pthread_t, char *, size_t);
+intpthread_setname_np(pthread_t, const char *);
 #endif
 
 intpthread_mutexattr_getprioceiling(

Modified: head/lib/libc/include/namespace.h
==
--- head/lib/libc/include/namespace.h   Wed Jun 10 22:07:57 2020
(r362031)
+++ head/lib/libc/include/namespace.h   Wed Jun 10 22:13:24 2020
(r362032)
@@ -138,6 +138,7 @@
 #definepthread_getaffinity_np  _pthread_getaffinity_np
 #definepthread_getconcurrency  _pthread_getconcurrency
 #definepthread_getcpuclockid   _pthread_getcpuclockid
+#definepthread_getname_np  _pthread_getname_np
 #definepthread_getprio _pthread_getprio
 #definepthread_getschedparam   _pthread_getschedparam
 #definepthread_getspecific _pthread_getspecific
@@ -191,6 +192,7 @@
 #definepthread_setcancelstate  _pthread_setcancelstate
 #definepthread_setcanceltype   _pthread_setcanceltype
 #definepthread_setconcurrency  _pthread_setconcurrency
+#definepthread_setname_np  _pthread_setname_np
 #definepthread_setprio _pthread_setprio
 #definepthread_setschedparam   _pthread_setschedparam
 #definepthread_setspecific _pthread_setspecific

Modified: head/lib/libc/include/un-namespace.h
==
--- head/lib/libc/include/un-namespace.hWed Jun 10 22:07:57 2020
(r362031)
+++ head/lib/libc/include/un-namespace.hWed Jun 10 22:13:24 2020
(r362032)
@@ -119,6 +119,7 @@
 #undef pthread_getaffinity_np
 #undef pthread_getconcurrency
 #undef pthread_getcpuclockid
+#undef pthread_getname_np
 #undef pthread_getprio
 #undef pthread_getschedparam
 #undef pthread_getspecific
@@ -172,6 +173,7 @@
 #undef pthread_setcancelstate
 #undef pthread_setcanceltype
 #undef pthread_setconcurrency
+#undef pthread_setname_np
 #undef pthread_setprio
 #undef pthread_setschedparam
 #undef pthread_setspecific

Modified: head/lib/libthr/pthread.map
==
--- head/lib/libthr/pthread.map Wed Jun 10 22:07:57 2020(r362031)
+++ head/lib/libthr/pthread.map Wed Jun 10 22:13:24 2020(r362032)
@@ -328,5 +328,7 @@ FBSD_1.5 {
 };
 
 FBSD_1.6 {
+pthread_getname_np;
 pthread_peekjoin_np;
+pthread_setname_np;
 };

Modified: head/lib/libthr/thread/thr_info.c
==
--- head/lib/libthr/thread/thr_info.c   Wed Jun 10 22:07:57 2020
(r362031)
+++ head/lib/libthr/thread/thr_info.c   Wed Jun 10 22:13:24 2020
(r362032)
@@ -37,6 +37,7 @@
 __FBSDID("$FreeBSD$");
 
 #include "namespace.h"
+#include 
 #include 
 #include 
 #include 
@@ -45,39 +46,66 @@ __FBSDID("$FreeBSD$");
 
 #include "thr_private.h"
 
-__weak_reference(_pthread_set_name_np, pthread_set_name_np);
-
 static void
-thr_set_name_np(struct pthread *thread, const char *name)
+thr_set_name_np(struct pthread *thread, char **tmp_name)
 {
 
free(thread->name);
-   thread->name = name != NULL ? strdup(name) : NULL;
+   thread->name = *tmp_name;
+   *tmp_name = NULL;
 }
 
-/* Set the thread name for debug. */
-void
-_pthread_set_name_np(pthread_t thread, const 

svn commit: r362031 - in head/sys: amd64/amd64 i386/i386 x86/include x86/x86

2020-06-10 Thread Konstantin Belousov
Author: kib
Date: Wed Jun 10 22:07:57 2020
New Revision: 362031
URL: https://svnweb.freebsd.org/changeset/base/362031

Log:
  amd64 pmap: reorder IPI send and local TLB flush in TLB invalidations.
  
  Right now code first flushes all local TLB entries that needs to be
  flushed, then signals IPI to remote cores, and then waits for
  acknowledgements while spinning idle.  In the VMWare article 'Don’t
  shoot down TLB shootdowns!' it was noted that the time spent spinning
  is lost, and can be more usefully used doing local TLB invalidation.
  
  We could use the same invalidation handler for local TLB as for
  remote, but typically for pmap == curpmap we can use INVLPG for locals
  instead of INVPCID on remotes, since we cannot control context
  switches on them.  Due to that, keep the local code and provide the
  callbacks to be called from smp_targeted_tlb_shootdown() after IPIs
  are fired but before spin wait starts.
  
  Reviewed by:  alc, cem, markj, Anton Rang 
  Tested by:pho
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks
  Differential revision:https://reviews.freebsd.org/D25188

Modified:
  head/sys/amd64/amd64/pmap.c
  head/sys/i386/i386/pmap.c
  head/sys/i386/i386/vm_machdep.c
  head/sys/x86/include/x86_smp.h
  head/sys/x86/x86/mp_x86.c

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Wed Jun 10 22:00:31 2020(r362030)
+++ head/sys/amd64/amd64/pmap.c Wed Jun 10 22:07:57 2020(r362031)
@@ -2591,6 +2591,20 @@ DEFINE_IFUNC(static, void, pmap_invalidate_page_mode, 
return (pmap_invalidate_page_nopcid);
 }
 
+static void
+pmap_invalidate_page_curcpu_cb(pmap_t pmap, vm_offset_t va,
+vm_offset_t addr2 __unused)
+{
+
+   if (pmap == kernel_pmap) {
+   invlpg(va);
+   } else {
+   if (pmap == PCPU_GET(curpmap))
+   invlpg(va);
+   pmap_invalidate_page_mode(pmap, va);
+   }
+}
+
 void
 pmap_invalidate_page(pmap_t pmap, vm_offset_t va)
 {
@@ -2603,16 +2617,8 @@ pmap_invalidate_page(pmap_t pmap, vm_offset_t va)
KASSERT(pmap->pm_type == PT_X86,
("pmap_invalidate_page: invalid type %d", pmap->pm_type));
 
-   sched_pin();
-   if (pmap == kernel_pmap) {
-   invlpg(va);
-   } else {
-   if (pmap == PCPU_GET(curpmap))
-   invlpg(va);
-   pmap_invalidate_page_mode(pmap, va);
-   }
-   smp_masked_invlpg(pmap_invalidate_cpu_mask(pmap), va, pmap);
-   sched_unpin();
+   smp_masked_invlpg(pmap_invalidate_cpu_mask(pmap), va, pmap,
+   pmap_invalidate_page_curcpu_cb);
 }
 
 /* 4k PTEs -- Chosen to exceed the total size of Broadwell L2 TLB */
@@ -2688,10 +2694,26 @@ DEFINE_IFUNC(static, void, pmap_invalidate_range_mode,
return (pmap_invalidate_range_nopcid);
 }
 
+static void
+pmap_invalidate_range_curcpu_cb(pmap_t pmap, vm_offset_t sva, vm_offset_t eva)
+{
+   vm_offset_t addr;
+
+   if (pmap == kernel_pmap) {
+   for (addr = sva; addr < eva; addr += PAGE_SIZE)
+   invlpg(addr);
+   } else {
+   if (pmap == PCPU_GET(curpmap)) {
+   for (addr = sva; addr < eva; addr += PAGE_SIZE)
+   invlpg(addr);
+   }
+   pmap_invalidate_range_mode(pmap, sva, eva);
+   }
+}
+
 void
 pmap_invalidate_range(pmap_t pmap, vm_offset_t sva, vm_offset_t eva)
 {
-   vm_offset_t addr;
 
if (eva - sva >= PMAP_INVLPG_THRESHOLD) {
pmap_invalidate_all(pmap);
@@ -2706,19 +2728,8 @@ pmap_invalidate_range(pmap_t pmap, vm_offset_t sva, vm
KASSERT(pmap->pm_type == PT_X86,
("pmap_invalidate_range: invalid type %d", pmap->pm_type));
 
-   sched_pin();
-   if (pmap == kernel_pmap) {
-   for (addr = sva; addr < eva; addr += PAGE_SIZE)
-   invlpg(addr);
-   } else {
-   if (pmap == PCPU_GET(curpmap)) {
-   for (addr = sva; addr < eva; addr += PAGE_SIZE)
-   invlpg(addr);
-   }
-   pmap_invalidate_range_mode(pmap, sva, eva);
-   }
-   smp_masked_invlpg_range(pmap_invalidate_cpu_mask(pmap), sva, eva, pmap);
-   sched_unpin();
+   smp_masked_invlpg_range(pmap_invalidate_cpu_mask(pmap), sva, eva, pmap,
+   pmap_invalidate_range_curcpu_cb);
 }
 
 static inline void
@@ -2805,6 +2816,14 @@ DEFINE_IFUNC(static, void, pmap_invalidate_all_mode, (
return (pmap_invalidate_all_nopcid);
 }
 
+static void
+pmap_invalidate_all_curcpu_cb(pmap_t pmap, vm_offset_t addr1 __unused,
+vm_offset_t addr2 __unused)
+{
+
+   pmap_invalidate_all_mode(pmap);
+}
+
 void
 pmap_invalidate_all(pmap_t pmap)
 {
@@ -2817,20 +2836,23 @@ pmap_invalidate_all(pmap_t pmap)
KASSERT(pmap->pm_type == PT_X86,
  

svn commit: r362030 - head/sys/arm/freescale/imx

2020-06-10 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Wed Jun 10 22:00:31 2020
New Revision: 362030
URL: https://svnweb.freebsd.org/changeset/base/362030

Log:
  Add mode selection to iMX6 IPU driver
  
  - Configure ipu1_di0 tob e sourced from the VIDEO_PLL(PLL5) and hardcode
frequency to (45500/3)Mhz. This value, further divided, can yield
frequencies close enough to support 1080p, 720p, 1024x768, and 640x480
modes. This is not ideal but it's an improvement comparing to the only
hardcoded 1024x768 mode.
  
  - Fix memory leaks if attach method failed
  - Print EDID when -v passed to the kernel

Modified:
  head/sys/arm/freescale/imx/imx6_ccm.c
  head/sys/arm/freescale/imx/imx6_ccmreg.h
  head/sys/arm/freescale/imx/imx6_ipu.c
  head/sys/arm/freescale/imx/imx_ccmvar.h

Modified: head/sys/arm/freescale/imx/imx6_ccm.c
==
--- head/sys/arm/freescale/imx/imx6_ccm.c   Wed Jun 10 21:38:35 2020
(r362029)
+++ head/sys/arm/freescale/imx/imx6_ccm.c   Wed Jun 10 22:00:31 2020
(r362030)
@@ -393,6 +393,53 @@ imx_ccm_ahb_hz(void)
return (13200);
 }
 
+int
+imx_ccm_pll_video_enable(void)
+{
+   uint32_t reg;
+   int timeout;
+
+   /* Power down PLL */
+   reg = RD4(ccm_sc, CCM_ANALOG_PLL_VIDEO);
+   reg &= ~CCM_ANALOG_PLL_VIDEO_POWERDOWN;
+   WR4(ccm_sc, CCM_ANALOG_PLL_VIDEO, reg);
+
+   /*
+* Fvideo = Fref * (37 + 11/12) / 2
+* Fref = 24MHz, Fvideo = 455MHz
+*/
+   reg &= ~CCM_ANALOG_PLL_VIDEO_POST_DIV_SELECT_MASK;
+   reg |= CCM_ANALOG_PLL_VIDEO_POST_DIV_2;
+   reg &= ~CCM_ANALOG_PLL_VIDEO_DIV_SELECT_MASK;
+   reg |= 37 << CCM_ANALOG_PLL_VIDEO_DIV_SELECT_SHIFT;
+   WR4(ccm_sc, CCM_ANALOG_PLL_VIDEO, reg);
+
+   WR4(ccm_sc, CCM_ANALOG_PLL_VIDEO_NUM, 11);
+   WR4(ccm_sc, CCM_ANALOG_PLL_VIDEO_DENOM, 12);
+
+   /* Power up and wait for PLL lock down */
+   reg = RD4(ccm_sc, CCM_ANALOG_PLL_VIDEO);
+   reg &= ~CCM_ANALOG_PLL_VIDEO_POWERDOWN;
+   WR4(ccm_sc, CCM_ANALOG_PLL_VIDEO, reg);
+
+   for (timeout = 10; timeout > 0; timeout--) {
+   if (RD4(ccm_sc, CCM_ANALOG_PLL_VIDEO) &
+  CCM_ANALOG_PLL_VIDEO_LOCK) {
+   break;
+   }
+   }
+   if (timeout <= 0) {
+   return ETIMEDOUT;
+   }
+
+   /* Enable the PLL */
+   reg |= CCM_ANALOG_PLL_VIDEO_ENABLE;
+   reg &= ~CCM_ANALOG_PLL_VIDEO_BYPASS;
+   WR4(ccm_sc, CCM_ANALOG_PLL_VIDEO, reg);
+
+   return (0);
+}
+
 void
 imx_ccm_ipu_enable(int ipu)
 {
@@ -406,8 +453,26 @@ imx_ccm_ipu_enable(int ipu)
else
reg |= CCGR3_IPU2_IPU | CCGR3_IPU2_DI0;
WR4(sc, CCM_CCGR3, reg);
+
+   /* Set IPU1_DI0 clock to source from PLL5 and divide it by 3 */
+   reg = RD4(sc, CCM_CHSCCDR);
+   reg &= ~(CHSCCDR_IPU1_DI0_PRE_CLK_SEL_MASK |
+   CHSCCDR_IPU1_DI0_PODF_MASK | CHSCCDR_IPU1_DI0_CLK_SEL_MASK);
+   reg |= (CHSCCDR_PODF_DIVIDE_BY_3 << CHSCCDR_IPU1_DI0_PODF_SHIFT);
+   reg |= (CHSCCDR_IPU_PRE_CLK_PLL5 << CHSCCDR_IPU1_DI0_PRE_CLK_SEL_SHIFT);
+   WR4(sc, CCM_CHSCCDR, reg);
+
+   reg |= (CHSCCDR_CLK_SEL_PREMUXED << CHSCCDR_IPU1_DI0_CLK_SEL_SHIFT);
+   WR4(sc, CCM_CHSCCDR, reg);
 }
 
+uint32_t
+imx_ccm_ipu_hz(void)
+{
+
+   return (45500 / 3);
+}
+
 void
 imx_ccm_hdmi_enable(void)
 {
@@ -418,16 +483,6 @@ imx_ccm_hdmi_enable(void)
reg = RD4(sc, CCM_CCGR2);
reg |= CCGR2_HDMI_TX | CCGR2_HDMI_TX_ISFR;
WR4(sc, CCM_CCGR2, reg);
-
-   /* Set HDMI clock to 280MHz */
-   reg = RD4(sc, CCM_CHSCCDR);
-   reg &= ~(CHSCCDR_IPU1_DI0_PRE_CLK_SEL_MASK |
-   CHSCCDR_IPU1_DI0_PODF_MASK | CHSCCDR_IPU1_DI0_CLK_SEL_MASK);
-   reg |= (CHSCCDR_PODF_DIVIDE_BY_3 << CHSCCDR_IPU1_DI0_PODF_SHIFT);
-   reg |= (CHSCCDR_IPU_PRE_CLK_540M_PFD << 
CHSCCDR_IPU1_DI0_PRE_CLK_SEL_SHIFT);
-   WR4(sc, CCM_CHSCCDR, reg);
-   reg |= (CHSCCDR_CLK_SEL_LDB_DI0 << CHSCCDR_IPU1_DI0_CLK_SEL_SHIFT);
-   WR4(sc, CCM_CHSCCDR, reg);
 }
 
 uint32_t

Modified: head/sys/arm/freescale/imx/imx6_ccmreg.h
==
--- head/sys/arm/freescale/imx/imx6_ccmreg.hWed Jun 10 21:38:35 2020
(r362029)
+++ head/sys/arm/freescale/imx/imx6_ccmreg.hWed Jun 10 22:00:31 2020
(r362030)
@@ -64,9 +64,12 @@
 #define  CHSCCDR_IPU1_DI0_PODF_SHIFT 3
 #define  CHSCCDR_IPU1_DI0_CLK_SEL_MASK   (0x7)
 #define  CHSCCDR_IPU1_DI0_CLK_SEL_SHIFT  0
+#define  CHSCCDR_CLK_SEL_PREMUXED0
 #define  CHSCCDR_CLK_SEL_LDB_DI0 3
 #define  CHSCCDR_PODF_DIVIDE_BY_32
+#define  CHSCCDR_PODF_DIVIDE_BY_10
 #define  CHSCCDR_IPU_PRE_CLK_540M_PFD5
+#define  CHSCCDR_IPU_PRE_CLK_PLL52
 #define  

Re: svn commit: r362017 - in head/usr.bin/sed: . tests

2020-06-10 Thread Yuri Pankov

Mateusz Piotrowski wrote:

Author: 0mp (doc,ports committer)
Date: Wed Jun 10 19:23:58 2020
New Revision: 362017
URL: https://svnweb.freebsd.org/changeset/base/362017

Log:
   Read commands from stdin when -f - is passed to sed(1)
   
   This patch teaches sed to interpret a "-" in a special way when given

   as an argument to the -f flag.
   
   This behavior is also present in GNU sed.
   
   PR:		244872

   Tested by:   antoine (exp-run)
   Reviewed by: pfg, tobik (older version)
   Approved by: pfg (src)
   Relnotes:yes
   MFC after:   2 weeks
   Differential Revision:   https://reviews.freebsd.org/D24079

Modified:
   head/usr.bin/sed/main.c
   head/usr.bin/sed/sed.1
   head/usr.bin/sed/tests/sed2_test.sh

[...]

Modified: head/usr.bin/sed/tests/sed2_test.sh
==
--- head/usr.bin/sed/tests/sed2_test.sh Wed Jun 10 18:59:46 2020
(r362016)
+++ head/usr.bin/sed/tests/sed2_test.sh Wed Jun 10 19:23:58 2020
(r362017)
@@ -116,11 +116,68 @@ hex_subst_body()
atf_check -o "inline:" sed 's/\xx//' d
  }
  
+atf_test_case commands_on_stdin

+commands_on_stdin_head()
+{
+   atf_set "descr" "Verify -f -"
+}
+commands_on_stdin_body()
+{
+   printf "a\n" > a
+   printf "s/a/b/\n" > a_to_b
+   printf "s/b/c/\n" > b_to_c
+   printf "s/c/d/\n" > ./-
+   atf_check -o 'inline:d\n' sed -f a_to_b -f - -f ./- a < b_to_c
+
+   # Verify that nothing is printed if there are no input files provided.
+   printf 'i\\\nx' > insert_x
+   atf_check -o 'empty' sed -f - < insert_x
+}
+
+atf_test_case commands_on_stdin
+commands_on_stdin_head()
+{
+   atf_set "descr" "Verify -f -"
+}
+commands_on_stdin_body()
+{
+   printf "a\n" > a
+   printf "s/a/b/\n" > a_to_b
+   printf "s/b/c/\n" > b_to_c
+   printf "s/c/d/\n" > ./-
+   atf_check -o 'inline:d\n' sed -f a_to_b -f - -f ./- a < b_to_c
+
+   # Verify that nothing is printed if there are no input files provided.
+   printf 'i\\\nx' > insert_x
+   atf_check -o 'empty' sed -f - < insert_x
+}
+
+atf_test_case commands_on_stdin
+commands_on_stdin_head()
+{
+   atf_set "descr" "Verify -f -"
+}
+commands_on_stdin_body()
+{
+   printf "a\n" > a
+   printf "s/a/b/\n" > a_to_b
+   printf "s/b/c/\n" > b_to_c
+   printf "s/c/d/\n" > ./-
+   atf_check -o 'inline:d\n' sed -f a_to_b -f - -f ./- a < b_to_c
+
+   # Verify that nothing is printed if there are no input files provided.
+   printf 'i\\\nx' > insert_x
+   atf_check -o 'empty' sed -f - < insert_x
+}
+
  atf_init_test_cases()
  {
atf_add_test_case inplace_command_q
atf_add_test_case inplace_hardlink_src
atf_add_test_case inplace_symlink_src
atf_add_test_case escape_subst
+   atf_add_test_case commands_on_stdin
+   atf_add_test_case commands_on_stdin
+   atf_add_test_case commands_on_stdin
atf_add_test_case hex_subst
  }



Am I reading it wrong, or is it the same test case added 3 times?
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362029 - head/sys/dev/hdmi

2020-06-10 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Wed Jun 10 21:38:35 2020
New Revision: 362029
URL: https://svnweb.freebsd.org/changeset/base/362029

Log:
  Fix reading EDID on TVs/monitors without E-DCC support
  
  Writing segment id to I2C device 0x30 only required if the segment is
  non-zero. On the devices without E-DCC support writing to that address
  fails and whole transaction then fails too. To avoid this do
  not attempt write to the segment selection device unless required.
  
  MFC after:2 weeks

Modified:
  head/sys/dev/hdmi/dwc_hdmi.c

Modified: head/sys/dev/hdmi/dwc_hdmi.c
==
--- head/sys/dev/hdmi/dwc_hdmi.cWed Jun 10 21:18:19 2020
(r362028)
+++ head/sys/dev/hdmi/dwc_hdmi.cWed Jun 10 21:38:35 2020
(r362029)
@@ -658,6 +658,11 @@ hdmi_edid_read(struct dwc_hdmi_softc *sc, int block, u
int result;
uint8_t addr = block & 1 ? EDID_LENGTH : 0;
uint8_t segment = block >> 1;
+   /*
+* Some devices do not support E-DDC so attempt
+* writing segment address only if it's neccessary
+*/
+   unsigned char xfers = segment ? 3 : 2;
struct iic_msg msg[] = {
{ I2C_DDC_SEGADDR, IIC_M_WR, 1,  },
{ I2C_DDC_ADDR, IIC_M_WR, 1,  },
@@ -687,7 +692,7 @@ hdmi_edid_read(struct dwc_hdmi_softc *sc, int block, u
return (result);
}
 
-   result = iicbus_transfer(i2c_dev, msg, 3);
+   result = iicbus_transfer(i2c_dev, [3 - xfers], xfers);
iicbus_release_bus(i2c_dev, sc->sc_dev);
 
if (result) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362028 - in head/sys: crypto/aesni crypto/blake2 crypto/via dev/glxsb opencrypto

2020-06-10 Thread John Baldwin
Author: jhb
Date: Wed Jun 10 21:18:19 2020
New Revision: 362028
URL: https://svnweb.freebsd.org/changeset/base/362028

Log:
  Adjust crypto_apply function callbacks for OCF.
  
  - crypto_apply() is only used for reading a buffer to compute a
digest, so change the data pointer to a const pointer.
  
  - To better match m_apply(), change the data pointer type to void *
and the length from uint16_t to u_int.  The length field in
particular matters as none of the apply logic was splitting requests
larger than UINT16_MAX.
  
  - Adjust the auth_xform Update callback to match the function
prototype passed to crypto_apply() and crypto_apply_buf().  This
removes the needs for casts when using the Update callback.
  
  - Change the Reinit and Setkey callbacks to also use a u_int length
instead of uint16_t.
  
  - Update auth transforms for the changes.  While here, use C99
initializers for auth_hash structures and avoid casts on callbacks.
  
  Reviewed by:  cem
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D25171

Modified:
  head/sys/crypto/aesni/aesni.c
  head/sys/crypto/aesni/aesni.h
  head/sys/crypto/blake2/blake2-sw.c
  head/sys/crypto/blake2/blake2_cryptodev.c
  head/sys/crypto/via/padlock_hash.c
  head/sys/dev/glxsb/glxsb_hash.c
  head/sys/opencrypto/cbc_mac.c
  head/sys/opencrypto/cbc_mac.h
  head/sys/opencrypto/criov.c
  head/sys/opencrypto/cryptodev.h
  head/sys/opencrypto/cryptosoft.c
  head/sys/opencrypto/gmac.c
  head/sys/opencrypto/gmac.h
  head/sys/opencrypto/xform_auth.h
  head/sys/opencrypto/xform_cbc_mac.c
  head/sys/opencrypto/xform_gmac.c
  head/sys/opencrypto/xform_null.c
  head/sys/opencrypto/xform_poly1305.c
  head/sys/opencrypto/xform_poly1305.h
  head/sys/opencrypto/xform_rmd160.c
  head/sys/opencrypto/xform_sha1.c
  head/sys/opencrypto/xform_sha2.c

Modified: head/sys/crypto/aesni/aesni.c
==
--- head/sys/crypto/aesni/aesni.c   Wed Jun 10 20:12:45 2020
(r362027)
+++ head/sys/crypto/aesni/aesni.c   Wed Jun 10 21:18:19 2020
(r362028)
@@ -388,7 +388,7 @@ MODULE_VERSION(aesni, 1);
 MODULE_DEPEND(aesni, crypto, 1, 1, 1);
 
 static int
-intel_sha1_update(void *vctx, void *vdata, u_int datalen)
+intel_sha1_update(void *vctx, const void *vdata, u_int datalen)
 {
struct sha1_ctxt *ctx = vctx;
const char *data = vdata;
@@ -437,7 +437,7 @@ SHA1_Finalize_fn(void *digest, void *ctx)
 }
 
 static int
-intel_sha256_update(void *vctx, void *vdata, u_int len)
+intel_sha256_update(void *vctx, const void *vdata, u_int len)
 {
SHA256_CTX *ctx = vctx;
uint64_t bitlen;

Modified: head/sys/crypto/aesni/aesni.h
==
--- head/sys/crypto/aesni/aesni.h   Wed Jun 10 20:12:45 2020
(r362027)
+++ head/sys/crypto/aesni/aesni.h   Wed Jun 10 21:18:19 2020
(r362028)
@@ -63,7 +63,7 @@ struct aesni_session {
int mlen;
int hash_len;
void (*hash_init)(void *);
-   int (*hash_update)(void *, void *, unsigned);
+   int (*hash_update)(void *, const void *, u_int);
void (*hash_finalize)(void *, void *);
bool hmac;
 };

Modified: head/sys/crypto/blake2/blake2-sw.c
==
--- head/sys/crypto/blake2/blake2-sw.c  Wed Jun 10 20:12:45 2020
(r362027)
+++ head/sys/crypto/blake2/blake2-sw.c  Wed Jun 10 21:18:19 2020
(r362028)
@@ -49,7 +49,7 @@ blake2b_xform_init(void *vctx)
 }
 
 static void
-blake2b_xform_setkey(void *vctx, const uint8_t *key, uint16_t klen)
+blake2b_xform_setkey(void *vctx, const uint8_t *key, u_int klen)
 {
struct blake2b_xform_ctx *ctx = vctx;
 
@@ -60,7 +60,7 @@ blake2b_xform_setkey(void *vctx, const uint8_t *key, u
 }
 
 static int
-blake2b_xform_update(void *vctx, const uint8_t *data, uint16_t len)
+blake2b_xform_update(void *vctx, const void *data, u_int len)
 {
struct blake2b_xform_ctx *ctx = vctx;
int rc;
@@ -117,7 +117,7 @@ blake2s_xform_init(void *vctx)
 }
 
 static void
-blake2s_xform_setkey(void *vctx, const uint8_t *key, uint16_t klen)
+blake2s_xform_setkey(void *vctx, const uint8_t *key, u_int klen)
 {
struct blake2s_xform_ctx *ctx = vctx;
 
@@ -128,7 +128,7 @@ blake2s_xform_setkey(void *vctx, const uint8_t *key, u
 }
 
 static int
-blake2s_xform_update(void *vctx, const uint8_t *data, uint16_t len)
+blake2s_xform_update(void *vctx, const void *data, u_int len)
 {
struct blake2s_xform_ctx *ctx = vctx;
int rc;

Modified: head/sys/crypto/blake2/blake2_cryptodev.c
==
--- head/sys/crypto/blake2/blake2_cryptodev.c   Wed Jun 10 20:12:45 2020
(r362027)
+++ head/sys/crypto/blake2/blake2_cryptodev.c   Wed Jun 10 21:18:19 2020
(r362028)

svn commit: r362027 - head/sys/dev/pci

2020-06-10 Thread Chuck Tuffli
Author: chuck
Date: Wed Jun 10 20:12:45 2020
New Revision: 362027
URL: https://svnweb.freebsd.org/changeset/base/362027

Log:
  pci: loosen PCIe hot-plug requirements
  
  The original PCIe hot-plug code required a couple of things which cause
  PCI probing errors on the QEMU Q35 system and possibly physical systems
  (Dell R6515).
  
  Allocate the hot-plug interrupt as shared to support INTx interrupts.
  The hot-plug interrupt mechanism should normally be MSI as PCIe mandates
  MSI support, but QEMU's Q35 bridge only provides INTx interrupts.
  
  Second, the code required the Electromechanical Interlock (Slot Status
  EIS) to be engaged if present (Slot Capability EIP). Some platforms
  including QEMU Q35 set EIP but not EIS. Fix by deleting the check.
  
  Reviewed by: imp, mav, jhb
  MFC after:2 weeks
  Differential Revision: https://reviews.freebsd.org/D24877

Modified:
  head/sys/dev/pci/pci_pci.c

Modified: head/sys/dev/pci/pci_pci.c
==
--- head/sys/dev/pci/pci_pci.c  Wed Jun 10 20:05:53 2020(r362026)
+++ head/sys/dev/pci/pci_pci.c  Wed Jun 10 20:12:45 2020(r362027)
@@ -1073,14 +1073,6 @@ pcib_hotplug_present(struct pcib_softc *sc)
if (!pcib_hotplug_inserted(sc))
return (0);
 
-   /*
-* Require the Electromechanical Interlock to be engaged if
-* present.
-*/
-   if (sc->pcie_slot_cap & PCIEM_SLOT_CAP_EIP &&
-   (sc->pcie_slot_sta & PCIEM_SLOT_STA_EIS) == 0)
-   return (0);
-
/* Require the Data Link Layer to be active. */
if (!(sc->pcie_link_sta & PCIEM_LINK_STA_DL_ACTIVE))
return (0);
@@ -1338,7 +1330,7 @@ pcib_alloc_pcie_irq(struct pcib_softc *sc)
rid = 0;
 
sc->pcie_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, ,
-   RF_ACTIVE);
+   RF_ACTIVE | RF_SHAREABLE);
if (sc->pcie_irq == NULL) {
device_printf(dev,
"Failed to allocate interrupt for PCI-e events\n");
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362017 - in head/usr.bin/sed: . tests

2020-06-10 Thread Mateusz Piotrowski
Author: 0mp (doc,ports committer)
Date: Wed Jun 10 19:23:58 2020
New Revision: 362017
URL: https://svnweb.freebsd.org/changeset/base/362017

Log:
  Read commands from stdin when -f - is passed to sed(1)
  
  This patch teaches sed to interpret a "-" in a special way when given
  as an argument to the -f flag.
  
  This behavior is also present in GNU sed.
  
  PR:   244872
  Tested by:antoine (exp-run)
  Reviewed by:  pfg, tobik (older version)
  Approved by:  pfg (src)
  Relnotes: yes
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D24079

Modified:
  head/usr.bin/sed/main.c
  head/usr.bin/sed/sed.1
  head/usr.bin/sed/tests/sed2_test.sh

Modified: head/usr.bin/sed/main.c
==
--- head/usr.bin/sed/main.c Wed Jun 10 18:59:46 2020(r362016)
+++ head/usr.bin/sed/main.c Wed Jun 10 19:23:58 2020(r362017)
@@ -126,12 +126,13 @@ static void usage(void);
 int
 main(int argc, char *argv[])
 {
-   int c, fflag;
+   int c, fflag, fflagstdin;
char *temp_arg;
 
(void) setlocale(LC_ALL, "");
 
fflag = 0;
+   fflagstdin = 0;
inplace = NULL;
 
while ((c = getopt(argc, argv, "EI:ae:f:i:lnru")) != -1)
@@ -157,6 +158,8 @@ main(int argc, char *argv[])
break;
case 'f':
fflag = 1;
+   if (strcmp(optarg, "-") == 0)
+   fflagstdin = 1;
add_compunit(CU_FILE, optarg);
break;
case 'i':
@@ -193,6 +196,8 @@ main(int argc, char *argv[])
if (*argv)
for (; *argv; argv++)
add_file(*argv);
+   else if (fflagstdin)
+   exit(rval);
else
add_file(NULL);
process();
@@ -236,9 +241,14 @@ again:
linenum = 0;
switch (script->type) {
case CU_FILE:
-   if ((f = fopen(script->s, "r")) == NULL)
-   err(1, "%s", script->s);
-   fname = script->s;
+   if (strcmp(script->s, "-") == 0) {
+   f = stdin;
+   fname = "stdin";
+   } else {
+   if ((f = fopen(script->s, "r")) == NULL)
+   err(1, "%s", script->s);
+   fname = script->s;
+   }
state = ST_FILE;
goto again;
case CU_STRING:

Modified: head/usr.bin/sed/sed.1
==
--- head/usr.bin/sed/sed.1  Wed Jun 10 18:59:46 2020(r362016)
+++ head/usr.bin/sed/sed.1  Wed Jun 10 19:23:58 2020(r362017)
@@ -31,7 +31,7 @@
 .\"@(#)sed.1   8.2 (Berkeley) 12/30/93
 .\" $FreeBSD$
 .\"
-.Dd May 19, 2020
+.Dd June 10, 2020
 .Dt SED 1
 .Os
 .Sh NAME
@@ -98,6 +98,10 @@ Append the editing commands found in the file
 .Ar command_file
 to the list of commands.
 The editing commands should each be listed on a separate line.
+The commands are read from the standard input if
+.Ar command_file
+is
+.Dq Li - .
 .It Fl I Ar extension
 Edit files in-place, saving backups with the specified
 .Ar extension .
@@ -636,7 +640,9 @@ The
 .Fl E , I , a
 and
 .Fl i
-options, the prefixing
+options, the special meaning of
+.Fl f Cm - ,
+the prefixing
 .Dq \&+
 in the second member of an address range,
 as well as the

Modified: head/usr.bin/sed/tests/sed2_test.sh
==
--- head/usr.bin/sed/tests/sed2_test.sh Wed Jun 10 18:59:46 2020
(r362016)
+++ head/usr.bin/sed/tests/sed2_test.sh Wed Jun 10 19:23:58 2020
(r362017)
@@ -116,11 +116,68 @@ hex_subst_body()
atf_check -o "inline:" sed 's/\xx//' d
 }
 
+atf_test_case commands_on_stdin
+commands_on_stdin_head()
+{
+   atf_set "descr" "Verify -f -"
+}
+commands_on_stdin_body()
+{
+   printf "a\n" > a
+   printf "s/a/b/\n" > a_to_b
+   printf "s/b/c/\n" > b_to_c
+   printf "s/c/d/\n" > ./-
+   atf_check -o 'inline:d\n' sed -f a_to_b -f - -f ./- a < b_to_c
+
+   # Verify that nothing is printed if there are no input files provided.
+   printf 'i\\\nx' > insert_x
+   atf_check -o 'empty' sed -f - < insert_x
+}
+
+atf_test_case commands_on_stdin
+commands_on_stdin_head()
+{
+   atf_set "descr" "Verify -f -"
+}
+commands_on_stdin_body()
+{
+   printf "a\n" > a
+   printf "s/a/b/\n" > a_to_b
+   printf "s/b/c/\n" > b_to_c
+   printf "s/c/d/\n" > ./-
+   atf_check -o 'inline:d\n' sed -f a_to_b -f - -f ./- a < b_to_c
+
+   # Verify that nothing is printed if there are no input files provided.
+   

svn commit: r362016 - head/sys/net80211

2020-06-10 Thread Adrian Chadd
Author: adrian
Date: Wed Jun 10 18:59:46 2020
New Revision: 362016
URL: https://svnweb.freebsd.org/changeset/base/362016

Log:
  [net80211] ok ok if_xname won't ever be NULL.
  
  Somewhere in net80211 if_xname is checked against NULL but it doesn't trigger
  a compiler warning, but this does.  So DTRT for FreeBSD and the other if_xname
  derefences can be converted to this function at a later time.

Modified:
  head/sys/net80211/ieee80211_freebsd.c

Modified: head/sys/net80211/ieee80211_freebsd.c
==
--- head/sys/net80211/ieee80211_freebsd.c   Wed Jun 10 18:50:46 2020
(r362015)
+++ head/sys/net80211/ieee80211_freebsd.c   Wed Jun 10 18:59:46 2020
(r362016)
@@ -1042,7 +1042,7 @@ wlan_iflladdr(void *arg __unused, struct ifnet *ifp)
 const char *
 ieee80211_get_vap_ifname(struct ieee80211vap *vap)
 {
-   if ((vap->iv_ifp == NULL) || (vap->iv_ifp->if_xname == NULL))
+   if (vap->iv_ifp == NULL)
return "(none)";
return vap->iv_ifp->if_xname;
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362015 - in head: share/man/man4 sys/compat/linux

2020-06-10 Thread Edward Tomasz Napierala
Author: trasz
Date: Wed Jun 10 18:50:46 2020
New Revision: 362015
URL: https://svnweb.freebsd.org/changeset/base/362015

Log:
  Make linux(4) set the openfiles soft resource limit to 1024 for Linux
  applications, which often depend on this being the case.  There's a new
  sysctl, compat.linux.default_openfiles, to control this behaviour.
  
  Reviewed by:  kevans, emaste, bcr (manpages)
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D25177

Modified:
  head/share/man/man4/linux.4
  head/sys/compat/linux/linux_emul.c
  head/sys/compat/linux/linux_mib.c
  head/sys/compat/linux/linux_mib.h

Modified: head/share/man/man4/linux.4
==
--- head/share/man/man4/linux.4 Wed Jun 10 18:43:43 2020(r362014)
+++ head/share/man/man4/linux.4 Wed Jun 10 18:50:46 2020(r362015)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 16, 2019
+.Dd June 10, 2020
 .Dt LINUX 4
 .Os
 .Sh NAME
@@ -95,6 +95,10 @@ variables and
 .Xr loader 8
 tunables:
 .Bl -tag -width indent
+.It Va compat.linux.default_openfiles
+Default soft openfiles resource limit for Linux applications.
+Set to -1 to disable the limit.
+Defaults to 1024.
 .It Va compat.linux.emul_path
 Path to the Linux run-time environment.
 Defaults to

Modified: head/sys/compat/linux/linux_emul.c
==
--- head/sys/compat/linux/linux_emul.c  Wed Jun 10 18:43:43 2020
(r362014)
+++ head/sys/compat/linux/linux_emul.c  Wed Jun 10 18:50:46 2020
(r362015)
@@ -42,10 +42,12 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -87,6 +89,32 @@ pem_find(struct proc *p)
return (pem);
 }
 
+/*
+ * Linux apps generally expect the soft open file limit to be set
+ * to 1024, often iterating over all the file descriptors up to that
+ * limit instead of using closefrom(2).  Give them what they want,
+ * unless there already is a resource limit in place.
+ */
+static void
+linux_set_default_openfiles(struct thread *td, struct proc *p)
+{
+   struct rlimit rlim;
+   int error;
+
+   if (linux_default_openfiles < 0)
+   return;
+
+   PROC_LOCK(p);
+   lim_rlimit_proc(p, RLIMIT_NOFILE, );
+   PROC_UNLOCK(p);
+   if (rlim.rlim_cur != rlim.rlim_max ||
+   rlim.rlim_cur <= linux_default_openfiles)
+   return;
+   rlim.rlim_cur = linux_default_openfiles;
+   error = kern_proc_setrlimit(td, p, RLIMIT_NOFILE, );
+   KASSERT(error == 0, ("kern_proc_setrlimit failed"));
+}
+
 void
 linux_proc_init(struct thread *td, struct thread *newtd, int flags)
 {
@@ -115,6 +143,8 @@ linux_proc_init(struct thread *td, struct thread *newt
p->p_emuldata = pem;
}
newtd->td_emuldata = em;
+
+   linux_set_default_openfiles(td, p);
} else {
p = td->td_proc;
 

Modified: head/sys/compat/linux/linux_mib.c
==
--- head/sys/compat/linux/linux_mib.c   Wed Jun 10 18:43:43 2020
(r362014)
+++ head/sys/compat/linux/linux_mib.c   Wed Jun 10 18:50:46 2020
(r362015)
@@ -63,6 +63,11 @@ static unsigned linux_osd_jail_slot;
 SYSCTL_NODE(_compat, OID_AUTO, linux, CTLFLAG_RW | CTLFLAG_MPSAFE, 0,
 "Linux mode");
 
+int linux_default_openfiles = 1024;
+SYSCTL_INT(_compat_linux, OID_AUTO, default_openfiles, CTLFLAG_RWTUN,
+_default_openfiles, 0,
+"Default soft openfiles resource limit, or -1 for unlimited");
+
 int linux_ignore_ip_recverr = 1;
 SYSCTL_INT(_compat_linux, OID_AUTO, ignore_ip_recverr, CTLFLAG_RWTUN,
 _ignore_ip_recverr, 0, "Ignore enabling IP_RECVERR");

Modified: head/sys/compat/linux/linux_mib.h
==
--- head/sys/compat/linux/linux_mib.h   Wed Jun 10 18:43:43 2020
(r362014)
+++ head/sys/compat/linux/linux_mib.h   Wed Jun 10 18:50:46 2020
(r362015)
@@ -62,6 +62,7 @@ int   linux_kernver(struct thread *td);
 
 #definelinux_use26(t)  (linux_kernver(t) >= 
LINUX_KERNVER_2006000)
 
+extern int linux_default_openfiles;
 extern int linux_ignore_ip_recverr;
 extern int linux_preserve_vstatus;
 extern bool linux_map_sched_prio;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r362014 - head/sys/compat/linux

2020-06-10 Thread Edward Tomasz Napierala
On 0610T1843, Edward Tomasz Napierala wrote:
> Author: trasz
> Date: Wed Jun 10 18:43:43 2020
> New Revision: 362014
> URL: https://svnweb.freebsd.org/changeset/base/362014
> 
> Log:
>   Support SO_SNDBUFFORCE/SO_RCVBUFFORCE by aliasing them to the
>   standard SO_SNDBUF/SO_RCVBUF.  Mostly cosmetics, to get rid
>   of the warning during 'apt upgrade'.
>   
>   MFC after:  2 weeks
>   Sponsored by:   The FreeBSD Foundation

Reviewed by:emaste@

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


svn commit: r362014 - head/sys/compat/linux

2020-06-10 Thread Edward Tomasz Napierala
Author: trasz
Date: Wed Jun 10 18:43:43 2020
New Revision: 362014
URL: https://svnweb.freebsd.org/changeset/base/362014

Log:
  Support SO_SNDBUFFORCE/SO_RCVBUFFORCE by aliasing them to the
  standard SO_SNDBUF/SO_RCVBUF.  Mostly cosmetics, to get rid
  of the warning during 'apt upgrade'.
  
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D25173

Modified:
  head/sys/compat/linux/linux_socket.c
  head/sys/compat/linux/linux_socket.h

Modified: head/sys/compat/linux/linux_socket.c
==
--- head/sys/compat/linux/linux_socket.cWed Jun 10 16:00:43 2020
(r362013)
+++ head/sys/compat/linux/linux_socket.cWed Jun 10 18:43:43 2020
(r362014)
@@ -212,8 +212,10 @@ linux_to_bsd_so_sockopt(int opt)
case LINUX_SO_BROADCAST:
return (SO_BROADCAST);
case LINUX_SO_SNDBUF:
+   case LINUX_SO_SNDBUFFORCE:
return (SO_SNDBUF);
case LINUX_SO_RCVBUF:
+   case LINUX_SO_RCVBUFFORCE:
return (SO_RCVBUF);
case LINUX_SO_KEEPALIVE:
return (SO_KEEPALIVE);

Modified: head/sys/compat/linux/linux_socket.h
==
--- head/sys/compat/linux/linux_socket.hWed Jun 10 16:00:43 2020
(r362013)
+++ head/sys/compat/linux/linux_socket.hWed Jun 10 18:43:43 2020
(r362014)
@@ -200,6 +200,8 @@ int linux_accept(struct thread *td, struct linux_accep
 #endif
 #defineLINUX_SO_TIMESTAMP  29
 #defineLINUX_SO_ACCEPTCONN 30
+#defineLINUX_SO_SNDBUFFORCE32
+#defineLINUX_SO_RCVBUFFORCE33
 
 /* Socket options */
 #defineLINUX_IP_TOS1
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362013 - head/sys/kern

2020-06-10 Thread Ed Maste
Author: emaste
Date: Wed Jun 10 16:00:43 2020
New Revision: 362013
URL: https://svnweb.freebsd.org/changeset/base/362013

Log:
  Fix arm64 kernel build with DEBUG on
  
  Submitted by: Greg V , andrew
  Differential Revision:https://reviews.freebsd.org/D24986

Modified:
  head/sys/kern/subr_intr.c

Modified: head/sys/kern/subr_intr.c
==
--- head/sys/kern/subr_intr.c   Wed Jun 10 14:39:54 2020(r362012)
+++ head/sys/kern/subr_intr.c   Wed Jun 10 16:00:43 2020(r362013)
@@ -797,8 +797,8 @@ intr_pic_register(device_t dev, intptr_t xref)
if (pic == NULL)
return (NULL);
 
-   debugf("PIC %p registered for %s \n", pic,
-   device_get_nameunit(dev), dev, xref);
+   debugf("PIC %p registered for %s \n", pic,
+   device_get_nameunit(dev), dev, (uintmax_t)xref);
return (pic);
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r362012 - head/sys/dev/acpica

2020-06-10 Thread John Baldwin
On 6/10/20 7:39 AM, Ruslan Bukin wrote:
> Author: br
> Date: Wed Jun 10 14:39:54 2020
> New Revision: 362012
> URL: https://svnweb.freebsd.org/changeset/base/362012
> 
> Log:
>   All the ARM Coresight interconnect devices set ResourceProducer on memory
>   resources, ignore it.
>   
>   The devices found in the ARM Neoverse N1 System Development Platform
>   (N1SDP).
>   
>   Sponsored by:   DARPA, AFRL

1) We should perhaps think about adding a quirk table or at least just adding an
   array of ACPI handles which need this quirk as a separate variable perhaps?

2) Given that ARM is a frequent offender here, perhaps we should provide them
   some feedback to see if they can fix this in future ROMs?

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


Re: svn commit: r361994 - in head/sys/mips: cavium/cryptocteon nlm/dev/sec

2020-06-10 Thread John Baldwin
On 6/9/20 5:13 PM, Kyle Evans wrote:
> On Tue, Jun 9, 2020 at 7:09 PM John Baldwin  wrote:
>>
>> Author: jhb
>> Date: Wed Jun 10 00:09:31 2020
>> New Revision: 361994
>> URL: https://svnweb.freebsd.org/changeset/base/361994
>>
>> Log:
>>   Add some default cases for unreachable code to silence compiler warnings.
>>
>>   This was caused by r361481 when the buffer type was changed from an
>>   int to an enum.
>>
>>   Reported by:  mjg, rpokala
>>   Sponsored by: Chelsio Communications
>>
>> Modified:
>>   head/sys/mips/cavium/cryptocteon/cryptocteon.c
>>   head/sys/mips/nlm/dev/sec/nlmseclib.c
>>
>> Modified: head/sys/mips/cavium/cryptocteon/cryptocteon.c
>> ==
>> --- head/sys/mips/cavium/cryptocteon/cryptocteon.c  Tue Jun  9 23:03:48 
>> 2020(r361993)
>> +++ head/sys/mips/cavium/cryptocteon/cryptocteon.c  Wed Jun 10 00:09:31 
>> 2020(r361994)
>> @@ -323,6 +323,8 @@ cryptocteon_process(device_t dev, struct cryptop *crp,
>> goto done;
>> }
>> break;
>> +   default:
>> +   break;
>> }
>>
>> if (csp->csp_cipher_alg != 0) {
>>
> 
> This one could kind of looks like it should also be an
> __assert_unreachable(), and perhaps this bit not too long later:

This one is not.  It doesn't handle CRYPTO_BUF_CONTIG as there is nothing to do
for that case.

> case CRYPTO_BUF_CONTIG:
> iovlen = crp->crp_buf.cb_buf_len;
> od->octo_iov[0].iov_base = crp->crp_buf.cb_buf;
> od->octo_iov[0].iov_len = crp->crp_buf.cb_buf_len
> iovcnt = 1;
> break;
> default:
> -panic("can't happen");
> +__assert_unreachable();

This could.  I don't think we had __assert_unreachable() yet when I committed 
this.

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


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

2020-06-10 Thread Ruslan Bukin
Author: br
Date: Wed Jun 10 14:39:54 2020
New Revision: 362012
URL: https://svnweb.freebsd.org/changeset/base/362012

Log:
  All the ARM Coresight interconnect devices set ResourceProducer on memory
  resources, ignore it.
  
  The devices found in the ARM Neoverse N1 System Development Platform
  (N1SDP).
  
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/dev/acpica/acpi_resource.c

Modified: head/sys/dev/acpica/acpi_resource.c
==
--- head/sys/dev/acpica/acpi_resource.c Wed Jun 10 14:28:36 2020
(r362011)
+++ head/sys/dev/acpica/acpi_resource.c Wed Jun 10 14:39:54 2020
(r362012)
@@ -484,8 +484,16 @@ acpi_parse_resources(device_t dev, ACPI_HANDLE handle,
 if (acpi_MatchHid(handle, "ARMH0011") != ACPI_MATCHHID_NOMATCH)
arc.ignore_producer_flag = true;
 
-/* ARM Coresight on N1SDP set ResourceProducer on memory resources. */
-if (acpi_MatchHid(handle, "ARMHC500") != ACPI_MATCHHID_NOMATCH)
+/*
+ * ARM Coresight on N1SDP set ResourceProducer on memory resources.
+ * Coresight devices: ETM, STM, TPIU, ETF/ETR, REP, FUN.
+ */
+if (acpi_MatchHid(handle, "ARMHC500") != ACPI_MATCHHID_NOMATCH ||
+acpi_MatchHid(handle, "ARMHC502") != ACPI_MATCHHID_NOMATCH ||
+acpi_MatchHid(handle, "ARMHC979") != ACPI_MATCHHID_NOMATCH ||
+acpi_MatchHid(handle, "ARMHC97C") != ACPI_MATCHHID_NOMATCH ||
+acpi_MatchHid(handle, "ARMHC98D") != ACPI_MATCHHID_NOMATCH ||
+acpi_MatchHid(handle, "ARMHC9FF") != ACPI_MATCHHID_NOMATCH)
arc.ignore_producer_flag = true;
 
 status = AcpiWalkResources(handle, "_CRS", acpi_parse_resource, );
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362011 - in head/sys: arm64/coresight conf

2020-06-10 Thread Ruslan Bukin
Author: br
Date: Wed Jun 10 14:28:36 2020
New Revision: 362011
URL: https://svnweb.freebsd.org/changeset/base/362011

Log:
  ARM Coresight Funnel device:
  o Split-out FDT attachment to a separate file;
  o Add ACPI attachment;
  o Add support for the Static Funnel device.
  
  Sponsored by: DARPA, AFRL

Added:
  head/sys/arm64/coresight/coresight_funnel_acpi.c   (contents, props changed)
  head/sys/arm64/coresight/coresight_funnel_fdt.c   (contents, props changed)
Modified:
  head/sys/arm64/coresight/coresight_funnel.c
  head/sys/arm64/coresight/coresight_funnel.h
  head/sys/conf/files.arm64

Modified: head/sys/arm64/coresight/coresight_funnel.c
==
--- head/sys/arm64/coresight/coresight_funnel.c Wed Jun 10 14:10:48 2020
(r362010)
+++ head/sys/arm64/coresight/coresight_funnel.c Wed Jun 10 14:28:36 2020
(r362011)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2018 Ruslan Bukin 
+ * Copyright (c) 2018-2020 Ruslan Bukin 
  * All rights reserved.
  *
  * This software was developed by BAE Systems, the University of Cambridge
@@ -43,9 +43,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include 
-#include 
-
 #include "coresight_if.h"
 
 #defineFUNNEL_DEBUG
@@ -57,16 +54,6 @@ __FBSDID("$FreeBSD$");
 #definedprintf(fmt, ...)
 #endif
 
-static struct ofw_compat_data compat_data[] = {
-   { "arm,coresight-funnel",   1 },
-   { NULL, 0 }
-};
-
-struct funnel_softc {
-   struct resource *res;
-   struct coresight_platform_data  *pdata;
-};
-
 static struct resource_spec funnel_spec[] = {
{ SYS_RES_MEMORY,   0,  RF_ACTIVE },
{ -1, 0 }
@@ -78,10 +65,11 @@ funnel_init(device_t dev)
struct funnel_softc *sc;
 
sc = device_get_softc(dev);
+   if (sc->hwtype == HWTYPE_STATIC_FUNNEL)
+   return (0);
 
/* Unlock Coresight */
bus_write_4(sc->res, CORESIGHT_LAR, CORESIGHT_UNLOCK);
-
dprintf("Device ID: %x\n", bus_read_4(sc->res, FUNNEL_DEVICEID));
 
return (0);
@@ -95,6 +83,8 @@ funnel_enable(device_t dev, struct endpoint *endp,
uint32_t reg;
 
sc = device_get_softc(dev);
+   if (sc->hwtype == HWTYPE_STATIC_FUNNEL)
+   return (0);
 
reg = bus_read_4(sc->res, FUNNEL_FUNCTL);
reg &= ~(FUNCTL_HOLDTIME_MASK);
@@ -113,6 +103,8 @@ funnel_disable(device_t dev, struct endpoint *endp,
uint32_t reg;
 
sc = device_get_softc(dev);
+   if (sc->hwtype == HWTYPE_STATIC_FUNNEL)
+   return;
 
reg = bus_read_4(sc->res, FUNNEL_FUNCTL);
reg &= ~(1 << endp->reg);
@@ -120,29 +112,14 @@ funnel_disable(device_t dev, struct endpoint *endp,
 }
 
 static int
-funnel_probe(device_t dev)
-{
-
-   if (!ofw_bus_status_okay(dev))
-   return (ENXIO);
-
-   if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0)
-   return (ENXIO);
-
-   device_set_desc(dev, "Coresight Funnel");
-
-   return (BUS_PROBE_DEFAULT);
-}
-
-static int
 funnel_attach(device_t dev)
 {
struct coresight_desc desc;
struct funnel_softc *sc;
 
sc = device_get_softc(dev);
-
-   if (bus_alloc_resources(dev, funnel_spec, >res) != 0) {
+   if (sc->hwtype == HWTYPE_FUNNEL &&
+   bus_alloc_resources(dev, funnel_spec, >res) != 0) {
device_printf(dev, "cannot allocate resources for device\n");
return (ENXIO);
}
@@ -158,7 +135,6 @@ funnel_attach(device_t dev)
 
 static device_method_t funnel_methods[] = {
/* Device interface */
-   DEVMETHOD(device_probe, funnel_probe),
DEVMETHOD(device_attach,funnel_attach),
 
/* Coresight interface */
@@ -168,13 +144,5 @@ static device_method_t funnel_methods[] = {
DEVMETHOD_END
 };
 
-static driver_t funnel_driver = {
-   "funnel",
-   funnel_methods,
-   sizeof(struct funnel_softc),
-};
-
-static devclass_t funnel_devclass;
-
-DRIVER_MODULE(funnel, simplebus, funnel_driver, funnel_devclass, 0, 0);
-MODULE_VERSION(funnel, 1);
+DEFINE_CLASS_0(funnel, funnel_driver, funnel_methods,
+sizeof(struct funnel_softc));

Modified: head/sys/arm64/coresight/coresight_funnel.h
==
--- head/sys/arm64/coresight/coresight_funnel.h Wed Jun 10 14:10:48 2020
(r362010)
+++ head/sys/arm64/coresight/coresight_funnel.h Wed Jun 10 14:28:36 2020
(r362011)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2018 Ruslan Bukin 
+ * Copyright (c) 2018-2020 Ruslan Bukin 
  * All rights reserved.
  *
  * This software was developed by BAE Systems, the University of Cambridge
@@ -62,5 +62,17 @@
 #defineFUNNEL_COMP10xFF4 /* Component ID1 */
 #defineFUNNEL_COMP20xFF8 /* Component ID2 */
 #defineFUNNEL_COMP3

svn commit: r362010 - head/release/tools

2020-06-10 Thread Emmanuel Vadot
Author: manu
Date: Wed Jun 10 14:10:48 2020
New Revision: 362010
URL: https://svnweb.freebsd.org/changeset/base/362010

Log:
  release: Fix arm GPT image
  
  msdosfs labels are capitalized, use EFI instead of efi.
  
  MFC after:3 days

Modified:
  head/release/tools/arm.subr

Modified: head/release/tools/arm.subr
==
--- head/release/tools/arm.subr Wed Jun 10 13:06:13 2020(r362009)
+++ head/release/tools/arm.subr Wed Jun 10 14:10:48 2020(r362010)
@@ -194,7 +194,7 @@ arm_install_base() {
if [ "${PART_SCHEME}" == "GPT" ]; then
echo "/dev/ufs/rootfs   /   ufs rw  1   1" \
>> ${CHROOTDIR}/${DESTDIR}/etc/fstab
-   echo "/dev/msdosfs/efi /boot/efi msdosfs rw,noatime 0 0" \
+   echo "/dev/msdosfs/EFI /boot/efi msdosfs rw,noatime 0 0" \
>> ${CHROOTDIR}/${DESTDIR}/etc/fstab
fi
if [ "${PART_SCHEME}" == "MBR" ]; then
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2020-06-10 Thread Andrew Turner
Author: andrew
Date: Wed Jun 10 09:31:37 2020
New Revision: 362008
URL: https://svnweb.freebsd.org/changeset/base/362008

Log:
  Fix the efi serial console in the Arm models.
  
  On some UEFI implementations the ConsOut EFI variable is not a device
  path end type so we never move to the next node. Fix this by always
  incrementing the device path node pointer, with a sanity check that
  the node length is large enough so no two nodes overlap.
  
  While here return failure on malloc failure rather than a NULL pointer
  dereference.
  
  Reviewed by:  tsoome, imp (previous version)
  Sponsored by: Innovate UK
  Differential Revision:https://reviews.freebsd.org/D25202

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

Modified: head/stand/efi/loader/efiserialio.c
==
--- head/stand/efi/loader/efiserialio.c Wed Jun 10 07:46:22 2020
(r362007)
+++ head/stand/efi/loader/efiserialio.c Wed Jun 10 09:31:37 2020
(r362008)
@@ -216,8 +216,9 @@ comc_get_con_serial_handle(const char *name)
status = efi_global_getenv(name, buf, );
if (status == EFI_BUFFER_TOO_SMALL) {
buf = malloc(sz);
-   if (buf != NULL)
-   status = efi_global_getenv(name, buf, );
+   if (buf == NULL)
+   return (NULL);
+   status = efi_global_getenv(name, buf, );
}
if (status != EFI_SUCCESS) {
free(buf);
@@ -232,17 +233,13 @@ comc_get_con_serial_handle(const char *name)
free(buf);
return (handle);
}
-   if (IsDevicePathEndType(node) &&
-   DevicePathSubType(node) ==
-   END_INSTANCE_DEVICE_PATH_SUBTYPE) {
-   /*
-* Start of next device path in list.
-*/
-   node = NextDevicePathNode(node);
-   continue;
-   }
-   if (IsDevicePathEnd(node))
+
+   /* Sanity check the node before moving to the next node. */
+   if (DevicePathNodeLength(node) < sizeof(*node))
break;
+
+   /* Start of next device path in list. */
+   node = NextDevicePathNode(node);
}
free(buf);
return (NULL);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362007 - in head/sys/net: . route

2020-06-10 Thread Alexander V. Chernikov
Author: melifaro
Date: Wed Jun 10 07:46:22 2020
New Revision: 362007
URL: https://svnweb.freebsd.org/changeset/base/362007

Log:
  Switch rtsock code to using newly-create rib_action() KPI call.
  
  This simplifies the code and allows to further split rtentry and nexthop,
   removing one of the blockers for multipath code introduction, described in
   D24141.
  
  Reviewed by:  ae
  Differential Revision:https://reviews.freebsd.org/D25192

Modified:
  head/sys/net/route/route_ctl.c
  head/sys/net/route/route_ctl.h
  head/sys/net/rtsock.c

Modified: head/sys/net/route/route_ctl.c
==
--- head/sys/net/route/route_ctl.c  Wed Jun 10 07:32:02 2020
(r362006)
+++ head/sys/net/route/route_ctl.c  Wed Jun 10 07:46:22 2020
(r362007)
@@ -610,6 +610,37 @@ change_route(struct rib_head *rnh, struct rt_addrinfo 
return (error);
 }
 
+/*
+ * Performs modification of routing table specificed by @action.
+ * Table is specified by @fibnum and sa_family in @info->rti_info[RTAX_DST].
+ * Needs to be run in network epoch.
+ *
+ * Returns 0 on success and fills in @rc with action result.
+ */
+int
+rib_action(uint32_t fibnum, int action, struct rt_addrinfo *info,
+struct rib_cmd_info *rc)
+{
+   int error;
+
+   switch (action) {
+   case RTM_ADD:
+   error = rib_add_route(fibnum, info, rc);
+   break;
+   case RTM_DELETE:
+   error = rib_del_route(fibnum, info, rc);
+   break;
+   case RTM_CHANGE:
+   error = rib_change_route(fibnum, info, rc);
+   break;
+   default:
+   error = ENOTSUP;
+   }
+
+   return (error);
+}
+
+
 static void
 rt_notifydelete(struct rtentry *rt, struct rt_addrinfo *info)
 {

Modified: head/sys/net/route/route_ctl.h
==
--- head/sys/net/route/route_ctl.h  Wed Jun 10 07:32:02 2020
(r362006)
+++ head/sys/net/route/route_ctl.h  Wed Jun 10 07:46:22 2020
(r362007)
@@ -51,6 +51,8 @@ int rib_del_route(uint32_t fibnum, struct rt_addrinfo 
   struct rib_cmd_info *rc);
 int rib_change_route(uint32_t fibnum, struct rt_addrinfo *info,
   struct rib_cmd_info *rc);
+int rib_action(uint32_t fibnum, int action, struct rt_addrinfo *info,
+  struct rib_cmd_info *rc);
 
 int rib_add_redirect(u_int fibnum, struct sockaddr *dst,
   struct sockaddr *gateway, struct sockaddr *author, struct ifnet *ifp,

Modified: head/sys/net/rtsock.c
==
--- head/sys/net/rtsock.c   Wed Jun 10 07:32:02 2020(r362006)
+++ head/sys/net/rtsock.c   Wed Jun 10 07:46:22 2020(r362007)
@@ -62,6 +62,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #ifdef RADIX_MPATH
 #include 
@@ -181,10 +182,10 @@ static introute_output(struct mbuf *m, struct 
socket 
 static voidrt_getmetrics(const struct rtentry *rt, struct rt_metrics *out);
 static voidrt_dispatch(struct mbuf *, sa_family_t);
 static int handle_rtm_get(struct rt_addrinfo *info, u_int fibnum,
-   struct rt_msghdr *rtm, struct rtentry **ret_nrt);
+   struct rt_msghdr *rtm, struct rib_cmd_info *rc);
 static int update_rtm_from_rte(struct rt_addrinfo *info,
struct rt_msghdr **prtm, int alloc_len,
-   struct rtentry *rt);
+   struct rtentry *rt, struct nhop_object *nh);
 static voidsend_rtm_reply(struct socket *so, struct rt_msghdr *rtm,
struct mbuf *m, sa_family_t saf, u_int fibnum,
int rtm_errno);
@@ -656,10 +657,9 @@ fill_addrinfo(struct rt_msghdr *rtm, int len, u_int fi
  */
 static int
 handle_rtm_get(struct rt_addrinfo *info, u_int fibnum,
-struct rt_msghdr *rtm, struct rtentry **ret_nrt)
+struct rt_msghdr *rtm, struct rib_cmd_info *rc)
 {
RIB_RLOCK_TRACKER;
-   struct rtentry *rt;
struct rib_head *rnh;
sa_family_t saf;
 
@@ -677,14 +677,14 @@ handle_rtm_get(struct rt_addrinfo *info, u_int fibnum,
 * address lookup (no mask).
 * 'route -n get addr'
 */
-   rt = (struct rtentry *) rnh->rnh_matchaddr(
+   rc->rc_rt = (struct rtentry *) rnh->rnh_matchaddr(
info->rti_info[RTAX_DST], >head);
} else
-   rt = (struct rtentry *) rnh->rnh_lookup(
+   rc->rc_rt = (struct rtentry *) rnh->rnh_lookup(
info->rti_info[RTAX_DST],
info->rti_info[RTAX_NETMASK], >head);
 
-   if (rt == NULL) {
+   if (rc->rc_rt == NULL) {
RIB_RUNLOCK(rnh);
return (ESRCH);
}
@@ -695,8 +695,9 @@ handle_rtm_get(struct rt_addrinfo *info, u_int fibnum,
 * (no need to call 

svn commit: r362006 - head/sys/netinet/cc

2020-06-10 Thread Richard Scheffenegger
Author: rscheff
Date: Wed Jun 10 07:32:02 2020
New Revision: 362006
URL: https://svnweb.freebsd.org/changeset/base/362006

Log:
  Prevent TCP Cubic to abruptly increase cwnd after app-limited
  
  Cubic calculates the new cwnd based on absolute time
  elapsed since the start of an epoch. A cubic epoch is
  started on congestion events, or once the congestion
  avoidance phase is started, after slow-start has
  completed.
  
  When a sender is application limited for an extended
  amount of time and subsequently a larger volume of data
  becomes ready for sending, Cubic recalculates cwnd
  with a lingering cubic epoch. This recalculation
  of the cwnd can induce a massive increase in cwnd,
  causing a burst of data to be sent at line rate by
  the sender.
  
  This adds a flag to reset the cubic epoch once a
  session transitions from app-limited to cwnd-limited
  to prevent the above effect.
  
  Reviewed by:  chengc_netapp.com, tuexen (mentor)
  Approved by:  tuexen (mentor), rgrimes (mentor)
  MFC after:3 weeks
  Sponsored by: NetApp, Inc.
  Differential Revision:https://reviews.freebsd.org/D25065

Modified:
  head/sys/netinet/cc/cc_cubic.c

Modified: head/sys/netinet/cc/cc_cubic.c
==
--- head/sys/netinet/cc/cc_cubic.c  Wed Jun 10 05:01:00 2020
(r362005)
+++ head/sys/netinet/cc/cc_cubic.c  Wed Jun 10 07:32:02 2020
(r362006)
@@ -94,6 +94,7 @@ struct cubic {
uint32_tflags;
 #define CUBICFLAG_CONG_EVENT   0x0001  /* congestion experienced */
 #define CUBICFLAG_IN_SLOWSTART 0x0002  /* in slow start */
+#define CUBICFLAG_IN_APPLIMIT  0x0004  /* application limited */
/* Minimum observed rtt in ticks. */
int min_rtt_ticks;
/* Mean observed rtt between congestion epochs. */
@@ -153,8 +154,10 @@ cubic_ack_received(struct cc_var *ccv, uint16_t type)
cubic_data->t_last_cong = ticks - INT_MAX;
}
 
-   if (cubic_data->flags & CUBICFLAG_IN_SLOWSTART) {
-   cubic_data->flags &= ~CUBICFLAG_IN_SLOWSTART;
+   if (cubic_data->flags & (CUBICFLAG_IN_SLOWSTART |
+CUBICFLAG_IN_APPLIMIT)) {
+   cubic_data->flags &= ~(CUBICFLAG_IN_SLOWSTART |
+  CUBICFLAG_IN_APPLIMIT);
cubic_data->t_last_cong = ticks;
cubic_data->K = 0;
}
@@ -214,6 +217,9 @@ cubic_ack_received(struct cc_var *ccv, uint16_t type)
CCV(ccv, t_maxseg));
}
}
+   } else if (type == CC_ACK && !IN_RECOVERY(CCV(ccv, t_flags)) &&
+   !(ccv->flags & CCF_CWND_LIMITED)) {
+   cubic_data->flags |= CUBICFLAG_IN_APPLIMIT;
}
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"