svn commit: r336022 - head/sys/dev/hwpmc

2018-07-05 Thread Matt Macy
Author: mmacy
Date: Fri Jul  6 06:21:24 2018
New Revision: 336022
URL: https://svnweb.freebsd.org/changeset/base/336022

Log:
  hwpmc: remove hacks to work around incorrect pc_domain

Modified:
  head/sys/dev/hwpmc/hwpmc_logging.c

Modified: head/sys/dev/hwpmc/hwpmc_logging.c
==
--- head/sys/dev/hwpmc/hwpmc_logging.c  Fri Jul  6 06:20:03 2018
(r336021)
+++ head/sys/dev/hwpmc/hwpmc_logging.c  Fri Jul  6 06:21:24 2018
(r336022)
@@ -65,15 +65,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #endif
 
-#ifdef NUMA
-#define NDOMAINS vm_ndomains
 #define curdomain PCPU_GET(domain)
-#else
-#define NDOMAINS 1
-#define curdomain 0
-#define malloc_domain(size, type, domain, flags) malloc((size), (type), 
(flags))
-#define free_domain(addr, type) free(addr, type)
-#endif
 
 /*
  * Sysctl tunables
@@ -1261,7 +1253,7 @@ pmclog_initialize()
pmc_nlogbuffers_pcpu = PMC_NLOGBUFFERS_PCPU;
pmclog_buffer_size = PMC_LOG_BUFFER_SIZE;
}
-   for (domain = 0; domain < NDOMAINS; domain++) {
+   for (domain = 0; domain < vm_ndomains; domain++) {
int ncpus = pmc_dom_hdrs[domain]->pdbh_ncpus;
int total = ncpus*pmc_nlogbuffers_pcpu;
 
@@ -1293,7 +1285,7 @@ pmclog_shutdown()
 
mtx_destroy(&pmc_kthread_mtx);
 
-   for (domain = 0; domain < NDOMAINS; domain++) {
+   for (domain = 0; domain < vm_ndomains; domain++) {
while ((plb = TAILQ_FIRST(&pmc_dom_hdrs[domain]->pdbh_head)) != 
NULL) {
TAILQ_REMOVE(&pmc_dom_hdrs[domain]->pdbh_head, plb, 
plb_next);
free(plb->plb_base, M_PMC);
___
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: r336021 - in head/sys: kern sys

2018-07-05 Thread Matt Macy
Author: mmacy
Date: Fri Jul  6 06:20:03 2018
New Revision: 336021
URL: https://svnweb.freebsd.org/changeset/base/336021

Log:
  epoch(9): simplify initialization
  
  replace manual NUMA aware allocation with a pcpu zone

Modified:
  head/sys/kern/subr_epoch.c
  head/sys/sys/epoch_private.h

Modified: head/sys/kern/subr_epoch.c
==
--- head/sys/kern/subr_epoch.c  Fri Jul  6 02:06:03 2018(r336020)
+++ head/sys/kern/subr_epoch.c  Fri Jul  6 06:20:03 2018(r336021)
@@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -93,29 +94,23 @@ TAILQ_HEAD (threadlist, thread);
 CK_STACK_CONTAINER(struct ck_epoch_entry, stack_entry,
 ck_epoch_entry_container)
 
-   epoch_t allepochs[MAX_EPOCHS];
+epoch_tallepochs[MAX_EPOCHS];
 
 DPCPU_DEFINE(struct grouptask, epoch_cb_task);
 DPCPU_DEFINE(int, epoch_cb_count);
 
-static __read_mostly int domcount[MAXMEMDOM];
-static __read_mostly int domoffsets[MAXMEMDOM];
 static __read_mostly int inited;
 static __read_mostly int epoch_count;
 __read_mostly epoch_t global_epoch;
 __read_mostly epoch_t global_epoch_preempt;
 
 static void epoch_call_task(void *context __unused);
+static uma_zone_t pcpu_zone_record;
 
-#if defined(__powerpc64__) || defined(__powerpc__) || !defined(NUMA)
-static bool usedomains = false;
-#else
-static bool usedomains = true;
-#endif
 static void
 epoch_init(void *arg __unused)
 {
-   int domain, cpu;
+   int cpu;
 
block_count = counter_u64_alloc(M_WAITOK);
migrate_count = counter_u64_alloc(M_WAITOK);
@@ -123,25 +118,9 @@ epoch_init(void *arg __unused)
switch_count = counter_u64_alloc(M_WAITOK);
epoch_call_count = counter_u64_alloc(M_WAITOK);
epoch_call_task_count = counter_u64_alloc(M_WAITOK);
-   if (usedomains == false)
-   goto done;
-   domain = 0;
-   domoffsets[0] = 0;
-   for (domain = 0; domain < vm_ndomains; domain++) {
-   domcount[domain] = CPU_COUNT(&cpuset_domain[domain]);
-   if (bootverbose)
-   printf("domcount[%d] %d\n", domain, domcount[domain]);
-   }
-   for (domain = 1; domain < vm_ndomains; domain++)
-   domoffsets[domain] = domoffsets[domain - 1] + domcount[domain - 
1];
 
-   for (domain = 0; domain < vm_ndomains; domain++) {
-   if (domcount[domain] == 0) {
-   usedomains = false;
-   break;
-   }
-   }
-done:
+   pcpu_zone_record = uma_zcreate("epoch_record pcpu", sizeof(struct 
epoch_record),
+   NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_PCPU);
CPU_FOREACH(cpu) {
GROUPTASK_INIT(DPCPU_ID_PTR(cpu, epoch_cb_task), 0, 
epoch_call_task, NULL);
taskqgroup_attach_cpu(qgroup_softirq, DPCPU_ID_PTR(cpu, 
epoch_cb_task), NULL, cpu, -1, "epoch call task");
@@ -161,39 +140,19 @@ epoch_init_smp(void *dummy __unused)
 SYSINIT(epoch_smp, SI_SUB_SMP + 1, SI_ORDER_FIRST, epoch_init_smp, NULL);
 #endif
 
-
 static void
-epoch_init_numa(epoch_t epoch)
+epoch_ctor(epoch_t epoch)
 {
-   int domain, cpu_offset;
epoch_record_t er;
+   int cpu;
 
-   for (domain = 0; domain < vm_ndomains; domain++) {
-   er = malloc_domain(sizeof(*er) * domcount[domain], M_EPOCH,
-   domain, M_ZERO | M_WAITOK);
-   epoch->e_pcpu_dom[domain] = er;
-   cpu_offset = domoffsets[domain];
-   for (int i = 0; i < domcount[domain]; i++, er++) {
-   epoch->e_pcpu[cpu_offset + i] = er;
-   ck_epoch_register(&epoch->e_epoch, &er->er_record, 
NULL);
-   TAILQ_INIT((struct threadlist 
*)(uintptr_t)&er->er_tdlist);
-   er->er_cpuid = cpu_offset + i;
-   }
-   }
-}
-
-static void
-epoch_init_legacy(epoch_t epoch)
-{
-   epoch_record_t er;
-
-   er = malloc(sizeof(*er) * mp_ncpus, M_EPOCH, M_ZERO | M_WAITOK);
-   epoch->e_pcpu_dom[0] = er;
-   for (int i = 0; i < mp_ncpus; i++, er++) {
-   epoch->e_pcpu[i] = er;
+   epoch->e_pcpu_record = uma_zalloc_pcpu(pcpu_zone_record, M_WAITOK);
+   CPU_FOREACH(cpu) {
+   er = zpcpu_get_cpu(epoch->e_pcpu_record, cpu);
+   bzero(er, sizeof(*er));
ck_epoch_register(&epoch->e_epoch, &er->er_record, NULL);
TAILQ_INIT((struct threadlist *)(uintptr_t)&er->er_tdlist);
-   er->er_cpuid = i;
+   er->er_cpuid = cpu;
}
 }
 
@@ -204,13 +163,9 @@ epoch_alloc(int flags)
 
if (__predict_false(!inited))
panic("%s called too early in boot", __func__);
-   epoch = malloc(sizeof(struct epoch) + mp_ncpus * sizeof(void *),
-   M_EPOCH, M_ZERO | M_WAITOK);
+   epoch = malloc(sizeof(struct epoch), M_EPOCH, 

Re: svn commit: r336019 - in head: . usr.sbin/config

2018-07-05 Thread Bryan Drewery
On 7/5/18 6:53 PM, Kyle Evans wrote:
> On Thu, Jul 5, 2018 at 8:11 PM, Kyle Evans  wrote:
>> Author: kevans
>> Date: Fri Jul  6 01:11:06 2018
>> New Revision: 336019
>> URL: https://svnweb.freebsd.org/changeset/base/336019
>>
>> Log:
>>   config(8): De-dupe hint/env vars within a single file
>>
>>   r335653 flipped the order in which hints/env files are concatenated to 
>> match
>>   the order in which vars are processed by the kernel. This is the other
>>   hammer to drop.
>>
>>   Use nv(9) to de-dupe entries within a single `hint` or `env` file, using 
>> the
>>   latest value specified for a key. This leaves some duplicates if a variable
>>   is specified in multiple hint/env files or via `envvar` in a kernel config,
>>   but the reversed order of concatenation (from r335653) makes this a
>>   non-issue as the latest-specified version will be seen first.
>>
>>   This change also silently rewrote hint bits to use the same sanitization
>>   process that ian@ wrote for r335642. To the kernel, hints and env vars are
>>   basically the same thing through early boot, then get merged into the
>>   dynamic environment once kmem becomes available and the dynamic environment
>>   is created. They should be subjected to the same restrictions.
>>
>>   libnv has been added to -legacy for the time being to support the build of
>>   config(8) with the new cnvlist API.
>>
>>   Tested with:  universe (11 host & 12 host)
>>   MFC after:1 month
>>
> 
> This seems to be causing pretty consistent config(8) failures on CI,
> kernels with neither hints nor environment variables, that neither of
> my universe builds nor any of my post-commit builds can reproduce. Can
> anyone else reproduce these failures that might be willing to give me
> a hint as to what kind of setup causes this?
> 
> 01:47:58 cd /usr/src/sys/arm/conf;
> PATH=/usr/obj/usr/src/arm.armv7/tmp/legacy/usr/sbin:/usr/obj/usr/src/arm.armv7/tmp/legacy/usr/bin:/usr/obj/usr/src/arm.armv7/tmp/legacy/bin:/usr/obj/usr/src/arm.armv7/tmp/usr/sbin:/usr/obj/usr/src/arm.armv7/tmp/usr/bin:/sbin:/bin:/usr/sbin:/usr/bin
>  config  -d /usr/obj/usr/src/arm.armv7/sys/GENERIC  -I
> '/usr/src/sys/arm/conf' '/usr/src/sys/arm/conf/GENERIC'
> 01:47:58 config: /usr/src/sys/arm/conf/GENERIC: No error: 0
> 

I've seen this error with broken ABI. The -I${SRCTOP}/sys on the config
build may be contributing to the problem since sys/stat.h is ino64 and
the builder may not be.  Really should not be bringing in the source
sys/ directory for any of the early host tool phases. There's some hack
patterns to bring in a limited amount of headers but in this case the
headers should be getting staged somewhere already.
Note legacy:
${MAKE} DIRPRFX=${_tool}/ DESTDIR=${WORLDTMP}/legacy includes; \

So -IWORLDTMP/legacy/sys should find the nv headers. This is already
included via:
tools/build/mk/Makefile.boot:CFLAGS+=   -I${WORLDTMP}/legacy/usr/include
Which is brought in for bootstrap-tools though via:
MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}"


-- 
Regards,
Bryan Drewery



signature.asc
Description: OpenPGP digital signature


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

2018-07-05 Thread Rodney W. Grimes
[ Charset UTF-8 unsupported, converting... ]
> On 7/5/18 5:13 PM, Eugene Grosbein wrote:
> > 06.07.2018 6:59, John Baldwin wrote:
> > 
> >>> I'm not sure I understand the topic quite right, but please do not drop
> >>> MODULES_WITH_WORLD support at it allows us to quickly rebuild the kernel
> >>> in case of slight changes of its config file not changing ABI and/or
> >>> similar source changes without HUGE modules compilation overhead.
> >>
> >> This would not drop it, but it would mean that you can't necessarily 
> >> kldload
> >> /boot/kernel.GENERIC/foo.ko while running some other kernel.
> > 
> > And what's profit of such restriction? There were several cases
> > when I was forced to extract somemodule.ko from FreeBSD distribution files
> > and upload it to some customized installation such as FreeNAS or NAS4Free
> > or another one running custom kernel and having stripped-down module set 
> > out-of-the-box.
> > For example, ichwd.ko or something like that. And I was just happy I could 
> > do that and
> > that just work. Why should we break it?
> 
> You would still do that by 'cd /sys/modules/foo; make; scp foo.ko somebox:'
> 
> The profit of the restriction is performance.  Making kernel modules
> generic makes them slower by forcing them to indirect certain lightweight
> operations through function calls that the kernel itself performs inline
> (and "tied" modules would inline these same things).

I build custom kernels with the modules compiled in if I want performant
systems.  I remove all the stuff I do not need or want in GENERIC for the
same reason.

Trying to make loaded kernel modules performant by placing near static linked
kernel restrictions on them is not a direction I feel worth heading into as
it breaks just too many other use cases.

> The other benefit is
> that providing a convenient way to recompile modules from ports would 
> alleviate
> KBI breakage for ports such as nvidia-graphics and virtualbox-ose-kmod
> that can break since they use parts of the kernel for which we do not
> guarantee KBI stability.

Isnt that a totally seperate issue to this MODULE_TIED?

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

2018-07-05 Thread Rodney W. Grimes
> On 7/5/18 4:17 PM, Eugene Grosbein wrote:
> > 06.07.2018 1:21, John Baldwin wrote:
> > 
> >> Yes, this is a change though I find it the logical outcome of the original 
> >> change
> >> to move away from MODULES_WITH_WORLD.  And to be clear, Matt certainly only
> >> intended to use MODULE_TIED in a few places, but I think tagging all those
> >> places will be cumbersome and tedious compared to just doing it in this 
> >> way.  I
> >> think this will also tie into something I proposed earlier in a commit 
> >> reply and
> >> that I also brought up at BSDCan which is that I think that kernel modules 
> >> in
> >> ports should install their sources and build glue to some location we 
> >> choose
> >> (e.g. /usr/local/sys/modules/) and that we should support a variable 
> >> folks
> >> can set in their kernel config file similar to MODULES_OVERRIDE that is a 
> >> list
> >> of local modules to recompile and install into /boot/kernel along with 
> >> other
> >> modules (and that these recompiled modules would be TIED).  The binary 
> >> module
> >> from the package would still be present in /boot/modules, but the tied 
> >> module
> >> in /boot/kernel would be preferred and used instead when it exists (our 
> >> existing
> >> module_path already does this last part).  This would replace the existing
> >> PORTS_MODULES but in a way that is more graceful and works with packages, 
> >> not
> >> just ports IMO.
> > 
> > I'm not sure I understand the topic quite right, but please do not drop
> > MODULES_WITH_WORLD support at it allows us to quickly rebuild the kernel
> > in case of slight changes of its config file not changing ABI and/or
> > similar source changes without HUGE modules compilation overhead.
> 
> This would not drop it, but it would mean that you can't necessarily kldload
> /boot/kernel.GENERIC/foo.ko while running some other kernel.

Please do not break that!   If any module should continue to load with a
custom kernel it should be the ones built with GENERIC, as long as the
source code/KABI is unchanged why am I not being allowed to load this module?

> > Also, we should not use /usr/local/sys/modules/ as /usr/local
> > can be inaccessible for the loader. Better use /boot/modules/local or 
> > /boot/local
> > as /boot is guaranteed to be accessible.
> 
> You misunderstand.  /usr/local/sys/modules would hold module sources so that
> they can be recompiled when building a kernel without having to rebuild the
> package or reinstall the package.  Binary modules would continue to be
> installed in /boot/modules.

I like this part of it, as we discussed at BSDCan, this would in effect
fix the VirtualBox, kmod-next, and nvidia module issues we currently
face in stable/11.

> John Baldwin
-- 
Rod Grimes rgri...@freebsd.org
___
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: r336020 - in head/sys: amd64/include arm/include arm64/include i386/include kern mips/include powerpc/include riscv/include sparc64/include sys vm x86/acpica

2018-07-05 Thread Matt Macy
Author: mmacy
Date: Fri Jul  6 02:06:03 2018
New Revision: 336020
URL: https://svnweb.freebsd.org/changeset/base/336020

Log:
  Back pcpu zone with domain correct pages
  
  - Change pcpu zone consumers to use a stride size of PAGE_SIZE.
(defined as UMA_PCPU_ALLOC_SIZE to make future identification easier)
  
  - Allocate page from the correct domain for a given cpu.
  
  - Don't initialize pc_domain to non-zero value if NUMA is not defined
There are some misconceptions surrounding this field. It is the
_VM_ NUMA domain and should only ever correspond to valid domain
values as understood by the VM.
  
  The former slab size of sizeof(struct pcpu) was somewhat arbitrary.
  The new value is PAGE_SIZE because that's the smallest granularity
  which the VM can allocate a slab for a given domain. If you have
  fewer than PAGE_SIZE/8 counters on your system there will be some
  memory wasted, but this is obviously something where you want the
  cache line to be coming from the correct domain.
  
  Reviewed by: jeff
  Sponsored by: Limelight Networks
  Differential Revision:  https://reviews.freebsd.org/D15933

Modified:
  head/sys/amd64/include/counter.h
  head/sys/arm/include/counter.h
  head/sys/arm64/include/counter.h
  head/sys/i386/include/counter.h
  head/sys/kern/subr_counter.c
  head/sys/mips/include/counter.h
  head/sys/powerpc/include/counter.h
  head/sys/riscv/include/counter.h
  head/sys/sparc64/include/counter.h
  head/sys/sys/pcpu.h
  head/sys/vm/uma.h
  head/sys/vm/uma_core.c
  head/sys/x86/acpica/srat.c

Modified: head/sys/amd64/include/counter.h
==
--- head/sys/amd64/include/counter.hFri Jul  6 01:11:06 2018
(r336019)
+++ head/sys/amd64/include/counter.hFri Jul  6 02:06:03 2018
(r336020)
@@ -45,7 +45,7 @@ static inline uint64_t
 counter_u64_read_one(uint64_t *p, int cpu)
 {
 
-   return (*(uint64_t *)((char *)p + sizeof(struct pcpu) * cpu));
+   return (*(uint64_t *)((char *)p + UMA_PCPU_ALLOC_SIZE * cpu));
 }
 
 static inline uint64_t
@@ -65,7 +65,7 @@ static void
 counter_u64_zero_one_cpu(void *arg)
 {
 
-   *((uint64_t *)((char *)arg + sizeof(struct pcpu) *
+   *((uint64_t *)((char *)arg + UMA_PCPU_ALLOC_SIZE *
PCPU_GET(cpuid))) = 0;
 }
 

Modified: head/sys/arm/include/counter.h
==
--- head/sys/arm/include/counter.h  Fri Jul  6 01:11:06 2018
(r336019)
+++ head/sys/arm/include/counter.h  Fri Jul  6 02:06:03 2018
(r336020)
@@ -47,7 +47,7 @@ static inline uint64_t
 counter_u64_read_one(uint64_t *p, int cpu)
 {
 
-   return (atomic_load_64((uint64_t *)((char *)p + sizeof(struct pcpu) *
+   return (atomic_load_64((uint64_t *)((char *)p + UMA_PCPU_ALLOC_SIZE *
cpu)));
 }
 
@@ -68,7 +68,7 @@ static void
 counter_u64_zero_one_cpu(void *arg)
 {
 
-   atomic_store_64((uint64_t *)((char *)arg + sizeof(struct pcpu) *
+   atomic_store_64((uint64_t *)((char *)arg + UMA_PCPU_ALLOC_SIZE *
PCPU_GET(cpuid)), 0);
 }
 

Modified: head/sys/arm64/include/counter.h
==
--- head/sys/arm64/include/counter.hFri Jul  6 01:11:06 2018
(r336019)
+++ head/sys/arm64/include/counter.hFri Jul  6 02:06:03 2018
(r336020)
@@ -44,7 +44,7 @@ static inline uint64_t
 counter_u64_read_one(uint64_t *p, int cpu)
 {
 
-   return (*(uint64_t *)((char *)p + sizeof(struct pcpu) * cpu));
+   return (*(uint64_t *)((char *)p + UMA_PCPU_ALLOC_SIZE * cpu));
 }
 
 static inline uint64_t
@@ -64,7 +64,7 @@ static void
 counter_u64_zero_one_cpu(void *arg)
 {
 
-   *((uint64_t *)((char *)arg + sizeof(struct pcpu) *
+   *((uint64_t *)((char *)arg + UMA_PCPU_ALLOC_SIZE *
PCPU_GET(cpuid))) = 0;
 }
 

Modified: head/sys/i386/include/counter.h
==
--- head/sys/i386/include/counter.h Fri Jul  6 01:11:06 2018
(r336019)
+++ head/sys/i386/include/counter.h Fri Jul  6 02:06:03 2018
(r336020)
@@ -104,13 +104,13 @@ counter_u64_fetch_inline(uint64_t *p)
critical_enter();
CPU_FOREACH(i) {
res += *(uint64_t *)((char *)p +
-   sizeof(struct pcpu) * i);
+   UMA_PCPU_ALLOC_SIZE * i);
}
critical_exit();
} else {
CPU_FOREACH(i)
res += counter_u64_read_one_8b((uint64_t *)((char *)p +
-   sizeof(struct pcpu) * i));
+   UMA_PCPU_ALLOC_SIZE * i));
}
return (res);
 }
@@ -137,7 +137,7 @@ counter_u64_zero_one_cpu(void *arg)
 {
uint64_t *p;
 
-   p = (uint64_t *)((char *)arg + sizeof(struct pcpu) * PCPU_GET(cpuid));
+   

Re: svn commit: r336019 - in head: . usr.sbin/config

2018-07-05 Thread Kyle Evans
On Thu, Jul 5, 2018 at 8:11 PM, Kyle Evans  wrote:
> Author: kevans
> Date: Fri Jul  6 01:11:06 2018
> New Revision: 336019
> URL: https://svnweb.freebsd.org/changeset/base/336019
>
> Log:
>   config(8): De-dupe hint/env vars within a single file
>
>   r335653 flipped the order in which hints/env files are concatenated to match
>   the order in which vars are processed by the kernel. This is the other
>   hammer to drop.
>
>   Use nv(9) to de-dupe entries within a single `hint` or `env` file, using the
>   latest value specified for a key. This leaves some duplicates if a variable
>   is specified in multiple hint/env files or via `envvar` in a kernel config,
>   but the reversed order of concatenation (from r335653) makes this a
>   non-issue as the latest-specified version will be seen first.
>
>   This change also silently rewrote hint bits to use the same sanitization
>   process that ian@ wrote for r335642. To the kernel, hints and env vars are
>   basically the same thing through early boot, then get merged into the
>   dynamic environment once kmem becomes available and the dynamic environment
>   is created. They should be subjected to the same restrictions.
>
>   libnv has been added to -legacy for the time being to support the build of
>   config(8) with the new cnvlist API.
>
>   Tested with:  universe (11 host & 12 host)
>   MFC after:1 month
>

This seems to be causing pretty consistent config(8) failures on CI,
kernels with neither hints nor environment variables, that neither of
my universe builds nor any of my post-commit builds can reproduce. Can
anyone else reproduce these failures that might be willing to give me
a hint as to what kind of setup causes this?

01:47:58 cd /usr/src/sys/arm/conf;
PATH=/usr/obj/usr/src/arm.armv7/tmp/legacy/usr/sbin:/usr/obj/usr/src/arm.armv7/tmp/legacy/usr/bin:/usr/obj/usr/src/arm.armv7/tmp/legacy/bin:/usr/obj/usr/src/arm.armv7/tmp/usr/sbin:/usr/obj/usr/src/arm.armv7/tmp/usr/bin:/sbin:/bin:/usr/sbin:/usr/bin
 config  -d /usr/obj/usr/src/arm.armv7/sys/GENERIC  -I
'/usr/src/sys/arm/conf' '/usr/src/sys/arm/conf/GENERIC'
01:47:58 config: /usr/src/sys/arm/conf/GENERIC: No error: 0

Thanks,

Kyle Evans
___
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: r335979 - in head: . lib/libkvm sys/kern sys/netinet sys/sys usr.bin/netstat usr.bin/sockstat

2018-07-05 Thread Matthew Macy
this breaks the MIPS builds.

On Thu, Jul 5, 2018 at 9:33 AM, Brooks Davis  wrote:
> On Thu, Jul 05, 2018 at 09:10:54AM -0700, Ravi Pokala wrote:
>> Hi Brooks,
>>
>> -Original Message-
>> From:  on behalf of Brooks Davis 
>> 
>> Date: 2018-07-05, Thursday at 06:13
>> To: , , 
>> 
>> Subject: svn commit: r335979 - in head: . lib/libkvm sys/kern sys/netinet 
>> sys/sys usr.bin/netstat usr.bin/sockstat
>>
>> > Author: brooks
>> > Date: Thu Jul  5 13:13:48 2018
>> > New Revision: 335979
>> > URL: https://svnweb.freebsd.org/changeset/base/335979
>> >
>> > Log:
>> >   Make struct xinpcb and friends word-size independent.
>> >
>> >   Replace size_t members with ksize_t (uint64_t) and pointer members
>> >   (never used as pointers in userspace, but instead as unique
>> >   idenitifiers) with kvaddr_t (uint64_t). This makes the structs
>> >   identical between 32-bit and 64-bit ABIs.
>> ...
>> > Modified: head/UPDATING
>> > ==
>> > --- head/UPDATING   Thu Jul  5 11:50:59 2018(r335978)
>> > +++ head/UPDATING   Thu Jul  5 13:13:48 2018(r335979)
>> > @@ -31,6 +31,14 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW:
>> > disable the most expensive debugging functionality run
>> > "ln -s 'abort:false,junk:false' /etc/malloc.conf".)
>> >
>> > +20180705:
>> > +   The ABI of syscalls used by management tools like sockstat and
>> > +   netstat has been broken to allow 32-bit binaries to work on
>> > +   64-bit kernels without modification.
>>
>> Isn't that what the compat32 layer is for?
>
> compat32 isn't magic.  If one tried, one could hardly design structures
> to make 32-bit compat harder then the previous versions.  It's certainly
> possible to make work, but quite annoying.  Since the ABI of most these
> structures was already broken for 12, I chose this approach as it is
> quite trivial.
>
>> > These programs will need
>> > +   to match the kernel in order to function.  External programs may
>> > +   require minor modifications to accommodate a change of type in
>> > +   structures from pointers to 64-bit virtual addresses.
>>
>> Doesn't this contradict the earlier statement about letting things run 
>> unmodified?
>
> Unmodified post this commit.  We already don't support netstat and
> sockstat from 11 on 12 in any architecture combination.
>
> -- Brooks
___
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: r336019 - in head: . usr.sbin/config

2018-07-05 Thread Kyle Evans
Author: kevans
Date: Fri Jul  6 01:11:06 2018
New Revision: 336019
URL: https://svnweb.freebsd.org/changeset/base/336019

Log:
  config(8): De-dupe hint/env vars within a single file
  
  r335653 flipped the order in which hints/env files are concatenated to match
  the order in which vars are processed by the kernel. This is the other
  hammer to drop.
  
  Use nv(9) to de-dupe entries within a single `hint` or `env` file, using the
  latest value specified for a key. This leaves some duplicates if a variable
  is specified in multiple hint/env files or via `envvar` in a kernel config,
  but the reversed order of concatenation (from r335653) makes this a
  non-issue as the latest-specified version will be seen first.
  
  This change also silently rewrote hint bits to use the same sanitization
  process that ian@ wrote for r335642. To the kernel, hints and env vars are
  basically the same thing through early boot, then get merged into the
  dynamic environment once kmem becomes available and the dynamic environment
  is created. They should be subjected to the same restrictions.
  
  libnv has been added to -legacy for the time being to support the build of
  config(8) with the new cnvlist API.
  
  Tested with:  universe (11 host & 12 host)
  MFC after:1 month

Modified:
  head/Makefile.inc1
  head/usr.sbin/config/Makefile
  head/usr.sbin/config/mkmakefile.c

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Fri Jul  6 00:58:51 2018(r336018)
+++ head/Makefile.inc1  Fri Jul  6 01:11:06 2018(r336019)
@@ -1941,13 +1941,19 @@ update: .PHONY
 _elftoolchain_libs= lib/libelf lib/libdwarf
 .endif
 
+# An updated libnv is needed for the cnv(9) API used in config(8).
+# r335343 stabilized the cnvlist API used by config(8)
+.if ${BOOTSTRAPPING} < 1200070
+_libnv=lib/libnv
+.endif
+
 legacy: .PHONY
 .if ${BOOTSTRAPPING} < ${MINIMUM_SUPPORTED_OSREL} && ${BOOTSTRAPPING} != 0
@echo "ERROR: Source upgrades from versions prior to 
${MINIMUM_SUPPORTED_REL} are not supported."; \
false
 .endif
 
-.for _tool in tools/build ${_elftoolchain_libs}
+.for _tool in tools/build ${_elftoolchain_libs} ${_libnv}
${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,all,install)"; \
cd ${.CURDIR}/${_tool}; \
if [ -z "${NO_OBJWALK}" ]; then ${MAKE} DIRPRFX=${_tool}/ obj; fi; \

Modified: head/usr.sbin/config/Makefile
==
--- head/usr.sbin/config/Makefile   Fri Jul  6 00:58:51 2018
(r336018)
+++ head/usr.sbin/config/Makefile   Fri Jul  6 01:11:06 2018
(r336019)
@@ -14,11 +14,11 @@ kernconf.c: kernconf.tmpl
${FILE2C} 'char kernconfstr[] = {' ',0};' < \
${SRCDIR}/kernconf.tmpl > kernconf.c
 
-CFLAGS+= -I. -I${SRCDIR}
+CFLAGS+= -I. -I${SRCDIR} -I${SRCTOP}/sys
 
 NO_WMISSING_VARIABLE_DECLARATIONS=
 
-LIBADD=l sbuf
+LIBADD=l nv sbuf
 
 CLEANFILES+=   kernconf.c
 

Modified: head/usr.sbin/config/mkmakefile.c
==
--- head/usr.sbin/config/mkmakefile.c   Fri Jul  6 00:58:51 2018
(r336018)
+++ head/usr.sbin/config/mkmakefile.c   Fri Jul  6 01:11:06 2018
(r336019)
@@ -49,6 +49,8 @@ static const char rcsid[] =
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include "y.tab.h"
 #include "config.h"
@@ -62,6 +64,10 @@ static void do_objs(FILE *);
 static void do_before_depend(FILE *);
 static int opteq(const char *, const char *);
 static void read_files(void);
+static void sanitize_envline(char *result, const char *src);
+static void process_into_file(char *line, FILE *ofp);
+static void process_into_nvlist(char *line, nvlist_t *nvl);
+static void dump_nvlist(nvlist_t *nvl, FILE *ofp);
 
 static void errout(const char *fmt, ...)
 {
@@ -180,64 +186,6 @@ makefile(void)
moveifchanged(path("Makefile.new"), path("Makefile"));
 }
 
-/*
- * Build hints.c from the skeleton
- */
-void
-makehints(void)
-{
-   FILE *ifp, *ofp;
-   char line[BUFSIZ];
-   char *s;
-   struct hint *hint;
-
-   ofp = fopen(path("hints.c.new"), "w");
-   if (ofp == NULL)
-   err(1, "%s", path("hints.c.new"));
-   fprintf(ofp, "#include \n");
-   fprintf(ofp, "#include \n");
-   fprintf(ofp, "\n");
-   fprintf(ofp, "char static_hints[] = {\n");
-   STAILQ_FOREACH(hint, &hints, hint_next) {
-   ifp = fopen(hint->hint_name, "r");
-   if (ifp == NULL)
-   err(1, "%s", hint->hint_name);
-   while (fgets(line, BUFSIZ, ifp) != NULL) {
-   /* zap trailing CR and/or LF */
-   while ((s = strrchr(line, '\n')) != NULL)
-   *s = '\0';
-   while ((s = strrchr(line, '\r')) != NULL)
-

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

2018-07-05 Thread Eugene Grosbein
06.07.2018 7:20, John Baldwin wrote:

>> And what's profit of such restriction? There were several cases
>> when I was forced to extract somemodule.ko from FreeBSD distribution files
>> and upload it to some customized installation such as FreeNAS or NAS4Free
>> or another one running custom kernel and having stripped-down module set 
>> out-of-the-box.
>> For example, ichwd.ko or something like that. And I was just happy I could 
>> do that and
>> that just work. Why should we break it?
> 
> You would still do that by 'cd /sys/modules/foo; make; scp foo.ko somebox:'

May I suggest that release installation media would provide two copies of 
modules/
directory for one major release, one with tied modules for performance
and another set (not installed by default) with "un-tied" for reference?

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

2018-07-05 Thread Eugene Grosbein
06.07.2018 7:20, John Baldwin wrote:

>>> This would not drop it, but it would mean that you can't necessarily kldload
>>> /boot/kernel.GENERIC/foo.ko while running some other kernel.
>>
>> And what's profit of such restriction? There were several cases
>> when I was forced to extract somemodule.ko from FreeBSD distribution files
>> and upload it to some customized installation such as FreeNAS or NAS4Free
>> or another one running custom kernel and having stripped-down module set 
>> out-of-the-box.
>> For example, ichwd.ko or something like that. And I was just happy I could 
>> do that and
>> that just work. Why should we break it?
> 
> You would still do that by 'cd /sys/modules/foo; make; scp foo.ko somebox:'

Yes, provided I have a buildbox handy.

> The profit of the restriction is performance.  Making kernel modules
> generic makes them slower by forcing them to indirect certain lightweight
> operations through function calls that the kernel itself performs inline
> (and "tied" modules would inline these same things).  The other benefit is
> that providing a convenient way to recompile modules from ports would 
> alleviate
> KBI breakage for ports such as nvidia-graphics and virtualbox-ose-kmod
> that can break since they use parts of the kernel for which we do not
> guarantee KBI stability.

Thanks, now I got 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: r335916 - head/sys/conf

2018-07-05 Thread John Baldwin
On 7/5/18 5:13 PM, Eugene Grosbein wrote:
> 06.07.2018 6:59, John Baldwin wrote:
> 
>>> I'm not sure I understand the topic quite right, but please do not drop
>>> MODULES_WITH_WORLD support at it allows us to quickly rebuild the kernel
>>> in case of slight changes of its config file not changing ABI and/or
>>> similar source changes without HUGE modules compilation overhead.
>>
>> This would not drop it, but it would mean that you can't necessarily kldload
>> /boot/kernel.GENERIC/foo.ko while running some other kernel.
> 
> And what's profit of such restriction? There were several cases
> when I was forced to extract somemodule.ko from FreeBSD distribution files
> and upload it to some customized installation such as FreeNAS or NAS4Free
> or another one running custom kernel and having stripped-down module set 
> out-of-the-box.
> For example, ichwd.ko or something like that. And I was just happy I could do 
> that and
> that just work. Why should we break it?

You would still do that by 'cd /sys/modules/foo; make; scp foo.ko somebox:'

The profit of the restriction is performance.  Making kernel modules
generic makes them slower by forcing them to indirect certain lightweight
operations through function calls that the kernel itself performs inline
(and "tied" modules would inline these same things).  The other benefit is
that providing a convenient way to recompile modules from ports would alleviate
KBI breakage for ports such as nvidia-graphics and virtualbox-ose-kmod
that can break since they use parts of the kernel for which we do not
guarantee KBI stability.

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

2018-07-05 Thread Eugene Grosbein
06.07.2018 6:59, John Baldwin wrote:

>> I'm not sure I understand the topic quite right, but please do not drop
>> MODULES_WITH_WORLD support at it allows us to quickly rebuild the kernel
>> in case of slight changes of its config file not changing ABI and/or
>> similar source changes without HUGE modules compilation overhead.
> 
> This would not drop it, but it would mean that you can't necessarily kldload
> /boot/kernel.GENERIC/foo.ko while running some other kernel.

And what's profit of such restriction? There were several cases
when I was forced to extract somemodule.ko from FreeBSD distribution files
and upload it to some customized installation such as FreeNAS or NAS4Free
or another one running custom kernel and having stripped-down module set 
out-of-the-box.
For example, ichwd.ko or something like that. And I was just happy I could do 
that and
that just work. Why should we break 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: r335916 - head/sys/conf

2018-07-05 Thread John Baldwin
On 7/5/18 4:17 PM, Eugene Grosbein wrote:
> 06.07.2018 1:21, John Baldwin wrote:
> 
>> Yes, this is a change though I find it the logical outcome of the original 
>> change
>> to move away from MODULES_WITH_WORLD.  And to be clear, Matt certainly only
>> intended to use MODULE_TIED in a few places, but I think tagging all those
>> places will be cumbersome and tedious compared to just doing it in this way. 
>>  I
>> think this will also tie into something I proposed earlier in a commit reply 
>> and
>> that I also brought up at BSDCan which is that I think that kernel modules in
>> ports should install their sources and build glue to some location we choose
>> (e.g. /usr/local/sys/modules/) and that we should support a variable 
>> folks
>> can set in their kernel config file similar to MODULES_OVERRIDE that is a 
>> list
>> of local modules to recompile and install into /boot/kernel along with other
>> modules (and that these recompiled modules would be TIED).  The binary module
>> from the package would still be present in /boot/modules, but the tied module
>> in /boot/kernel would be preferred and used instead when it exists (our 
>> existing
>> module_path already does this last part).  This would replace the existing
>> PORTS_MODULES but in a way that is more graceful and works with packages, not
>> just ports IMO.
> 
> I'm not sure I understand the topic quite right, but please do not drop
> MODULES_WITH_WORLD support at it allows us to quickly rebuild the kernel
> in case of slight changes of its config file not changing ABI and/or
> similar source changes without HUGE modules compilation overhead.

This would not drop it, but it would mean that you can't necessarily kldload
/boot/kernel.GENERIC/foo.ko while running some other kernel.

> Also, we should not use /usr/local/sys/modules/ as /usr/local
> can be inaccessible for the loader. Better use /boot/modules/local or 
> /boot/local
> as /boot is guaranteed to be accessible.

You misunderstand.  /usr/local/sys/modules would hold module sources so that
they can be recompiled when building a kernel without having to rebuild the
package or reinstall the package.  Binary modules would continue to be
installed in /boot/modules.

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

2018-07-05 Thread Eugene Grosbein
06.07.2018 1:21, John Baldwin wrote:

> Yes, this is a change though I find it the logical outcome of the original 
> change
> to move away from MODULES_WITH_WORLD.  And to be clear, Matt certainly only
> intended to use MODULE_TIED in a few places, but I think tagging all those
> places will be cumbersome and tedious compared to just doing it in this way.  
> I
> think this will also tie into something I proposed earlier in a commit reply 
> and
> that I also brought up at BSDCan which is that I think that kernel modules in
> ports should install their sources and build glue to some location we choose
> (e.g. /usr/local/sys/modules/) and that we should support a variable 
> folks
> can set in their kernel config file similar to MODULES_OVERRIDE that is a list
> of local modules to recompile and install into /boot/kernel along with other
> modules (and that these recompiled modules would be TIED).  The binary module
> from the package would still be present in /boot/modules, but the tied module
> in /boot/kernel would be preferred and used instead when it exists (our 
> existing
> module_path already does this last part).  This would replace the existing
> PORTS_MODULES but in a way that is more graceful and works with packages, not
> just ports IMO.

I'm not sure I understand the topic quite right, but please do not drop
MODULES_WITH_WORLD support at it allows us to quickly rebuild the kernel
in case of slight changes of its config file not changing ABI and/or
similar source changes without HUGE modules compilation overhead.

Also, we should not use /usr/local/sys/modules/ as /usr/local
can be inaccessible for the loader. Better use /boot/modules/local or 
/boot/local
as /boot is guaranteed to be accessible.

___
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: r336017 - in head: include/rpcsvc lib/libutil libexec/rpc.rquotad sys/cddl/contrib/opensolaris/uts/common/fs/zfs usr.bin/quota

2018-07-05 Thread Sean Eric Fagan
Author: sef
Date: Thu Jul  5 22:56:13 2018
New Revision: 336017
URL: https://svnweb.freebsd.org/changeset/base/336017

Log:
  This exposes ZFS user and group quotas via the normal
  quatactl(2) mechanism.  (Read-only at this point, however.)
  In particular, this is to allow rpc.rquotad query quotas
  for NFS mounts, allowing users to see their quotas on the
  hosts using the datasets.
  
  The changes specifically:
  
  * Add new RPC entry points for querying quotas.
  * Changes the library routines to allow non-UFS quotas.
  * Changes rquotad to check for quotas on mounted filesystems,
  rather than being limited to entries in /etc/fstab
  * Lastly, adds a VFS entry-point for ZFS to query quotas.
  
  Note that this makes one unavoidable behavioural change: if quotas
  are enabled, then they can be queried, as opposed to the current
  method of checking for quotas being specified in fstab.  (With
  ZFS, if there are user or group quotas, they're used, always.)
  
  Reviewed by:  delphij, mav
  Approved by:  mav
  Sponsored by: iXsystems Inc
  Differential Revision:https://reviews.freebsd.org/D15886

Modified:
  head/include/rpcsvc/rquota.x
  head/lib/libutil/quotafile.c
  head/libexec/rpc.rquotad/rquotad.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
  head/usr.bin/quota/quota.c

Modified: head/include/rpcsvc/rquota.x
==
--- head/include/rpcsvc/rquota.xThu Jul  5 21:38:54 2018
(r336016)
+++ head/include/rpcsvc/rquota.xThu Jul  5 22:56:13 2018
(r336017)
@@ -1,24 +1,55 @@
+/* @(#)rquota.x2.1 88/08/01 4.0 RPCSRC */
+/* @(#)rquota.x 1.2 87/09/20 Copyr 1987 Sun Micro */
+
 /*
  * Remote quota protocol
  * Requires unix authentication
  */
 
 #ifndef RPC_HDR
-%#ifndef lint
-%/*static char sccsid[] = "from: @(#)rquota.x 1.2 87/09/20 Copyr 1987 Sun 
Micro";*/
-%/*static char sccsid[] = "from: @(#)rquota.x  2.1 88/08/01 4.0 RPCSRC";*/
-%#endif /* not lint */
 %#include 
 %__FBSDID("$FreeBSD$");
 #endif
 
 const RQ_PATHLEN = 1024;
 
+struct sq_dqblk {
+   unsigned int rq_bhardlimit; /* absolute limit on disk blks alloc */
+   unsigned int rq_bsoftlimit; /* preferred limit on disk blks */
+   unsigned int rq_curblocks;  /* current block count */
+   unsigned int rq_fhardlimit; /* absolute limit on allocated files */
+   unsigned int rq_fsoftlimit; /* preferred file limit */
+   unsigned int rq_curfiles;   /* current # allocated files */
+   unsigned int rq_btimeleft;  /* time left for excessive disk use */
+   unsigned int rq_ftimeleft;  /* time left for excessive files */
+};
+
 struct getquota_args {
string gqa_pathp;   /* path to filesystem of interest */
-   int gqa_uid;/* inquire about quota for uid */
+   int gqa_uid;/* Inquire about quota for uid */
 };
 
+struct setquota_args {
+   int sqa_qcmd;
+   string sqa_pathp;   /* path to filesystem of interest */
+   int sqa_id; /* Set quota for uid */
+   sq_dqblk sqa_dqblk;
+};
+
+struct ext_getquota_args {
+   string gqa_pathp;   /* path to filesystem of interest */
+   int gqa_type;   /* Type of quota info is needed about */
+   int gqa_id; /* Inquire about quota for id */
+};
+
+struct ext_setquota_args {
+   int sqa_qcmd;
+   string sqa_pathp;   /* path to filesystem of interest */
+   int sqa_id; /* Set quota for id */
+   int sqa_type;   /* Type of quota to set */
+   sq_dqblk sqa_dqblk;
+};
+
 /*
  * remote quota structure
  */
@@ -37,7 +68,7 @@ struct rquota {
 
 enum gqr_status {
Q_OK = 1,   /* quota returned */
-   Q_NOQUOTA = 2,  /* noquota for uid */
+   Q_NOQUOTA = 2,  /* noquota for uid */
Q_EPERM = 3 /* no permission to access quota */
 };
 
@@ -50,6 +81,15 @@ case Q_EPERM:
void;
 };
 
+union setquota_rslt switch (gqr_status status) {
+case Q_OK:
+   rquota sqr_rquota;  /* valid if status == Q_OK */
+case Q_NOQUOTA:
+   void;
+case Q_EPERM:
+   void;
+};
+
 program RQUOTAPROG {
version RQUOTAVERS {
/*
@@ -63,5 +103,42 @@ program RQUOTAPROG {
 */
getquota_rslt
RQUOTAPROC_GETACTIVEQUOTA(getquota_args) = 2;
+
+   /*
+* Set all quotas
+*/
+   setquota_rslt
+   RQUOTAPROC_SETQUOTA(setquota_args) = 3;
+
+   /*
+* Get active quotas only
+*/
+   setquota_rslt
+   RQUOTAPROC_SETACTIVEQUOTA(setquota_args) = 4;
} = 1;
+   version EXT_RQUOTAVERS {
+   /*
+* Get all quotas
+*/
+   getquota_rslt
+  

svn commit: r336016 - head/sys/dev/ath

2018-07-05 Thread Conrad Meyer
Author: cem
Date: Thu Jul  5 21:38:54 2018
New Revision: 336016
URL: https://svnweb.freebsd.org/changeset/base/336016

Log:
  ath(4): Fix typo in debugging code
  
  PR:   229548
  Submitted by: David Binderman 

Modified:
  head/sys/dev/ath/if_ath.c

Modified: head/sys/dev/ath/if_ath.c
==
--- head/sys/dev/ath/if_ath.c   Thu Jul  5 20:20:06 2018(r336015)
+++ head/sys/dev/ath/if_ath.c   Thu Jul  5 21:38:54 2018(r336016)
@@ -2151,7 +2151,7 @@ ath_intr(void *arg)
if (ah->ah_syncstate != 0) {
int i;
for (i = 0; i < 32; i++)
-   if (ah->ah_syncstate & (i << i))
+   if (ah->ah_syncstate & (1 << i))
sc->sc_intr_stats.sync_intr[i]++;
}
 
___
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: r335967 - head/sys/dev/mxge

2018-07-05 Thread Rick Macklem
Andrew Gallatin wrote:
On 7/4/18 9:20 PM, Rodney W. Grimes wrote:
[stuff snipped]
>>
>> It is using a magic constant twice, where one has a
>> derived value that is dependent on the value of the other.
>> That is bad and error prone and does not document that
>> one depends on the other.  Please fix this.  Or at least
>> make 65536 a #define so that it only needs changed one
>> place and clearly shows the interdependence of these
>> values.
>
>To me, 65536 is one of the few cases where the magic number is
>more meaningful than a name.  But fine, if you feel that
>strongly about it, I'll change it for you.

Btw, in general, if_hw_tsomax and if_hw_tsomaxsegsize are not
related or the same value. It just happens that they both appear
to be related to 64K in this case. (I believe this is fairly common,
since the original Microsoft "standard" used 64K as a limit, since
it was stored in 16bits.)

if_hw_tsomax is the maximum size of the entire TSO segment,
including MAC level headers (commonly 64K, due to Mircosoft...
but could be larger if the hardware guys chose to do so).

if_hw_tsomaxsegsize is the maximum size of contiguous memory
that a "chunk" of the TSO segment can be stored in for handling by
the driver's transmit side. Since higher
level code such as NFS (and iSCSI, I think?) uses MCLBYTE clusters,
anything 2K or higher normally works the same.  Not sure about
sosend(), but I think it also copies the data into MCLBYTE clusters?
This would change if someday jumbo mbuf clusters become the norm.
(I tried changing the NFS code to use jumbo clusters, but it would
 result in fragmentation of the memory used for mbuf cluster allocation,
 so I never committed it.)

rick
ps: And I'll admit I don't find 65536 very magic;-)


___
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: r336002 - in head: usr.bin/netstat usr.sbin/tcpdrop [ as-of -r336013: still broken: ci.freebsd.org FreeBSD-head-{mips,powerpc,powerpcspe}-build

2018-07-05 Thread Mark Millard via svn-src-head
> Author: brooks
> Date: Thu Jul  5 17:02:10 2018
> New Revision: 336002
> URL: 
> https://svnweb.freebsd.org/changeset/base/336002
> 
> 
> Log:
>   Work around lame warnings in ancient gcc on 32-bit platforms.
>   
>   Fixes r335979.


[The below are the gcc 4.2.1 based 32-bit architectures.]

https://ci.freebsd.org/job/FreeBSD-head-mips-build/3192/consoleText shows
(as an example):

--- kern_descrip.o ---
cc1: warnings being treated as errors
/usr/src/sys/kern/kern_descrip.c: In function 'sysctl_kern_file':
/usr/src/sys/kern/kern_descrip.c:3365: warning: cast from pointer to integer of 
different size [-Wpointer-to-int-cast]
/usr/src/sys/kern/kern_descrip.c:3366: warning: cast from pointer to integer of 
different size [-Wpointer-to-int-cast]
/usr/src/sys/kern/kern_descrip.c:3367: warning: cast from pointer to integer of 
different size [-Wpointer-to-int-cast]

powerpc and powerpcspe agree.

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


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

2018-07-05 Thread John Baldwin
On 7/5/18 11:39 AM, Konstantin Belousov wrote:
> On Thu, Jul 05, 2018 at 11:21:28AM -0700, John Baldwin wrote:
>> On 7/5/18 8:54 AM, Konstantin Belousov wrote:
>>> On Thu, Jul 05, 2018 at 07:56:22AM -0700, John Baldwin wrote:
 On 7/4/18 7:22 AM, Konstantin Belousov wrote:
> On Tue, Jul 03, 2018 at 11:05:42PM +, Matt Macy wrote:
>> Author: mmacy
>> Date: Tue Jul  3 23:05:42 2018
>> New Revision: 335916
>> URL: https://svnweb.freebsd.org/changeset/base/335916
>>
>> Log:
>>   Enable MODULE_TIED by default for modules compiled with the kernel
> But why ?

 I think we should enable KLD_TIED to inline critical_* etc. for modules
 built as part of a kernel that are installed alongside the kernel in 
 /boot/.
>>>
 I don't think we need to support modules built with kernel A loaded into 
 kernel B.

>>> This is the crusial point.  I do not object, but this this is a radical
>>> change from the previous mode of modules build.
>>>
>>> I do not want to put words in other person mouth, but I beliee that the
>>> original intent of KLD_TIED/MODULE_TIED was much more limited.  Only some
>>> specific modules were to be tied.
>>
>> Yes, this is a change though I find it the logical outcome of the original 
>> change
>> to move away from MODULES_WITH_WORLD.  And to be clear, Matt certainly only
>> intended to use MODULE_TIED in a few places, but I think tagging all those
>> places will be cumbersome and tedious compared to just doing it in this way. 
>>  I
>> think this will also tie into something I proposed earlier in a commit reply 
>> and
>> that I also brought up at BSDCan which is that I think that kernel modules in
>> ports should install their sources and build glue to some location we choose
>> (e.g. /usr/local/sys/modules/) and that we should support a variable 
>> folks
>> can set in their kernel config file similar to MODULES_OVERRIDE that is a 
>> list
>> of local modules to recompile and install into /boot/kernel along with other
>> modules (and that these recompiled modules would be TIED).  The binary module
>> from the package would still be present in /boot/modules, but the tied module
>> in /boot/kernel would be preferred and used instead when it exists (our 
>> existing
>> module_path already does this last part).  This would replace the existing
>> PORTS_MODULES but in a way that is more graceful and works with packages, not
>> just ports IMO.
>>
> 
> I probably need to say more explicit why this change made me surprised,
> and the surprise is fueled even more by your proposal.  It basically
> means that we do not need stable KBI, and detecting KBI breakage in such
> setup is practically impossible.  Most consumers would be recompiled,
> except the modules used in very specific scenario:  inter-release updates
> with the modules used from the portmgr-provided packages while packages
> are still built against the older release.
> 
> Again, I do not object against the proposed new world order, I do not
> believe that KBI stability gives positive value comparing with the burden
> and restrictions it puts on the liveness of the stable branches.
> 
> But I do believe that the migration to such new attitude to the kernel
> interfaces would benefit from the discussion.

I am not quite saying to abolish KBI as I don't think we need to ban the
ability to build standalone modules.  I just think that modules built with
a kernel should be tied to that kernel.  In particular as there is a push to
move from GENERIC towards MINIMAL, where more things like drivers are pulled
from modules instead of the base kernel file, there is a need for modules
built with the kernel to be less pessimized.  It is actually that factor more
than others that makes me want to tie modules built with a kernel to the
kernel.

-- 
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: r336012 - in head: . usr.sbin/config [ broken for ci.freebsd.org's FreeBSD-head-{sparc64,powerpcspe,powerpc,i386,armv7}-build

2018-07-05 Thread Mark Millard via svn-src-head
Examples:

https://ci.freebsd.org/job/FreeBSD-head-armv7-build/568/console shows:

18:54:11 
--- _bootstrap-tools-usr.sbin/config ---

18:54:11 
mkmakefile.o: In function `dump_nvlist':

18:54:11 
/usr/src/usr.sbin/config/mkmakefile.c:287: undefined reference to 
`cnvlist_get_string'

18:54:11 
/usr/src/usr.sbin/config/mkmakefile.c:289: undefined reference to 
`cnvlist_free_string'

18:54:11 
cc: error: linker command failed with exit code 1 (use -v to see invocation)

18:54:11 
*** [config.full] Error code 1

(i386 agrees.)


As for gcc 4.2.1 (32-bit and 64-bit targets), an example:

https://ci.freebsd.org/job/FreeBSD-head-powerpcspe-build/ shows:

--
>>> stage 1: configuring the kernel
--
cd /usr/src/sys/powerpc/conf;  
PATH=/usr/obj/usr/src/powerpc.powerpcspe/tmp/legacy/usr/sbin:/usr/obj/usr/src/powerpc.powerpcspe/tmp/legacy/usr/bin:/usr/obj/usr/src/powerpc.powerpcspe/tmp/legacy/bin:/usr/obj/usr/src/powerpc.powerpcspe/tmp/usr/sbin:/usr/obj/usr/src/powerpc.powerpcspe/tmp/usr/bin:/sbin:/bin:/usr/sbin:/usr/bin
  config  -d /usr/obj/usr/src/powerpc.powerpcspe/sys/MPC85XXSPE  -I 
'/usr/src/sys/powerpc/conf' '/usr/src/sys/powerpc/conf/MPC85XXSPE'
config: /usr/src/sys/powerpc/conf/MPC85XXSPE: No error: 0
*** [buildkernel] Error code 2



===
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: r336013 - in head: . usr.sbin/config

2018-07-05 Thread Kyle Evans
Author: kevans
Date: Thu Jul  5 18:55:42 2018
New Revision: 336013
URL: https://svnweb.freebsd.org/changeset/base/336013

Log:
  Revert r336011,r336012 until I can competently test

Modified:
  head/Makefile.inc1
  head/usr.sbin/config/Makefile
  head/usr.sbin/config/mkmakefile.c

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Thu Jul  5 18:39:02 2018(r336012)
+++ head/Makefile.inc1  Thu Jul  5 18:55:42 2018(r336013)
@@ -2063,15 +2063,6 @@ _kerberos5_bootstrap_tools= \
 .ORDER: ${_kerberos5_bootstrap_tools:C/^/${_bt}-/g}
 .endif
 
-# Later config(8) requires newer libnv cnvlist* API
-.if ${BOOTSTRAPPING} < 1200070
-_config= \
-   lib/libnv \
-   usr.sbin/config
-.else
-_config= usr.sbin/config
-.endif
-
 ${_bt}-usr.bin/mandoc: ${_bt}-lib/libopenbsd
 
 bootstrap-tools: .PHONY
@@ -2096,7 +2087,7 @@ bootstrap-tools: .PHONY
 ${_lex} \
 usr.bin/xinstall \
 ${_gensnmptree} \
-${_config} \
+usr.sbin/config \
 ${_crunchide} \
 ${_crunchgen} \
 ${_nmtree} \

Modified: head/usr.sbin/config/Makefile
==
--- head/usr.sbin/config/Makefile   Thu Jul  5 18:39:02 2018
(r336012)
+++ head/usr.sbin/config/Makefile   Thu Jul  5 18:55:42 2018
(r336013)
@@ -14,11 +14,11 @@ kernconf.c: kernconf.tmpl
${FILE2C} 'char kernconfstr[] = {' ',0};' < \
${SRCDIR}/kernconf.tmpl > kernconf.c
 
-CFLAGS+= -I. -I${SRCDIR} -I${SRCTOP}/sys
+CFLAGS+= -I. -I${SRCDIR}
 
 NO_WMISSING_VARIABLE_DECLARATIONS=
 
-LIBADD=l nv sbuf
+LIBADD=l sbuf
 
 CLEANFILES+=   kernconf.c
 

Modified: head/usr.sbin/config/mkmakefile.c
==
--- head/usr.sbin/config/mkmakefile.c   Thu Jul  5 18:39:02 2018
(r336012)
+++ head/usr.sbin/config/mkmakefile.c   Thu Jul  5 18:55:42 2018
(r336013)
@@ -49,8 +49,6 @@ static const char rcsid[] =
 #include 
 #include 
 #include 
-#include 
-#include 
 #include 
 #include "y.tab.h"
 #include "config.h"
@@ -64,10 +62,6 @@ static void do_objs(FILE *);
 static void do_before_depend(FILE *);
 static int opteq(const char *, const char *);
 static void read_files(void);
-static void sanitize_envline(char *result, const char *src);
-static void process_into_file(char *line, FILE *ofp);
-static void process_into_nvlist(char *line, nvlist_t *nvl);
-static void dump_nvlist(nvlist_t *nvl, FILE *ofp);
 
 static void errout(const char *fmt, ...)
 {
@@ -186,6 +180,64 @@ makefile(void)
moveifchanged(path("Makefile.new"), path("Makefile"));
 }
 
+/*
+ * Build hints.c from the skeleton
+ */
+void
+makehints(void)
+{
+   FILE *ifp, *ofp;
+   char line[BUFSIZ];
+   char *s;
+   struct hint *hint;
+
+   ofp = fopen(path("hints.c.new"), "w");
+   if (ofp == NULL)
+   err(1, "%s", path("hints.c.new"));
+   fprintf(ofp, "#include \n");
+   fprintf(ofp, "#include \n");
+   fprintf(ofp, "\n");
+   fprintf(ofp, "char static_hints[] = {\n");
+   STAILQ_FOREACH(hint, &hints, hint_next) {
+   ifp = fopen(hint->hint_name, "r");
+   if (ifp == NULL)
+   err(1, "%s", hint->hint_name);
+   while (fgets(line, BUFSIZ, ifp) != NULL) {
+   /* zap trailing CR and/or LF */
+   while ((s = strrchr(line, '\n')) != NULL)
+   *s = '\0';
+   while ((s = strrchr(line, '\r')) != NULL)
+   *s = '\0';
+   /* remove # comments */
+   s = strchr(line, '#');
+   if (s)
+   *s = '\0';
+   /* remove any whitespace and " characters */
+   s = line;
+   while (*s) {
+   if (*s == ' ' || *s == '\t' || *s == '"') {
+   while (*s) {
+   s[0] = s[1];
+   s++;
+   }
+   /* start over */
+   s = line;
+   continue;
+   }
+   s++;
+   }
+   /* anything left? */
+   if (*line == '\0')
+   continue;
+   fprintf(ofp, "\"%s\\0\"\n", line);
+   }
+   fclose(ifp);
+   }
+   fprintf(ofp, "\"\\0\"\n};\n");
+   fclose(ofp);
+   moveifchanged(path("hints.c.new"), path("hints.c"));
+}
+
 static void
 sanitize_envline(char *result, const char *src)
 {
@@ -243,96 +295,14 @@ sanitiz

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

2018-07-05 Thread Konstantin Belousov
On Thu, Jul 05, 2018 at 11:21:28AM -0700, John Baldwin wrote:
> On 7/5/18 8:54 AM, Konstantin Belousov wrote:
> > On Thu, Jul 05, 2018 at 07:56:22AM -0700, John Baldwin wrote:
> >> On 7/4/18 7:22 AM, Konstantin Belousov wrote:
> >>> On Tue, Jul 03, 2018 at 11:05:42PM +, Matt Macy wrote:
>  Author: mmacy
>  Date: Tue Jul  3 23:05:42 2018
>  New Revision: 335916
>  URL: https://svnweb.freebsd.org/changeset/base/335916
> 
>  Log:
>    Enable MODULE_TIED by default for modules compiled with the kernel
> >>> But why ?
> >>
> >> I think we should enable KLD_TIED to inline critical_* etc. for modules
> >> built as part of a kernel that are installed alongside the kernel in 
> >> /boot/.
> > 
> >> I don't think we need to support modules built with kernel A loaded into 
> >> kernel B.
> >>
> > This is the crusial point.  I do not object, but this this is a radical
> > change from the previous mode of modules build.
> > 
> > I do not want to put words in other person mouth, but I beliee that the
> > original intent of KLD_TIED/MODULE_TIED was much more limited.  Only some
> > specific modules were to be tied.
> 
> Yes, this is a change though I find it the logical outcome of the original 
> change
> to move away from MODULES_WITH_WORLD.  And to be clear, Matt certainly only
> intended to use MODULE_TIED in a few places, but I think tagging all those
> places will be cumbersome and tedious compared to just doing it in this way.  
> I
> think this will also tie into something I proposed earlier in a commit reply 
> and
> that I also brought up at BSDCan which is that I think that kernel modules in
> ports should install their sources and build glue to some location we choose
> (e.g. /usr/local/sys/modules/) and that we should support a variable 
> folks
> can set in their kernel config file similar to MODULES_OVERRIDE that is a list
> of local modules to recompile and install into /boot/kernel along with other
> modules (and that these recompiled modules would be TIED).  The binary module
> from the package would still be present in /boot/modules, but the tied module
> in /boot/kernel would be preferred and used instead when it exists (our 
> existing
> module_path already does this last part).  This would replace the existing
> PORTS_MODULES but in a way that is more graceful and works with packages, not
> just ports IMO.
> 

I probably need to say more explicit why this change made me surprised,
and the surprise is fueled even more by your proposal.  It basically
means that we do not need stable KBI, and detecting KBI breakage in such
setup is practically impossible.  Most consumers would be recompiled,
except the modules used in very specific scenario:  inter-release updates
with the modules used from the portmgr-provided packages while packages
are still built against the older release.

Again, I do not object against the proposed new world order, I do not
believe that KBI stability gives positive value comparing with the burden
and restrictions it puts on the liveness of the stable branches.

But I do believe that the migration to such new attitude to the kernel
interfaces would benefit from the discussion.
___
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: r336012 - in head: . usr.sbin/config

2018-07-05 Thread Kyle Evans
Author: kevans
Date: Thu Jul  5 18:39:02 2018
New Revision: 336012
URL: https://svnweb.freebsd.org/changeset/base/336012

Log:
  Fix build after r336011
  
  Add libnv to bootstrap-tools, use ${SRCTOP}/sys headers.

Modified:
  head/Makefile.inc1
  head/usr.sbin/config/Makefile
  head/usr.sbin/config/mkmakefile.c

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Thu Jul  5 17:53:51 2018(r336011)
+++ head/Makefile.inc1  Thu Jul  5 18:39:02 2018(r336012)
@@ -2063,6 +2063,15 @@ _kerberos5_bootstrap_tools= \
 .ORDER: ${_kerberos5_bootstrap_tools:C/^/${_bt}-/g}
 .endif
 
+# Later config(8) requires newer libnv cnvlist* API
+.if ${BOOTSTRAPPING} < 1200070
+_config= \
+   lib/libnv \
+   usr.sbin/config
+.else
+_config= usr.sbin/config
+.endif
+
 ${_bt}-usr.bin/mandoc: ${_bt}-lib/libopenbsd
 
 bootstrap-tools: .PHONY
@@ -2087,7 +2096,7 @@ bootstrap-tools: .PHONY
 ${_lex} \
 usr.bin/xinstall \
 ${_gensnmptree} \
-usr.sbin/config \
+${_config} \
 ${_crunchide} \
 ${_crunchgen} \
 ${_nmtree} \

Modified: head/usr.sbin/config/Makefile
==
--- head/usr.sbin/config/Makefile   Thu Jul  5 17:53:51 2018
(r336011)
+++ head/usr.sbin/config/Makefile   Thu Jul  5 18:39:02 2018
(r336012)
@@ -14,7 +14,7 @@ kernconf.c: kernconf.tmpl
${FILE2C} 'char kernconfstr[] = {' ',0};' < \
${SRCDIR}/kernconf.tmpl > kernconf.c
 
-CFLAGS+= -I. -I${SRCDIR}
+CFLAGS+= -I. -I${SRCDIR} -I${SRCTOP}/sys
 
 NO_WMISSING_VARIABLE_DECLARATIONS=
 

Modified: head/usr.sbin/config/mkmakefile.c
==
--- head/usr.sbin/config/mkmakefile.c   Thu Jul  5 17:53:51 2018
(r336011)
+++ head/usr.sbin/config/mkmakefile.c   Thu Jul  5 18:39:02 2018
(r336012)
@@ -286,7 +286,7 @@ dump_nvlist(nvlist_t *nvl, FILE *ofp)
fprintf(ofp, "\"%s=%s\\0\"\n", name,
 cnvlist_get_string(cookie));
 
-   cnvlist_free_string(nvl, cookie);
+   cnvlist_free_string(cookie);
}
 }
 
___
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: r336011 - head/usr.sbin/config

2018-07-05 Thread Andrew Turner

> On 5 Jul 2018, at 18:53, Kyle Evans  wrote:
> 
> Author: kevans
> Date: Thu Jul  5 17:53:51 2018
> New Revision: 336011
> URL: https://svnweb.freebsd.org/changeset/base/336011
> 
> Log:
>  config(8): De-dupe hint/env vars within a single file
> 
>  r335653 flipped the order in which hints/env files are concatenated to match
>  the order in which vars are processed by the kernel. This is the other
>  hammer to drop.
> 
>  Use nv(9) to de-dupe entries within a single `hint` or `env` file, using the
>  latest value specified for a key. This leaves some duplicates if a variable
>  is specified in multiple hint/env files or via `envvar` in a kernel config,
>  but the reversed order of concatenation (from r335653) makes this a
>  non-issue as the latest-specified version will be seen first.
> 
>  This change also silently rewrote hint bits to use the same sanitization
>  process that ian@ wrote for r335642. To the kernel, hints and env vars are
>  basically the same thing through early boot, then get merged into the
>  dynamic environment once kmem becomes available and the dynamic environment
>  is created. They should be subjected to the same restrictions.
> 
>  MFC after:   1 month
> 
> Modified:
>  head/usr.sbin/config/Makefile
>  head/usr.sbin/config/mkmakefile.c
> 
> Modified: head/usr.sbin/config/Makefile
> ==
> --- head/usr.sbin/config/Makefile Thu Jul  5 17:28:06 2018
> (r336010)
> +++ head/usr.sbin/config/Makefile Thu Jul  5 17:53:51 2018
> (r336011)
> @@ -18,7 +18,7 @@ CFLAGS+= -I. -I${SRCDIR}
> 
> NO_WMISSING_VARIABLE_DECLARATIONS=
> 
> -LIBADD=  l sbuf
> +LIBADD=  l nv sbuf
> 
> CLEANFILES+=  kernconf.c
> 
> 
> Modified: head/usr.sbin/config/mkmakefile.c
> ==
> --- head/usr.sbin/config/mkmakefile.c Thu Jul  5 17:28:06 2018
> (r336010)
> +++ head/usr.sbin/config/mkmakefile.c Thu Jul  5 17:53:51 2018
> (r336011)
> @@ -49,6 +49,8 @@ static const char rcsid[] =
> #include 
> #include 
> #include 
> +#include 
> +#include 

It looks like this breaks the build from 11 [1]. cnv.h doesn’t exist there.

Andrew

[1] https://ci.freebsd.org/job/FreeBSD-head-aarch64-build/8427/console

___
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: r336011 - head/usr.sbin/config

2018-07-05 Thread Kyle Evans
On Thu, Jul 5, 2018 at 12:57 PM, O. Hartmann  wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA512
>
> Am Thu, 5 Jul 2018 17:53:51 + (UTC)
> Kyle Evans  schrieb:
>
>> Author: kevans
>> Date: Thu Jul  5 17:53:51 2018
>> New Revision: 336011
>> URL: https://svnweb.freebsd.org/changeset/base/336011
>>
>> Log:
>>   config(8): De-dupe hint/env vars within a single file
>>
>>   r335653 flipped the order in which hints/env files are concatenated to 
>> match
>>   the order in which vars are processed by the kernel. This is the other
>>   hammer to drop.
>>
>>   Use nv(9) to de-dupe entries within a single `hint` or `env` file, using 
>> the
>>   latest value specified for a key. This leaves some duplicates if a variable
>>   is specified in multiple hint/env files or via `envvar` in a kernel config,
>>   but the reversed order of concatenation (from r335653) makes this a
>>   non-issue as the latest-specified version will be seen first.
>>
>>   This change also silently rewrote hint bits to use the same sanitization
>>   process that ian@ wrote for r335642. To the kernel, hints and env vars are
>>   basically the same thing through early boot, then get merged into the
>>   dynamic environment once kmem becomes available and the dynamic environment
>>   is created. They should be subjected to the same restrictions.
>>
>>   MFC after:  1 month
>>
>> Modified:
>>   head/usr.sbin/config/Makefile
>>   head/usr.sbin/config/mkmakefile.c
>>
>> Modified: head/usr.sbin/config/Makefile
>> ==
>> --- head/usr.sbin/config/Makefile Thu Jul  5 17:28:06 2018
>> (r336010)
>> +++ head/usr.sbin/config/Makefile Thu Jul  5 17:53:51 2018
>> (r336011)
>> @@ -18,7 +18,7 @@ CFLAGS+= -I. -I${SRCDIR}
>>
>>  NO_WMISSING_VARIABLE_DECLARATIONS=
>>
>> -LIBADD=  l sbuf
>> +LIBADD=  l nv sbuf
>>
>>  CLEANFILES+= kernconf.c
>>
>>
>> Modified: head/usr.sbin/config/mkmakefile.c
>> ==
>> --- head/usr.sbin/config/mkmakefile.c Thu Jul  5 17:28:06 2018
>> (r336010)
>> +++ head/usr.sbin/config/mkmakefile.c Thu Jul  5 17:53:51 2018
>> (r336011)
>> @@ -49,6 +49,8 @@ static const char rcsid[] =
>>  #include 
>>  #include 
>>  #include 
>> +#include 
>> +#include 
>>  #include 
>>  #include "y.tab.h"
>>  #include "config.h"
>> @@ -62,6 +64,10 @@ static void do_objs(FILE *);
>>  static void do_before_depend(FILE *);
>>  static int opteq(const char *, const char *);
>>  static void read_files(void);
>> +static void sanitize_envline(char *result, const char *src);
>> +static void process_into_file(char *line, FILE *ofp);
>> +static void process_into_nvlist(char *line, nvlist_t *nvl);
>> +static void dump_nvlist(nvlist_t *nvl, FILE *ofp);
>>
>>  static void errout(const char *fmt, ...)
>>  {
>> @@ -180,64 +186,6 @@ makefile(void)
>>   moveifchanged(path("Makefile.new"), path("Makefile"));
>>  }
>>
>> -/*
>> - * Build hints.c from the skeleton
>> - */
>> -void
>> -makehints(void)
>> -{
>> - FILE *ifp, *ofp;
>> - char line[BUFSIZ];
>> - char *s;
>> - struct hint *hint;
>> -
>> - ofp = fopen(path("hints.c.new"), "w");
>> - if (ofp == NULL)
>> - err(1, "%s", path("hints.c.new"));
>> - fprintf(ofp, "#include \n");
>> - fprintf(ofp, "#include \n");
>> - fprintf(ofp, "\n");
>> - fprintf(ofp, "char static_hints[] = {\n");
>> - STAILQ_FOREACH(hint, &hints, hint_next) {
>> - ifp = fopen(hint->hint_name, "r");
>> - if (ifp == NULL)
>> - err(1, "%s", hint->hint_name);
>> - while (fgets(line, BUFSIZ, ifp) != NULL) {
>> - /* zap trailing CR and/or LF */
>> - while ((s = strrchr(line, '\n')) != NULL)
>> - *s = '\0';
>> - while ((s = strrchr(line, '\r')) != NULL)
>> - *s = '\0';
>> - /* remove # comments */
>> - s = strchr(line, '#');
>> - if (s)
>> - *s = '\0';
>> - /* remove any whitespace and " characters */
>> - s = line;
>> - while (*s) {
>> - if (*s == ' ' || *s == '\t' || *s == '"') {
>> - while (*s) {
>> - s[0] = s[1];
>> - s++;
>> - }
>> - /* start over */
>> - s = line;
>> - continue;
>> - }
>> - s++;
>> - }
>> - /* anything left? */
>> - if (*line == '\0')
>> -

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

2018-07-05 Thread John Baldwin
On 7/5/18 8:54 AM, Konstantin Belousov wrote:
> On Thu, Jul 05, 2018 at 07:56:22AM -0700, John Baldwin wrote:
>> On 7/4/18 7:22 AM, Konstantin Belousov wrote:
>>> On Tue, Jul 03, 2018 at 11:05:42PM +, Matt Macy wrote:
 Author: mmacy
 Date: Tue Jul  3 23:05:42 2018
 New Revision: 335916
 URL: https://svnweb.freebsd.org/changeset/base/335916

 Log:
   Enable MODULE_TIED by default for modules compiled with the kernel
>>> But why ?
>>
>> I think we should enable KLD_TIED to inline critical_* etc. for modules
>> built as part of a kernel that are installed alongside the kernel in 
>> /boot/.
> 
>> I don't think we need to support modules built with kernel A loaded into 
>> kernel B.
>>
> This is the crusial point.  I do not object, but this this is a radical
> change from the previous mode of modules build.
> 
> I do not want to put words in other person mouth, but I beliee that the
> original intent of KLD_TIED/MODULE_TIED was much more limited.  Only some
> specific modules were to be tied.

Yes, this is a change though I find it the logical outcome of the original 
change
to move away from MODULES_WITH_WORLD.  And to be clear, Matt certainly only
intended to use MODULE_TIED in a few places, but I think tagging all those
places will be cumbersome and tedious compared to just doing it in this way.  I
think this will also tie into something I proposed earlier in a commit reply and
that I also brought up at BSDCan which is that I think that kernel modules in
ports should install their sources and build glue to some location we choose
(e.g. /usr/local/sys/modules/) and that we should support a variable folks
can set in their kernel config file similar to MODULES_OVERRIDE that is a list
of local modules to recompile and install into /boot/kernel along with other
modules (and that these recompiled modules would be TIED).  The binary module
from the package would still be present in /boot/modules, but the tied module
in /boot/kernel would be preferred and used instead when it exists (our existing
module_path already does this last part).  This would replace the existing
PORTS_MODULES but in a way that is more graceful and works with packages, not
just ports IMO.

-- 
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: r336002 - in head: usr.bin/netstat usr.sbin/tcpdrop

2018-07-05 Thread Bruce Evans

On Fri, 6 Jul 2018, Bruce Evans wrote:


On Thu, 5 Jul 2018, Brooks Davis wrote:


Log:
 Work around lame warnings in ancient gcc on 32-bit platforms.

 Fixes r335979.


These are correct warnings.

Why not fix the bug instead of rorking around it?


Modified: head/usr.bin/netstat/inet.c
==
--- head/usr.bin/netstat/inet.c	Thu Jul  5 16:43:15 2018 
(r336001)
+++ head/usr.bin/netstat/inet.c	Thu Jul  5 17:02:10 2018 
(r336002)

@@ -159,12 +159,12 @@ sotoxsocket(struct socket *so, struct xsocket *xso)

bzero(xso, sizeof *xso);
xso->xso_len = sizeof *xso;
-   xso->xso_so = (kvaddr_t)so;
+   xso->xso_so = (kvaddr_t)(long)so;


This (and kvaddr_t having the same 64-bit size for all arches) are 
unportable.

...


Lots is still broken.  In just my kernel with few options:

X cc1: warnings being treated as errors
X ../../../kern/uipc_usrreq.c: In function 'unp_pcblist':
X ../../../kern/uipc_usrreq.c:1856: warning: cast from pointer to integer of 
different size [-Wpointer-to-int-cast]
X ../../../kern/uipc_usrreq.c:1873: warning: cast from pointer to integer of 
different size [-Wpointer-to-int-cast]
X ../../../kern/uipc_usrreq.c:1874: warning: cast from pointer to integer of 
different size [-Wpointer-to-int-cast]
X ../../../kern/uipc_usrreq.c:1875: warning: cast from pointer to integer of 
different size [-Wpointer-to-int-cast]
X ../../../kern/uipc_usrreq.c:1876: warning: cast from pointer to integer of 
different size [-Wpointer-to-int-cast]
X cc1: warnings being treated as errors
X ../../../netinet/in_pcb.c: In function 'in_pcbtoxinpcb':
X ../../../netinet/in_pcb.c:2909: warning: cast from pointer to integer of 
different size [-Wpointer-to-int-cast]
X cc1: warnings being treated as errors
X ../../../kern/kern_descrip.c: In function 'sysctl_kern_file':
X ../../../kern/kern_descrip.c:3365: warning: cast from pointer to integer of 
different size [-Wpointer-to-int-cast]
X ../../../kern/kern_descrip.c:3366: warning: cast from pointer to integer of 
different size [-Wpointer-to-int-cast]
X ../../../kern/kern_descrip.c:3367: warning: cast from pointer to integer of 
different size [-Wpointer-to-int-cast]
X --- in_pcb.o ---
X *** [in_pcb.o] Error code 1
X 
X make: stopped in /home/bde/syscn/i386/compile/Bsmp

X --- uipc_usrreq.o ---
X *** [uipc_usrreq.o] Error code 1
X 
X make: stopped in /home/bde/syscn/i386/compile/Bsmp

X --- kern_descrip.o ---
X *** [kern_descrip.o] Error code 1
X 
X make: stopped in /home/bde/syscn/i386/compile/Bsmp

X cc1: warnings being treated as errors
X ../../../kern/uipc_socket.c: In function 'sotoxsocket':
X ../../../kern/uipc_socket.c:3988: warning: cast from pointer to integer of 
different size [-Wpointer-to-int-cast]
X ../../../kern/uipc_socket.c:3993: warning: cast from pointer to integer of 
different size [-Wpointer-to-int-cast]
X --- uipc_socket.o ---
X *** [uipc_socket.o] Error code 1
X 
X make: stopped in /home/bde/syscn/i386/compile/Bsmp


The warnings are especially correct since they were asked for by
[-Wpointer-to-int-cast].  I think this is implicit in -W or -Wall.  clang
doesn't even warn that it doesn't support this flag when the flag is
added explicitly.  It apparently silently ignores this flag, since it
accepts it but doesn't even warn for downcasts.

Bruce
___
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: r336011 - head/usr.sbin/config

2018-07-05 Thread O. Hartmann
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

Am Thu, 5 Jul 2018 17:53:51 + (UTC)
Kyle Evans  schrieb:

> Author: kevans
> Date: Thu Jul  5 17:53:51 2018
> New Revision: 336011
> URL: https://svnweb.freebsd.org/changeset/base/336011
> 
> Log:
>   config(8): De-dupe hint/env vars within a single file
>   
>   r335653 flipped the order in which hints/env files are concatenated to match
>   the order in which vars are processed by the kernel. This is the other
>   hammer to drop.
>   
>   Use nv(9) to de-dupe entries within a single `hint` or `env` file, using the
>   latest value specified for a key. This leaves some duplicates if a variable
>   is specified in multiple hint/env files or via `envvar` in a kernel config,
>   but the reversed order of concatenation (from r335653) makes this a
>   non-issue as the latest-specified version will be seen first.
>   
>   This change also silently rewrote hint bits to use the same sanitization
>   process that ian@ wrote for r335642. To the kernel, hints and env vars are
>   basically the same thing through early boot, then get merged into the
>   dynamic environment once kmem becomes available and the dynamic environment
>   is created. They should be subjected to the same restrictions.
>   
>   MFC after:  1 month
> 
> Modified:
>   head/usr.sbin/config/Makefile
>   head/usr.sbin/config/mkmakefile.c
> 
> Modified: head/usr.sbin/config/Makefile
> ==
> --- head/usr.sbin/config/Makefile Thu Jul  5 17:28:06 2018
> (r336010)
> +++ head/usr.sbin/config/Makefile Thu Jul  5 17:53:51 2018
> (r336011)
> @@ -18,7 +18,7 @@ CFLAGS+= -I. -I${SRCDIR}
>  
>  NO_WMISSING_VARIABLE_DECLARATIONS=
>  
> -LIBADD=  l sbuf
> +LIBADD=  l nv sbuf
>  
>  CLEANFILES+= kernconf.c
>  
> 
> Modified: head/usr.sbin/config/mkmakefile.c
> ==
> --- head/usr.sbin/config/mkmakefile.c Thu Jul  5 17:28:06 2018
> (r336010)
> +++ head/usr.sbin/config/mkmakefile.c Thu Jul  5 17:53:51 2018
> (r336011)
> @@ -49,6 +49,8 @@ static const char rcsid[] =
>  #include 
>  #include 
>  #include 
> +#include 
> +#include 
>  #include 
>  #include "y.tab.h"
>  #include "config.h"
> @@ -62,6 +64,10 @@ static void do_objs(FILE *);
>  static void do_before_depend(FILE *);
>  static int opteq(const char *, const char *);
>  static void read_files(void);
> +static void sanitize_envline(char *result, const char *src);
> +static void process_into_file(char *line, FILE *ofp);
> +static void process_into_nvlist(char *line, nvlist_t *nvl);
> +static void dump_nvlist(nvlist_t *nvl, FILE *ofp);
>  
>  static void errout(const char *fmt, ...)
>  {
> @@ -180,64 +186,6 @@ makefile(void)
>   moveifchanged(path("Makefile.new"), path("Makefile"));
>  }
>  
> -/*
> - * Build hints.c from the skeleton
> - */
> -void
> -makehints(void)
> -{
> - FILE *ifp, *ofp;
> - char line[BUFSIZ];
> - char *s;
> - struct hint *hint;
> -
> - ofp = fopen(path("hints.c.new"), "w");
> - if (ofp == NULL)
> - err(1, "%s", path("hints.c.new"));
> - fprintf(ofp, "#include \n");
> - fprintf(ofp, "#include \n");
> - fprintf(ofp, "\n");
> - fprintf(ofp, "char static_hints[] = {\n");
> - STAILQ_FOREACH(hint, &hints, hint_next) {
> - ifp = fopen(hint->hint_name, "r");
> - if (ifp == NULL)
> - err(1, "%s", hint->hint_name);
> - while (fgets(line, BUFSIZ, ifp) != NULL) {
> - /* zap trailing CR and/or LF */
> - while ((s = strrchr(line, '\n')) != NULL)
> - *s = '\0';
> - while ((s = strrchr(line, '\r')) != NULL)
> - *s = '\0';
> - /* remove # comments */
> - s = strchr(line, '#');
> - if (s)
> - *s = '\0';
> - /* remove any whitespace and " characters */
> - s = line;
> - while (*s) {
> - if (*s == ' ' || *s == '\t' || *s == '"') {
> - while (*s) {
> - s[0] = s[1];
> - s++;
> - }
> - /* start over */
> - s = line;
> - continue;
> - }
> - s++;
> - }
> - /* anything left? */
> - if (*line == '\0')
> - continue;
> - fprintf(ofp, "\"%s\\0\"\n", line);
> - }
> - fclose(ifp);
> - }
> - fprintf(ofp, "\"\\0\"\n};\n")

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

2018-07-05 Thread Matthew Macy
On Thu, Jul 5, 2018 at 8:54 AM, Konstantin Belousov  wrote:
> On Thu, Jul 05, 2018 at 07:56:22AM -0700, John Baldwin wrote:
>> On 7/4/18 7:22 AM, Konstantin Belousov wrote:
>> > On Tue, Jul 03, 2018 at 11:05:42PM +, Matt Macy wrote:
>> >> Author: mmacy
>> >> Date: Tue Jul  3 23:05:42 2018
>> >> New Revision: 335916
>> >> URL: https://svnweb.freebsd.org/changeset/base/335916
>> >>
>> >> Log:
>> >>   Enable MODULE_TIED by default for modules compiled with the kernel
>> > But why ?
>>
>> I think we should enable KLD_TIED to inline critical_* etc. for modules
>> built as part of a kernel that are installed alongside the kernel in 
>> /boot/.
>
>> I don't think we need to support modules built with kernel A loaded into 
>> kernel B.
>>
> This is the crusial point.  I do not object, but this this is a radical
> change from the previous mode of modules build.
>
> I do not want to put words in other person mouth, but I beliee that the
> original intent of KLD_TIED/MODULE_TIED was much more limited.  Only some
> specific modules were to be tied.


My intention was only to allow it for select modules compiled _with_
the kernel. Then there was a heated discussion about documentation and
how to communicate it's distinction with DECLARE_MODULE_TIED. In
response to which John said (assuming I understood correctly,
communication is hard) that it should be the default and specified
doing it the way I did it. That seemed reasonable - but I don't have
strong feelings one way or the other. I apologize if I misunderstood
any guidance I was provided.

-M
___
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: r336011 - head/usr.sbin/config

2018-07-05 Thread Kyle Evans
Author: kevans
Date: Thu Jul  5 17:53:51 2018
New Revision: 336011
URL: https://svnweb.freebsd.org/changeset/base/336011

Log:
  config(8): De-dupe hint/env vars within a single file
  
  r335653 flipped the order in which hints/env files are concatenated to match
  the order in which vars are processed by the kernel. This is the other
  hammer to drop.
  
  Use nv(9) to de-dupe entries within a single `hint` or `env` file, using the
  latest value specified for a key. This leaves some duplicates if a variable
  is specified in multiple hint/env files or via `envvar` in a kernel config,
  but the reversed order of concatenation (from r335653) makes this a
  non-issue as the latest-specified version will be seen first.
  
  This change also silently rewrote hint bits to use the same sanitization
  process that ian@ wrote for r335642. To the kernel, hints and env vars are
  basically the same thing through early boot, then get merged into the
  dynamic environment once kmem becomes available and the dynamic environment
  is created. They should be subjected to the same restrictions.
  
  MFC after:1 month

Modified:
  head/usr.sbin/config/Makefile
  head/usr.sbin/config/mkmakefile.c

Modified: head/usr.sbin/config/Makefile
==
--- head/usr.sbin/config/Makefile   Thu Jul  5 17:28:06 2018
(r336010)
+++ head/usr.sbin/config/Makefile   Thu Jul  5 17:53:51 2018
(r336011)
@@ -18,7 +18,7 @@ CFLAGS+= -I. -I${SRCDIR}
 
 NO_WMISSING_VARIABLE_DECLARATIONS=
 
-LIBADD=l sbuf
+LIBADD=l nv sbuf
 
 CLEANFILES+=   kernconf.c
 

Modified: head/usr.sbin/config/mkmakefile.c
==
--- head/usr.sbin/config/mkmakefile.c   Thu Jul  5 17:28:06 2018
(r336010)
+++ head/usr.sbin/config/mkmakefile.c   Thu Jul  5 17:53:51 2018
(r336011)
@@ -49,6 +49,8 @@ static const char rcsid[] =
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include "y.tab.h"
 #include "config.h"
@@ -62,6 +64,10 @@ static void do_objs(FILE *);
 static void do_before_depend(FILE *);
 static int opteq(const char *, const char *);
 static void read_files(void);
+static void sanitize_envline(char *result, const char *src);
+static void process_into_file(char *line, FILE *ofp);
+static void process_into_nvlist(char *line, nvlist_t *nvl);
+static void dump_nvlist(nvlist_t *nvl, FILE *ofp);
 
 static void errout(const char *fmt, ...)
 {
@@ -180,64 +186,6 @@ makefile(void)
moveifchanged(path("Makefile.new"), path("Makefile"));
 }
 
-/*
- * Build hints.c from the skeleton
- */
-void
-makehints(void)
-{
-   FILE *ifp, *ofp;
-   char line[BUFSIZ];
-   char *s;
-   struct hint *hint;
-
-   ofp = fopen(path("hints.c.new"), "w");
-   if (ofp == NULL)
-   err(1, "%s", path("hints.c.new"));
-   fprintf(ofp, "#include \n");
-   fprintf(ofp, "#include \n");
-   fprintf(ofp, "\n");
-   fprintf(ofp, "char static_hints[] = {\n");
-   STAILQ_FOREACH(hint, &hints, hint_next) {
-   ifp = fopen(hint->hint_name, "r");
-   if (ifp == NULL)
-   err(1, "%s", hint->hint_name);
-   while (fgets(line, BUFSIZ, ifp) != NULL) {
-   /* zap trailing CR and/or LF */
-   while ((s = strrchr(line, '\n')) != NULL)
-   *s = '\0';
-   while ((s = strrchr(line, '\r')) != NULL)
-   *s = '\0';
-   /* remove # comments */
-   s = strchr(line, '#');
-   if (s)
-   *s = '\0';
-   /* remove any whitespace and " characters */
-   s = line;
-   while (*s) {
-   if (*s == ' ' || *s == '\t' || *s == '"') {
-   while (*s) {
-   s[0] = s[1];
-   s++;
-   }
-   /* start over */
-   s = line;
-   continue;
-   }
-   s++;
-   }
-   /* anything left? */
-   if (*line == '\0')
-   continue;
-   fprintf(ofp, "\"%s\\0\"\n", line);
-   }
-   fclose(ifp);
-   }
-   fprintf(ofp, "\"\\0\"\n};\n");
-   fclose(ofp);
-   moveifchanged(path("hints.c.new"), path("hints.c"));
-}
-
 static void
 sanitize_envline(char *result, const char *src)
 {
@@ -295,14 +243,96 @@ sanitize_envline(char *result, const char *src)
*dst = 0;
 }
 
+static void

Re: svn commit: r336002 - in head: usr.bin/netstat usr.sbin/tcpdrop

2018-07-05 Thread Bruce Evans

On Thu, 5 Jul 2018, Brooks Davis wrote:


Log:
 Work around lame warnings in ancient gcc on 32-bit platforms.

 Fixes r335979.


These are correct warnings.

Why not fix the bug instead of rorking around it?


Modified: head/usr.bin/netstat/inet.c
==
--- head/usr.bin/netstat/inet.c Thu Jul  5 16:43:15 2018(r336001)
+++ head/usr.bin/netstat/inet.c Thu Jul  5 17:02:10 2018(r336002)
@@ -159,12 +159,12 @@ sotoxsocket(struct socket *so, struct xsocket *xso)

bzero(xso, sizeof *xso);
xso->xso_len = sizeof *xso;
-   xso->xso_so = (kvaddr_t)so;
+   xso->xso_so = (kvaddr_t)(long)so;


This (and kvaddr_t having the same 64-bit size for all arches) are unportable.
Converting object pointers to integers is only portable if one or both of
intptr_t or uintptr_t exists and is used.  The above assumes that intptr_t
exists and is the same as long, and that there are no problems with the
sign mismatch between long and kvaddr_t.  But long != intptr_t on any
supported 32-bit arches.  It only has the same size.  The sign mismatch
probably doesn't matter, but this is unclear.

Correct code:

xso->xso_so = (kvaddr_t)(uintptr_t)so;

This only assumes that uintptr_t exists and is not larger than kvaddr_t.
FreeBSD and maybe POSIX require uintptr_t to exist, and kvaddr_t must be
chosen to be no smaller than uintptr_t.

The burden is larger for using these pointers represented as integers.
On all 32-bit arches, converting kvaddr_t back to a pointer reduces
its size, and only very broken compilers would not warn about that.
But it is a bug for the API to even have kernel pointers, so hopefully
this conversion is rarely done.

An application might just print these pointers, and should do this
without converting them to void so as to misprint them using %p format.
ps(1) attempts to do some compression when printing kernel addresses,
but IIRC this is quite broken especially on 64-bit arches where it is
most needed.  E.g, ps laxw -o wchan.  wchan is documented to trim
leading zeros when printing the value numerically.  It needs to trim
leading f's on at least amd64 and i386 3/1.  But wchan is almost useless
since it is rarely printed numerically, so it is the same as wchan for
all processes on freefall now.  The leading zeros in it are stripped
by printing it in %lx format after bogusly casting ki_wchan to long.
ki_wchan is still void *, so kinfo's ABI is very MD.  kinfo has lots
of other design errors like this, but its ABI has only been broken
once or twice since FreeBSD-~5.

Bruce
___
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: r336010 - in head/sys: amd64/amd64 i386/i386

2018-07-05 Thread Konstantin Belousov
Author: kib
Date: Thu Jul  5 17:28:06 2018
New Revision: 336010
URL: https://svnweb.freebsd.org/changeset/base/336010

Log:
  Extend r335969 to superpages.
  
  It is possible that a fictitious unmanaged userspace mapping of
  superpage is created on x86, e.g. by pmap_object_init_pt(), with the
  physical address outside the vm_page_array[] coverage.
  
  Noted and reviewed by:alc
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week
  Differential revision:https://reviews.freebsd.org/D16085

Modified:
  head/sys/amd64/amd64/pmap.c
  head/sys/i386/i386/pmap.c

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Thu Jul  5 17:26:44 2018(r336009)
+++ head/sys/amd64/amd64/pmap.c Thu Jul  5 17:28:06 2018(r336010)
@@ -2308,7 +2308,6 @@ retry:
PG_PS_FRAME) | (va & PDRMASK), &pa))
goto retry;
m = PHYS_TO_VM_PAGE(pa);
-   vm_page_hold(m);
}
} else {
pte = *pmap_pde_to_pte(pdep, va);
@@ -2318,10 +2317,10 @@ retry:
&pa))
goto retry;
m = PHYS_TO_VM_PAGE(pa);
-   if (m != NULL)
-   vm_page_hold(m);
}
}
+   if (m != NULL)
+   vm_page_hold(m);
}
PA_UNLOCK_COND(pa);
PMAP_UNLOCK(pmap);

Modified: head/sys/i386/i386/pmap.c
==
--- head/sys/i386/i386/pmap.c   Thu Jul  5 17:26:44 2018(r336009)
+++ head/sys/i386/i386/pmap.c   Thu Jul  5 17:28:06 2018(r336010)
@@ -1673,7 +1673,6 @@ retry:
PG_PS_FRAME) | (va & PDRMASK), &pa))
goto retry;
m = PHYS_TO_VM_PAGE(pa);
-   vm_page_hold(m);
}
} else {
pte = pmap_pte_ufast(pmap, va, pde);
@@ -1683,10 +1682,10 @@ retry:
&pa))
goto retry;
m = PHYS_TO_VM_PAGE(pa);
-   if (m != NULL)
-   vm_page_hold(m);
}
}
+   if (m != NULL)
+   vm_page_hold(m);
}
PA_UNLOCK_COND(pa);
PMAP_UNLOCK(pmap);
___
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: r336009 - head/sys/riscv/riscv

2018-07-05 Thread Sean Bruno
Author: sbruno
Date: Thu Jul  5 17:26:44 2018
New Revision: 336009
URL: https://svnweb.freebsd.org/changeset/base/336009

Log:
  riscv:  Remove unused variable "code"
  
  gcc found that the variabl "code", while being assigned a value, isn't
  be used for anything.
  
  Reviewed by:  br
  Differential Revision:https://reviews.freebsd.org/D16114

Modified:
  head/sys/riscv/riscv/machdep.c

Modified: head/sys/riscv/riscv/machdep.c
==
--- head/sys/riscv/riscv/machdep.c  Thu Jul  5 17:26:13 2018
(r336008)
+++ head/sys/riscv/riscv/machdep.c  Thu Jul  5 17:26:44 2018
(r336009)
@@ -548,7 +548,6 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask
struct thread *td;
struct proc *p;
int onstack;
-   int code;
int sig;
 
td = curthread;
@@ -556,7 +555,6 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask
PROC_LOCK_ASSERT(p, MA_OWNED);
 
sig = ksi->ksi_signo;
-   code = ksi->ksi_code;
psp = p->p_sigacts;
mtx_assert(&psp->ps_mtx, MA_OWNED);
 
___
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: r336008 - in head/sys: amd64/amd64 i386/i386

2018-07-05 Thread Konstantin Belousov
Author: kib
Date: Thu Jul  5 17:26:13 2018
New Revision: 336008
URL: https://svnweb.freebsd.org/changeset/base/336008

Log:
  Revert r335999 to re-commit with the correct error message.

Modified:
  head/sys/amd64/amd64/pmap.c
  head/sys/i386/i386/pmap.c

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Thu Jul  5 17:13:37 2018(r336007)
+++ head/sys/amd64/amd64/pmap.c Thu Jul  5 17:26:13 2018(r336008)
@@ -2308,6 +2308,7 @@ retry:
PG_PS_FRAME) | (va & PDRMASK), &pa))
goto retry;
m = PHYS_TO_VM_PAGE(pa);
+   vm_page_hold(m);
}
} else {
pte = *pmap_pde_to_pte(pdep, va);
@@ -2317,10 +2318,10 @@ retry:
&pa))
goto retry;
m = PHYS_TO_VM_PAGE(pa);
+   if (m != NULL)
+   vm_page_hold(m);
}
}
-   if (m != NULL)
-   vm_page_hold(m);
}
PA_UNLOCK_COND(pa);
PMAP_UNLOCK(pmap);

Modified: head/sys/i386/i386/pmap.c
==
--- head/sys/i386/i386/pmap.c   Thu Jul  5 17:13:37 2018(r336007)
+++ head/sys/i386/i386/pmap.c   Thu Jul  5 17:26:13 2018(r336008)
@@ -1673,6 +1673,7 @@ retry:
PG_PS_FRAME) | (va & PDRMASK), &pa))
goto retry;
m = PHYS_TO_VM_PAGE(pa);
+   vm_page_hold(m);
}
} else {
pte = pmap_pte_ufast(pmap, va, pde);
@@ -1682,10 +1683,10 @@ retry:
&pa))
goto retry;
m = PHYS_TO_VM_PAGE(pa);
+   if (m != NULL)
+   vm_page_hold(m);
}
}
-   if (m != NULL)
-   vm_page_hold(m);
}
PA_UNLOCK_COND(pa);
PMAP_UNLOCK(pmap);
___
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: r336007 - in head: share/man/man9 sys/compat/linuxkpi/common/src sys/kern sys/mips/mips sys/mips/nlm sys/netinet sys/netpfil/ipfw sys/powerpc/powerpc sys/sys sys/vm sys/x86/xen

2018-07-05 Thread Andrew Turner
Author: andrew
Date: Thu Jul  5 17:13:37 2018
New Revision: 336007
URL: https://svnweb.freebsd.org/changeset/base/336007

Log:
  Create a new macro for static DPCPU data.
  
  On arm64 (and possible other architectures) we are unable to use static
  DPCPU data in kernel modules. This is because the compiler will generate
  PC-relative accesses, however the runtime-linker expects to be able to
  relocate these.
  
  In preparation to fix this create two macros depending on if the data is
  global or static.
  
  Reviewed by:  bz, emaste, markj
  Sponsored by: ABT Systems Ltd
  Differential Revision:https://reviews.freebsd.org/D16140

Modified:
  head/share/man/man9/dpcpu.9
  head/sys/compat/linuxkpi/common/src/linux_idr.c
  head/sys/compat/linuxkpi/common/src/linux_rcu.c
  head/sys/compat/linuxkpi/common/src/linux_tasklet.c
  head/sys/kern/kern_clock.c
  head/sys/kern/kern_clocksource.c
  head/sys/kern/kern_exec.c
  head/sys/kern/kern_tc.c
  head/sys/kern/sched_4bsd.c
  head/sys/kern/sched_ule.c
  head/sys/kern/subr_pcpu.c
  head/sys/mips/mips/tick.c
  head/sys/mips/nlm/tick.c
  head/sys/netinet/siftr.c
  head/sys/netpfil/ipfw/ip_fw_dynamic.c
  head/sys/powerpc/powerpc/clock.c
  head/sys/sys/pcpu.h
  head/sys/vm/vm_page.c
  head/sys/x86/xen/xen_intr.c

Modified: head/share/man/man9/dpcpu.9
==
--- head/share/man/man9/dpcpu.9 Thu Jul  5 17:11:55 2018(r336006)
+++ head/share/man/man9/dpcpu.9 Thu Jul  5 17:13:37 2018(r336007)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 26, 2017
+.Dd July 5, 2018
 .Dt DPCPU 9
 .Os
 .Sh NAME
@@ -35,6 +35,7 @@
 .In sys/pcpu.h
 .Ss Per-CPU Variable Definition and Declaration
 .Fn DPCPU_DEFINE "type" "name"
+.Fn DPCPU_DEFINE_STATIC "type" "name"
 .Fn DPCPU_DECLARE "type" "name"
 .Ss Current CPU Accessor Functions
 .Fn DPCPU_PTR "name"
@@ -66,11 +67,12 @@ per-CPU instance to be initialized with the value:
 DPCPU_DEFINE(int, foo_int) = 1;
 .Ed
 .Pp
-Syntactically, the definition may be treated as a variable.
-For example, a dynamic per-CPU variable may be declared as
-.Dv static :
+Values that can be defined as
+.Dv static
+must use
+.Fn DPCPU_DEFINE_STATIC :
 .Bd -literal -offset 1234
-static DPCPU_DEFINE(int, foo_int);
+DPCPU_DEFINE_STATIC(int, foo_int);
 .Ed
 .Pp
 .Fn DPCPU_DECLARE
@@ -111,8 +113,8 @@ Alternatively, it may be desirable to cache the CPU ID
 sequence of accesses, using suitable synchronization to make non-atomic
 sequences safe in the presence of migration.
 .Bd -literal -offset 1234
-static DPCPU_DEFINE(int, foo_int);
-static DPCPU_DEFINE(struct mutex, foo_lock);
+DPCPU_DEFINE_STATIC(int, foo_int);
+DPCPU_DEFINE_STATIC(struct mutex, foo_lock);
 
 void
 foo_int_increment(void)

Modified: head/sys/compat/linuxkpi/common/src/linux_idr.c
==
--- head/sys/compat/linuxkpi/common/src/linux_idr.c Thu Jul  5 17:11:55 
2018(r336006)
+++ head/sys/compat/linuxkpi/common/src/linux_idr.c Thu Jul  5 17:13:37 
2018(r336007)
@@ -55,7 +55,7 @@ struct linux_idr_cache {
unsigned count;
 };
 
-static DPCPU_DEFINE(struct linux_idr_cache, linux_idr_cache);
+DPCPU_DEFINE_STATIC(struct linux_idr_cache, linux_idr_cache);
 
 /*
  * IDR Implementation.

Modified: head/sys/compat/linuxkpi/common/src/linux_rcu.c
==
--- head/sys/compat/linuxkpi/common/src/linux_rcu.c Thu Jul  5 17:11:55 
2018(r336006)
+++ head/sys/compat/linuxkpi/common/src/linux_rcu.c Thu Jul  5 17:13:37 
2018(r336007)
@@ -92,7 +92,7 @@ CTASSERT(offsetof(struct linux_epoch_record, epoch_rec
 
 static ck_epoch_t linux_epoch;
 static struct linux_epoch_head linux_epoch_head;
-static DPCPU_DEFINE(struct linux_epoch_record, linux_epoch_record);
+DPCPU_DEFINE_STATIC(struct linux_epoch_record, linux_epoch_record);
 
 static void linux_rcu_cleaner_func(void *, int);
 

Modified: head/sys/compat/linuxkpi/common/src/linux_tasklet.c
==
--- head/sys/compat/linuxkpi/common/src/linux_tasklet.c Thu Jul  5 17:11:55 
2018(r336006)
+++ head/sys/compat/linuxkpi/common/src/linux_tasklet.c Thu Jul  5 17:13:37 
2018(r336007)
@@ -61,7 +61,7 @@ struct tasklet_worker {
 #defineTASKLET_WORKER_LOCK(tw) mtx_lock(&(tw)->mtx)
 #defineTASKLET_WORKER_UNLOCK(tw) mtx_unlock(&(tw)->mtx)
 
-static DPCPU_DEFINE(struct tasklet_worker, tasklet_worker);
+DPCPU_DEFINE_STATIC(struct tasklet_worker, tasklet_worker);
 
 static void
 tasklet_handler(void *arg)

Modified: head/sys/kern/kern_clock.c
==
--- head/sys/kern/kern_clock.c  Thu Jul  5 17:11:55 2018(r336006)
+++ head/sys/kern/kern_clock.c  Thu Jul  5 17:13:37 2018(r336007)
@@ -382,7 +382,7 @@ int profprocs;

svn commit: r336005 - head/sys/mips/conf

2018-07-05 Thread Sean Bruno
Author: sbruno
Date: Thu Jul  5 17:09:46 2018
New Revision: 336005
URL: https://svnweb.freebsd.org/changeset/base/336005

Log:
  Remove redundant AH_DEBUG_ALQ.

Modified:
  head/sys/mips/conf/std.AR_MIPS_BASE

Modified: head/sys/mips/conf/std.AR_MIPS_BASE
==
--- head/sys/mips/conf/std.AR_MIPS_BASE Thu Jul  5 17:07:23 2018
(r336004)
+++ head/sys/mips/conf/std.AR_MIPS_BASE Thu Jul  5 17:09:46 2018
(r336005)
@@ -55,7 +55,6 @@ options   ATH_ENABLE_DFS
 
 optionsAH_DEBUG_ALQ
 optionsAH_DEBUG
-optionsAH_DEBUG_ALQ
 optionsAH_SUPPORT_AR5416
 optionsAH_AR5416_INTERRUPT_MITIGATION
 optionsAH_RXCFG_SDMAMW_4BYTES
___
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: r336006 - head/sys/mips/conf

2018-07-05 Thread Sean Bruno
Author: sbruno
Date: Thu Jul  5 17:11:55 2018
New Revision: 336006
URL: https://svnweb.freebsd.org/changeset/base/336006

Log:
  Remove redundant device ar71xx_wdog which is now included from
  std.AR_MIPS_BASE

Modified:
  head/sys/mips/conf/AR71XX_BASE

Modified: head/sys/mips/conf/AR71XX_BASE
==
--- head/sys/mips/conf/AR71XX_BASE  Thu Jul  5 17:09:46 2018
(r336005)
+++ head/sys/mips/conf/AR71XX_BASE  Thu Jul  5 17:11:55 2018
(r336006)
@@ -63,6 +63,5 @@ devicescbus
 device umass
 device da
 
-device ar71xx_wdog
 device uart_ar71xx
 device ar71xx_apb
___
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: r336004 - in head/sys: conf mips/conf riscv/conf

2018-07-05 Thread Sean Bruno
Author: sbruno
Date: Thu Jul  5 17:07:23 2018
New Revision: 336004
URL: https://svnweb.freebsd.org/changeset/base/336004

Log:
  Make ZSTD a real option via ZSTDIO.
  
  It looks like the intent was to allow ZSTD support to be
  compiled into the kernel with options ZSTDIO. But it doesn't look
  like that was ever implemented or I'm missing how to do it.
  
  I did a cursory audit of kernel config files and made a decision to
  enable ZSTDIO in riscv GENERIC and mips MALTA configurations.  All other
  kernel configurations already had this option in their kernel configs
  but they didn't do anything useful as the feature was declared as
  "standard" prior to this.
  
  Reviewed by:  cem allanjude
  Differential Revision:https://reviews.freebsd.org/D16007

Modified:
  head/sys/conf/files
  head/sys/conf/files.mips
  head/sys/conf/files.riscv
  head/sys/mips/conf/std.MALTA
  head/sys/riscv/conf/GENERIC

Modified: head/sys/conf/files
==
--- head/sys/conf/files Thu Jul  5 17:06:54 2018(r336003)
+++ head/sys/conf/files Thu Jul  5 17:07:23 2018(r336004)
@@ -635,22 +635,22 @@ contrib/ngatm/netnatm/sig/sig_unimsgcpy.c optional nga
 contrib/ngatm/netnatm/sig/sig_verify.c optional ngatm_uni \
compile-with "${NORMAL_C} -I$S/contrib/ngatm"
 # Zstd
-contrib/zstd/lib/freebsd/zstd_kmalloc.cstandard compile-with 
${ZSTD_C}
-contrib/zstd/lib/common/zstd_common.c  standard compile-with ${ZSTD_C}
-contrib/zstd/lib/common/fse_decompress.c   standard compile-with ${ZSTD_C}
-contrib/zstd/lib/common/entropy_common.c   standard compile-with ${ZSTD_C}
-contrib/zstd/lib/common/error_private.cstandard compile-with 
${ZSTD_C}
-contrib/zstd/lib/common/xxhash.c   standard compile-with ${ZSTD_C}
-contrib/zstd/lib/compress/zstd_compress.c  standard compile-with ${ZSTD_C}
-contrib/zstd/lib/compress/fse_compress.c   standard compile-with ${ZSTD_C}
-contrib/zstd/lib/compress/huf_compress.c   standard compile-with ${ZSTD_C}
-contrib/zstd/lib/compress/zstd_double_fast.c   standard compile-with ${ZSTD_C}
-contrib/zstd/lib/compress/zstd_fast.c  standard compile-with ${ZSTD_C}
-contrib/zstd/lib/compress/zstd_lazy.c  standard compile-with ${ZSTD_C}
-contrib/zstd/lib/compress/zstd_ldm.c   standard compile-with ${ZSTD_C}
-contrib/zstd/lib/compress/zstd_opt.c   standard compile-with ${ZSTD_C}
-contrib/zstd/lib/decompress/zstd_decompress.c  standard compile-with ${ZSTD_C}
-contrib/zstd/lib/decompress/huf_decompress.c   standard compile-with ${ZSTD_C}
+contrib/zstd/lib/freebsd/zstd_kmalloc.coptional zstdio 
compile-with ${ZSTD_C}
+contrib/zstd/lib/common/zstd_common.c  optional zstdio compile-with 
${ZSTD_C}
+contrib/zstd/lib/common/fse_decompress.c   optional zstdio compile-with 
${ZSTD_C}
+contrib/zstd/lib/common/entropy_common.c   optional zstdio compile-with 
${ZSTD_C}
+contrib/zstd/lib/common/error_private.coptional zstdio 
compile-with ${ZSTD_C}
+contrib/zstd/lib/common/xxhash.c   optional zstdio compile-with 
${ZSTD_C}
+contrib/zstd/lib/compress/zstd_compress.c  optional zstdio compile-with 
${ZSTD_C}
+contrib/zstd/lib/compress/fse_compress.c   optional zstdio compile-with 
${ZSTD_C}
+contrib/zstd/lib/compress/huf_compress.c   optional zstdio compile-with 
${ZSTD_C}
+contrib/zstd/lib/compress/zstd_double_fast.c   optional zstdio compile-with 
${ZSTD_C}
+contrib/zstd/lib/compress/zstd_fast.c  optional zstdio compile-with 
${ZSTD_C}
+contrib/zstd/lib/compress/zstd_lazy.c  optional zstdio compile-with 
${ZSTD_C}
+contrib/zstd/lib/compress/zstd_ldm.c   optional zstdio compile-with 
${ZSTD_C}
+contrib/zstd/lib/compress/zstd_opt.c   optional zstdio compile-with 
${ZSTD_C}
+contrib/zstd/lib/decompress/zstd_decompress.c  optional zstdio compile-with 
${ZSTD_C}
+contrib/zstd/lib/decompress/huf_decompress.c   optional zstdio compile-with 
${ZSTD_C}
 # Blake 2
 contrib/libb2/blake2b-ref.coptional crypto | ipsec | ipsec_support \
compile-with "${NORMAL_C} -I$S/crypto/blake2 -Wno-cast-qual 
-DSUFFIX=_ref -Wno-unused-function"

Modified: head/sys/conf/files.mips
==
--- head/sys/conf/files.mipsThu Jul  5 17:06:54 2018(r336003)
+++ head/sys/conf/files.mipsThu Jul  5 17:07:23 2018(r336004)
@@ -113,4 +113,4 @@ cddl/dev/dtrace/mips/dtrace_subr.c  
optional dtrace c
 cddl/dev/fbt/mips/fbt_isa.coptional dtrace_fbt | 
dtraceall compile-with "${FBT_C}"
 
 # Zstd
-contrib/zstd/lib/freebsd/zstd_kfreebsd.c   standard compile-with 
${ZSTD_C}
+contrib/zstd/lib/freebsd/zstd_kfreebsd.c   optional zstdio 
compile-with ${ZSTD_C}

Modified: head/sys/conf/files.riscv

svn commit: r336003 - head/sys/kern

2018-07-05 Thread Bjoern A. Zeeb
Author: bz
Date: Thu Jul  5 17:06:54 2018
New Revision: 336003
URL: https://svnweb.freebsd.org/changeset/base/336003

Log:
  Split up deadlkres() to make it more readable in anticipation of
  further changes adding another level of indentation.
  
  Some of the logic got simplified with the break out functions.
  There should be no functional changes.
  
  Reviewed by:  kib
  Sponsored by: iXsystems, Inc.
  Differential Revision:https://reviews.freebsd.org/D15914

Modified:
  head/sys/kern/kern_clock.c

Modified: head/sys/kern/kern_clock.c
==
--- head/sys/kern/kern_clock.c  Thu Jul  5 17:02:10 2018(r336002)
+++ head/sys/kern/kern_clock.c  Thu Jul  5 17:06:54 2018(r336003)
@@ -185,12 +185,70 @@ static int blktime_threshold = 900;
 static int sleepfreq = 3;
 
 static void
+deadlres_td_on_lock(struct proc *p, struct thread *td, int blkticks)
+{
+   int tticks;
+
+   sx_assert(&allproc_lock, SX_LOCKED);
+   PROC_LOCK_ASSERT(p, MA_OWNED);
+   THREAD_LOCK_ASSERT(td, MA_OWNED);
+   /*
+* The thread should be blocked on a turnstile, simply check
+* if the turnstile channel is in good state.
+*/
+   MPASS(td->td_blocked != NULL);
+
+   tticks = ticks - td->td_blktick;
+   if (tticks > blkticks)
+   /*
+* Accordingly with provided thresholds, this thread is stuck
+* for too long on a turnstile.
+*/
+   panic("%s: possible deadlock detected for %p, "
+   "blocked for %d ticks\n", __func__, td, tticks);
+}
+
+static void
+deadlres_td_sleep_q(struct proc *p, struct thread *td, int slpticks)
+{
+   void *wchan;
+   int i, slptype, tticks;
+
+   sx_assert(&allproc_lock, SX_LOCKED);
+   PROC_LOCK_ASSERT(p, MA_OWNED);
+   THREAD_LOCK_ASSERT(td, MA_OWNED);
+   /*
+* Check if the thread is sleeping on a lock, otherwise skip the check.
+* Drop the thread lock in order to avoid a LOR with the sleepqueue
+* spinlock.
+*/
+   wchan = td->td_wchan;
+   tticks = ticks - td->td_slptick;
+   slptype = sleepq_type(wchan);
+   if ((slptype == SLEEPQ_SX || slptype == SLEEPQ_LK) &&
+   tticks > slpticks) {
+
+   /*
+* Accordingly with provided thresholds, this thread is stuck
+* for too long on a sleepqueue.
+* However, being on a sleepqueue, we might still check for the
+* blessed list.
+*/
+   for (i = 0; blessed[i] != NULL; i++)
+   if (!strcmp(blessed[i], td->td_wmesg))
+   return;
+
+   panic("%s: possible deadlock detected for %p, "
+   "blocked for %d ticks\n", __func__, td, tticks);
+   }
+}
+
+static void
 deadlkres(void)
 {
struct proc *p;
struct thread *td;
-   void *wchan;
-   int blkticks, i, slpticks, slptype, tryl, tticks;
+   int blkticks, slpticks, tryl;
 
tryl = 0;
for (;;) {
@@ -198,14 +256,15 @@ deadlkres(void)
slpticks = slptime_threshold * hz;
 
/*
-* Avoid to sleep on the sx_lock in order to avoid a possible
-* priority inversion problem leading to starvation.
+* Avoid to sleep on the sx_lock in order to avoid a
+* possible priority inversion problem leading to
+* starvation.
 * If the lock can't be held after 100 tries, panic.
 */
if (!sx_try_slock(&allproc_lock)) {
if (tryl > 100)
-   panic("%s: possible deadlock detected on allproc_lock\n",
-   __func__);
+   panic("%s: possible deadlock detected "
+   "on allproc_lock\n", __func__);
tryl++;
pause("allproc", sleepfreq * hz);
continue;
@@ -218,80 +277,15 @@ deadlkres(void)
continue;
}
FOREACH_THREAD_IN_PROC(p, td) {
-
thread_lock(td);
-   if (TD_ON_LOCK(td)) {
-
-   /*
-* The thread should be blocked on a
-* turnstile, simply check if the
-* turnstile channel is in good state.
-*/
-   MPASS(td->td_blocked != NULL);
-
-   tticks = ticks - td->td_blktick;
-   thread_unlock(td);
-   if (ttick

svn commit: r336002 - in head: usr.bin/netstat usr.sbin/tcpdrop

2018-07-05 Thread Brooks Davis
Author: brooks
Date: Thu Jul  5 17:02:10 2018
New Revision: 336002
URL: https://svnweb.freebsd.org/changeset/base/336002

Log:
  Work around lame warnings in ancient gcc on 32-bit platforms.
  
  Fixes r335979.

Modified:
  head/usr.bin/netstat/inet.c
  head/usr.bin/netstat/unix.c
  head/usr.sbin/tcpdrop/tcpdrop.c

Modified: head/usr.bin/netstat/inet.c
==
--- head/usr.bin/netstat/inet.c Thu Jul  5 16:43:15 2018(r336001)
+++ head/usr.bin/netstat/inet.c Thu Jul  5 17:02:10 2018(r336002)
@@ -159,12 +159,12 @@ sotoxsocket(struct socket *so, struct xsocket *xso)
 
bzero(xso, sizeof *xso);
xso->xso_len = sizeof *xso;
-   xso->xso_so = (kvaddr_t)so;
+   xso->xso_so = (kvaddr_t)(long)so;
xso->so_type = so->so_type;
xso->so_options = so->so_options;
xso->so_linger = so->so_linger;
xso->so_state = so->so_state;
-   xso->so_pcb = (kvaddr_t)so->so_pcb;
+   xso->so_pcb = (kvaddr_t)(long)so->so_pcb;
if (kread((uintptr_t)so->so_proto, &proto, sizeof(proto)) != 0)
return (-1);
xso->xso_protocol = proto.pr_protocol;

Modified: head/usr.bin/netstat/unix.c
==
--- head/usr.bin/netstat/unix.c Thu Jul  5 16:43:15 2018(r336001)
+++ head/usr.bin/netstat/unix.c Thu Jul  5 17:02:10 2018(r336002)
@@ -153,7 +153,7 @@ pcblist_kvm(u_long count_off, u_long gencnt_off, u_lon
xu.xu_len = sizeof xu;
KREAD(head_off, &head, sizeof(head));
LIST_FOREACH(unp, &head, unp_link) {
-   xu.xu_unpp = (kvaddr_t)unp;
+   xu.xu_unpp = (kvaddr_t)(long)unp;
KREAD(unp, &unp0, sizeof (*unp));
unp = &unp0;
 

Modified: head/usr.sbin/tcpdrop/tcpdrop.c
==
--- head/usr.sbin/tcpdrop/tcpdrop.c Thu Jul  5 16:43:15 2018
(r336001)
+++ head/usr.sbin/tcpdrop/tcpdrop.c Thu Jul  5 17:02:10 2018
(r336002)
@@ -235,7 +235,7 @@ tcpdropall(const char *stack, int state)
head = getxpcblist("net.inet.tcp.pcblist");
 
 #defineXINP_NEXT(xinp) 
\
-   ((struct xinpgen *)((uintptr_t)(xinp) + (xinp)->xig_len))
+   ((struct xinpgen *)(long)((uintptr_t)(xinp) + (xinp)->xig_len))
 
for (xinp = XINP_NEXT(head); xinp->xig_len > sizeof *xinp;
xinp = XINP_NEXT(xinp)) {
___
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: r335999 - in head/sys: amd64/amd64 i386/i386

2018-07-05 Thread Oliver Pinter
On Thursday, July 5, 2018, Konstantin Belousov  wrote:

> Author: kib
> Date: Thu Jul  5 16:38:54 2018
> New Revision: 335999
> URL: https://svnweb.freebsd.org/changeset/base/335999
>
> Log:
>   In x86 pmap_extract_and_hold(), there is no need to recalculate the
>   physical address, which is readily available after sucessfull
>   vm_page_pa_tryrelock().


Hi!

Wrong commit message.


>
>   Noted and reviewed by:alc
>   Sponsored by: The FreeBSD Foundation
>   MFC after:1 week
>   Differential revision:https://reviews.freebsd.org/D16085
>
> Modified:
>   head/sys/amd64/amd64/pmap.c
>   head/sys/i386/i386/pmap.c
>
> Modified: head/sys/amd64/amd64/pmap.c
> 
> ==
> --- head/sys/amd64/amd64/pmap.c Thu Jul  5 16:30:32 2018(r335998)
> +++ head/sys/amd64/amd64/pmap.c Thu Jul  5 16:38:54 2018(r335999)
> @@ -2308,7 +2308,6 @@ retry:
> PG_PS_FRAME) | (va & PDRMASK), &pa))
> goto retry;
> m = PHYS_TO_VM_PAGE(pa);
> -   vm_page_hold(m);
> }
> } else {
> pte = *pmap_pde_to_pte(pdep, va);
> @@ -2318,10 +2317,10 @@ retry:
> &pa))
> goto retry;
> m = PHYS_TO_VM_PAGE(pa);
> -   if (m != NULL)
> -   vm_page_hold(m);
> }
> }
> +   if (m != NULL)
> +   vm_page_hold(m);
> }
> PA_UNLOCK_COND(pa);
> PMAP_UNLOCK(pmap);
>
> Modified: head/sys/i386/i386/pmap.c
> 
> ==
> --- head/sys/i386/i386/pmap.c   Thu Jul  5 16:30:32 2018(r335998)
> +++ head/sys/i386/i386/pmap.c   Thu Jul  5 16:38:54 2018(r335999)
> @@ -1673,7 +1673,6 @@ retry:
> PG_PS_FRAME) | (va & PDRMASK), &pa))
> goto retry;
> m = PHYS_TO_VM_PAGE(pa);
> -   vm_page_hold(m);
> }
> } else {
> pte = pmap_pte_ufast(pmap, va, pde);
> @@ -1683,10 +1682,10 @@ retry:
> &pa))
> goto retry;
> m = PHYS_TO_VM_PAGE(pa);
> -   if (m != NULL)
> -   vm_page_hold(m);
> }
> }
> +   if (m != NULL)
> +   vm_page_hold(m);
> }
> PA_UNLOCK_COND(pa);
> PMAP_UNLOCK(pmap);
> ___
> 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-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: r336000 - head/sys/i386/i386

2018-07-05 Thread Konstantin Belousov
Author: kib
Date: Thu Jul  5 16:40:20 2018
New Revision: 336000
URL: https://svnweb.freebsd.org/changeset/base/336000

Log:
  Use vm_page_unhold_pages() instead of manually rolling unoptimized
  version of it.
  
  Noted by: alc
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/i386/i386/copyout.c

Modified: head/sys/i386/i386/copyout.c
==
--- head/sys/i386/i386/copyout.cThu Jul  5 16:38:54 2018
(r335999)
+++ head/sys/i386/i386/copyout.cThu Jul  5 16:40:20 2018
(r336000)
@@ -140,11 +140,7 @@ cp_slow0(vm_offset_t uva, size_t len, bool write,
sx_xunlock(&pc->pc_copyout_slock);
else
mtx_unlock(&pc->pc_copyout_mlock);
-   for (i = 0; i < plen; i++) {
-   vm_page_lock(m[i]);
-   vm_page_unhold(m[i]);
-   vm_page_unlock(m[i]);
-   }
+   vm_page_unhold_pages(m, plen);
return (error);
 }
 
___
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: r336001 - head/sys/vm

2018-07-05 Thread Konstantin Belousov
Author: kib
Date: Thu Jul  5 16:43:15 2018
New Revision: 336001
URL: https://svnweb.freebsd.org/changeset/base/336001

Log:
  Copyout(9) on 4/4 i386 needs correct vm_page_array[].
  
  On the 4/4 i386, copyout(9) may need to call pmap_extract_and_hold()
  on arbitrary userspace mapping.  If the mapping is backed by the
  non-managed cdev pager or by the sg pager, on dense configs we might
  access arbitrary element of vm_page_array[], in particular, not
  corresponding to a page from the memory segment.  Initialize such pages
  as fictitious with the corresponding physical address.
  
  Reported by:  bde
  Reviewed by:  alc, markj (previous version)
  Sponsored by: The FreeBSD Foundation
  Differential revision:https://reviews.freebsd.org/D16085

Modified:
  head/sys/vm/vm_page.c

Modified: head/sys/vm/vm_page.c
==
--- head/sys/vm/vm_page.c   Thu Jul  5 16:40:20 2018(r336000)
+++ head/sys/vm/vm_page.c   Thu Jul  5 16:43:15 2018(r336001)
@@ -551,6 +551,9 @@ vm_page_startup(vm_offset_t vaddr)
vm_paddr_t biggestsize, last_pa, pa;
u_long pagecount;
int biggestone, i, segind;
+#if defined(__i386__) && defined(VM_PHYSSEG_DENSE)
+   long ii;
+#endif
 
biggestsize = 0;
biggestone = 0;
@@ -789,6 +792,13 @@ vm_page_startup(vm_offset_t vaddr)
 * Initialize the page structures and add every available page to the
 * physical memory allocator's free lists.
 */
+#if defined(__i386__) && defined(VM_PHYSSEG_DENSE)
+   for (ii = 0; ii < vm_page_array_size; ii++) {
+   m = &vm_page_array[ii];
+   vm_page_init_page(m, (first_page + ii) << PAGE_SHIFT, 0);
+   m->flags = PG_FICTITIOUS;
+   }
+#endif
vm_cnt.v_page_count = 0;
for (segind = 0; segind < vm_phys_nsegs; segind++) {
seg = &vm_phys_segs[segind];
___
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: r335999 - in head/sys: amd64/amd64 i386/i386

2018-07-05 Thread Konstantin Belousov
Author: kib
Date: Thu Jul  5 16:38:54 2018
New Revision: 335999
URL: https://svnweb.freebsd.org/changeset/base/335999

Log:
  In x86 pmap_extract_and_hold(), there is no need to recalculate the
  physical address, which is readily available after sucessfull
  vm_page_pa_tryrelock().
  
  Noted and reviewed by:alc
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week
  Differential revision:https://reviews.freebsd.org/D16085

Modified:
  head/sys/amd64/amd64/pmap.c
  head/sys/i386/i386/pmap.c

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Thu Jul  5 16:30:32 2018(r335998)
+++ head/sys/amd64/amd64/pmap.c Thu Jul  5 16:38:54 2018(r335999)
@@ -2308,7 +2308,6 @@ retry:
PG_PS_FRAME) | (va & PDRMASK), &pa))
goto retry;
m = PHYS_TO_VM_PAGE(pa);
-   vm_page_hold(m);
}
} else {
pte = *pmap_pde_to_pte(pdep, va);
@@ -2318,10 +2317,10 @@ retry:
&pa))
goto retry;
m = PHYS_TO_VM_PAGE(pa);
-   if (m != NULL)
-   vm_page_hold(m);
}
}
+   if (m != NULL)
+   vm_page_hold(m);
}
PA_UNLOCK_COND(pa);
PMAP_UNLOCK(pmap);

Modified: head/sys/i386/i386/pmap.c
==
--- head/sys/i386/i386/pmap.c   Thu Jul  5 16:30:32 2018(r335998)
+++ head/sys/i386/i386/pmap.c   Thu Jul  5 16:38:54 2018(r335999)
@@ -1673,7 +1673,6 @@ retry:
PG_PS_FRAME) | (va & PDRMASK), &pa))
goto retry;
m = PHYS_TO_VM_PAGE(pa);
-   vm_page_hold(m);
}
} else {
pte = pmap_pte_ufast(pmap, va, pde);
@@ -1683,10 +1682,10 @@ retry:
&pa))
goto retry;
m = PHYS_TO_VM_PAGE(pa);
-   if (m != NULL)
-   vm_page_hold(m);
}
}
+   if (m != NULL)
+   vm_page_hold(m);
}
PA_UNLOCK_COND(pa);
PMAP_UNLOCK(pmap);
___
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: r335979 - in head: . lib/libkvm sys/kern sys/netinet sys/sys usr.bin/netstat usr.bin/sockstat

2018-07-05 Thread Brooks Davis
On Thu, Jul 05, 2018 at 09:10:54AM -0700, Ravi Pokala wrote:
> Hi Brooks,
> 
> -Original Message-
> From:  on behalf of Brooks Davis 
> 
> Date: 2018-07-05, Thursday at 06:13
> To: , , 
> 
> Subject: svn commit: r335979 - in head: . lib/libkvm sys/kern sys/netinet 
> sys/sys usr.bin/netstat usr.bin/sockstat
> 
> > Author: brooks
> > Date: Thu Jul  5 13:13:48 2018
> > New Revision: 335979
> > URL: https://svnweb.freebsd.org/changeset/base/335979
> > 
> > Log:
> >   Make struct xinpcb and friends word-size independent.
> >   
> >   Replace size_t members with ksize_t (uint64_t) and pointer members
> >   (never used as pointers in userspace, but instead as unique
> >   idenitifiers) with kvaddr_t (uint64_t). This makes the structs
> >   identical between 32-bit and 64-bit ABIs.
> ...
> > Modified: head/UPDATING
> > ==
> > --- head/UPDATING   Thu Jul  5 11:50:59 2018(r335978)
> > +++ head/UPDATING   Thu Jul  5 13:13:48 2018(r335979)
> > @@ -31,6 +31,14 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW:
> > disable the most expensive debugging functionality run
> > "ln -s 'abort:false,junk:false' /etc/malloc.conf".)
> >  
> > +20180705:
> > +   The ABI of syscalls used by management tools like sockstat and
> > +   netstat has been broken to allow 32-bit binaries to work on
> > +   64-bit kernels without modification.
> 
> Isn't that what the compat32 layer is for?

compat32 isn't magic.  If one tried, one could hardly design structures
to make 32-bit compat harder then the previous versions.  It's certainly
possible to make work, but quite annoying.  Since the ABI of most these
structures was already broken for 12, I chose this approach as it is
quite trivial.

> > These programs will need
> > +   to match the kernel in order to function.  External programs may
> > +   require minor modifications to accommodate a change of type in
> > +   structures from pointers to 64-bit virtual addresses.
> 
> Doesn't this contradict the earlier statement about letting things run 
> unmodified?

Unmodified post this commit.  We already don't support netstat and
sockstat from 11 on 12 in any architecture combination.

-- Brooks


signature.asc
Description: PGP signature


svn commit: r335998 - in head: sys/kern sys/sys usr.sbin/config

2018-07-05 Thread Kyle Evans
Author: kevans
Date: Thu Jul  5 16:30:32 2018
New Revision: 335998
URL: https://svnweb.freebsd.org/changeset/base/335998

Log:
  kern_environment: use any provided environments, evict hintmode/envmode
  
  At the moment, hintmode and envmode are used to indicate whether static
  hints or static env have been provided in the kernel config(5) and the
  static versions are mutually exclusive with loader(8)-provided environment.
  hintmode *can* be reconfigured later to pull from the dynamic environment,
  thus taking advantage of the loader(8) or post-kmem environment setting.
  
  This changeset fixes both problems at once to move us from a semi-confusing
  state to a consistent state: if an environment file, hints file, or
  loader(8) environment are provided, we use them in a well-known order of
  precedence:
  
  - loader(8) environment
  - static environment
  - static hints file
  
  Once the dynamic environment is setup this becomes a moot point. The
  loader(8) and static environments are merged (respecting the above order of
  precedence), and the static hints are merged in on an as-needed basis after
  the dynamic environment has been setup.
  
  Hints lookup are changed to respect all of the above. Before the dynamic
  environment is setup, lookups use the above-mentioned order and fallback to
  the next environment if a matching hint is not found. Once the dynamic
  environment is setup, that is used on its own since it captures all of the
  above information plus any dynamic kenv settings that came up later in boot.
  
  The following tangentially related changes were made to res_find:
  
  - A hintp cookie is now passed in so that related searches continue using
the chain of environments (or dynamic environment) without relying on
global state
  - All three environments will be searched if they actually have valid hints
to use, rather than just choosing the first environment that actually had
a hint and rolling with that only
  
  The hintmode sysctl has been ripped out. static_{env,hints}.disabled are
  still honored and will disable their respective environments from being used
  for hint lookups and from being merged into the dynamic environment, as
  expected.
  
  MFC after:1 month (maybe)
  Differential Revision:https://reviews.freebsd.org/D15953

Modified:
  head/sys/kern/kern_environment.c
  head/sys/kern/subr_hints.c
  head/sys/sys/systm.h
  head/usr.sbin/config/config.5
  head/usr.sbin/config/config.h
  head/usr.sbin/config/config.y
  head/usr.sbin/config/mkmakefile.c

Modified: head/sys/kern/kern_environment.c
==
--- head/sys/kern/kern_environment.cThu Jul  5 16:28:43 2018
(r335997)
+++ head/sys/kern/kern_environment.cThu Jul  5 16:30:32 2018
(r335998)
@@ -57,14 +57,21 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
+static char *_getenv_dynamic_locked(const char *name, int *idx);
+static char *_getenv_dynamic(const char *name, int *idx);
+
 static MALLOC_DEFINE(M_KENV, "kenv", "kernel environment");
 
 #define KENV_SIZE  512 /* Maximum number of environment strings */
 
-/* pointer to the static environment */
+/* pointer to the config-generated static environment */
 char   *kern_envp;
-static int env_len;
-static int env_pos;
+
+/* pointer to the md-static environment */
+char   *md_envp;
+static int md_env_len;
+static int md_env_pos;
+
 static char*kernenv_next(char *);
 
 /* dynamic environment variables */
@@ -220,16 +227,9 @@ done:
  * environment obtained from a boot loader, or to provide an empty buffer into
  * which MD code can store an initial environment using kern_setenv() calls.
  *
- * When a copy of an initial environment is passed in, we start by scanning 
that
- * env for overrides to the compiled-in envmode and hintmode variables.
+ * kern_envp is set to the static_env generated by config(8).  This implements
+ * the env keyword described in config(5).
  *
- * If the global envmode is 1, the environment is initialized from the global
- * static_env[], regardless of the arguments passed.  This implements the env
- * keyword described in config(5).  In this case env_pos is set to env_len,
- * causing kern_setenv() to return -1 (if len > 0) or panic (if len == 0) until
- * the dynamic environment is available.  The envmode and static_env variables
- * are defined in env.c which is generated by config(8).
- *
  * If len is non-zero, the caller is providing an empty buffer.  The caller 
will
  * subsequently use kern_setenv() to add up to len bytes of initial environment
  * before the dynamic environment is available.
@@ -237,68 +237,112 @@ done:
  * If len is zero, the caller is providing a pre-loaded buffer containing
  * environment strings.  Additional strings cannot be added until the dynamic
  * environment is available.  The memory pointed to must remain stable at least
- * until sysinit runs init_d

Re: svn commit: r335979 - in head: [ Broke the ci.freebsd.org's FreeBSD-head-{mips,powerpc,powerpcspe}-build ]

2018-07-05 Thread Mark Millard via svn-src-head
These are the gcc 4.2.1 32-bit architectures that are broken.
And example is . . .

https://ci.freebsd.org/job/FreeBSD-head-mips-build/3186/consoleText shows:

--- all_subdir_usr.bin ---
cc1: warnings being treated as errors
/usr/src/usr.bin/netstat/inet.c: In function 'sotoxsocket':
/usr/src/usr.bin/netstat/inet.c:162: warning: cast from pointer to integer of 
different size
/usr/src/usr.bin/netstat/inet.c:167: warning: cast from pointer to integer of 
different size
-


===
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: r335997 - in head: sys/kern sys/sys usr.sbin/config

2018-07-05 Thread Kyle Evans
Author: kevans
Date: Thu Jul  5 16:28:43 2018
New Revision: 335997
URL: https://svnweb.freebsd.org/changeset/base/335997

Log:
  Revert r335995 due to accidental changes snuck in

Modified:
  head/sys/kern/kern_environment.c
  head/sys/kern/subr_hints.c
  head/sys/kern/tty.c
  head/sys/sys/systm.h
  head/usr.sbin/config/config.5
  head/usr.sbin/config/config.h
  head/usr.sbin/config/config.y
  head/usr.sbin/config/mkmakefile.c

Modified: head/sys/kern/kern_environment.c
==
--- head/sys/kern/kern_environment.cThu Jul  5 16:27:34 2018
(r335996)
+++ head/sys/kern/kern_environment.cThu Jul  5 16:28:43 2018
(r335997)
@@ -57,21 +57,14 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
-static char *_getenv_dynamic_locked(const char *name, int *idx);
-static char *_getenv_dynamic(const char *name, int *idx);
-
 static MALLOC_DEFINE(M_KENV, "kenv", "kernel environment");
 
 #define KENV_SIZE  512 /* Maximum number of environment strings */
 
-/* pointer to the config-generated static environment */
+/* pointer to the static environment */
 char   *kern_envp;
-
-/* pointer to the md-static environment */
-char   *md_envp;
-static int md_env_len;
-static int md_env_pos;
-
+static int env_len;
+static int env_pos;
 static char*kernenv_next(char *);
 
 /* dynamic environment variables */
@@ -227,9 +220,16 @@ done:
  * environment obtained from a boot loader, or to provide an empty buffer into
  * which MD code can store an initial environment using kern_setenv() calls.
  *
- * kern_envp is set to the static_env generated by config(8).  This implements
- * the env keyword described in config(5).
+ * When a copy of an initial environment is passed in, we start by scanning 
that
+ * env for overrides to the compiled-in envmode and hintmode variables.
  *
+ * If the global envmode is 1, the environment is initialized from the global
+ * static_env[], regardless of the arguments passed.  This implements the env
+ * keyword described in config(5).  In this case env_pos is set to env_len,
+ * causing kern_setenv() to return -1 (if len > 0) or panic (if len == 0) until
+ * the dynamic environment is available.  The envmode and static_env variables
+ * are defined in env.c which is generated by config(8).
+ *
  * If len is non-zero, the caller is providing an empty buffer.  The caller 
will
  * subsequently use kern_setenv() to add up to len bytes of initial environment
  * before the dynamic environment is available.
@@ -237,112 +237,68 @@ done:
  * If len is zero, the caller is providing a pre-loaded buffer containing
  * environment strings.  Additional strings cannot be added until the dynamic
  * environment is available.  The memory pointed to must remain stable at least
- * until sysinit runs init_dynamic_kenv() and preferably until after 
SI_SUB_KMEM
- * is finished so that subr_hints routines may continue to use it until the
- * environments have been fully merged at the end of the pass.  If no initial
- * environment is available from the boot loader, passing a NULL pointer allows
- * the static_env to be installed if it is configured.  In this case, any call
- * to kern_setenv() prior to the setup of the dynamic environment will result 
in
- * a panic.
+ * until sysinit runs init_dynamic_kenv().  If no initial environment is
+ * available from the boot loader, passing a NULL pointer allows the static_env
+ * to be installed if it is configured.
  */
 void
 init_static_kenv(char *buf, size_t len)
 {
-   char *eval;
+   char *cp;
+   
+   for (cp = buf; cp != NULL && cp[0] != '\0'; cp += strlen(cp) + 1) {
+   if (strcmp(cp, "static_env.disabled=1") == 0)
+   envmode = 0;
+   if (strcmp(cp, "static_hints.disabled=1") == 0)
+   hintmode = 0;
+   }
 
-   md_envp = buf;
-   md_env_len = len;
-   md_env_pos = 0;
-
-   /*
-* static_env and static_hints may both be disabled, but in slightly
-* different ways.  For static_env, we just don't setup kern_envp and
-* it's as if a static env wasn't even provided.  For static_hints,
-* we effectively zero out the buffer to stop the rest of the kernel
-* from being able to use it.
-*
-* We're intentionally setting this up so that static_hints.disabled may
-* be specified in either the MD env or the static env. This keeps us
-* consistent in our new world view.
-*/
-   eval = kern_getenv("static_env.disabled");
-   if (eval == NULL || strcmp(eval, "1") != 0)
+   if (envmode == 1) {
kern_envp = static_env;
-   eval = kern_getenv("static_hints.disabled");
-   if (eval != NULL && strcmp(eval, "1") == 0)
-   *static_hints = '\0';
+   env_len = len;
+   env_pos = len;
+   } else {
+   kern_envp

svn commit: r335996 - in head/sys: amd64/amd64 i386/i386

2018-07-05 Thread Konstantin Belousov
Author: kib
Date: Thu Jul  5 16:27:34 2018
New Revision: 335996
URL: https://svnweb.freebsd.org/changeset/base/335996

Log:
  In x86 pmap_extract_and_hold(), there is no need to recalculate the
  physical address, which is readily available after sucessfull
  vm_page_pa_tryrelock().
  
  Noted and reviewed by:alc
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week
  Differential revision:https://reviews.freebsd.org/D16085

Modified:
  head/sys/amd64/amd64/pmap.c
  head/sys/i386/i386/pmap.c

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Thu Jul  5 16:25:48 2018(r335995)
+++ head/sys/amd64/amd64/pmap.c Thu Jul  5 16:27:34 2018(r335996)
@@ -2307,8 +2307,7 @@ retry:
if (vm_page_pa_tryrelock(pmap, (pde &
PG_PS_FRAME) | (va & PDRMASK), &pa))
goto retry;
-   m = PHYS_TO_VM_PAGE((pde & PG_PS_FRAME) |
-   (va & PDRMASK));
+   m = PHYS_TO_VM_PAGE(pa);
vm_page_hold(m);
}
} else {
@@ -2318,7 +2317,7 @@ retry:
if (vm_page_pa_tryrelock(pmap, pte & PG_FRAME,
&pa))
goto retry;
-   m = PHYS_TO_VM_PAGE(pte & PG_FRAME);
+   m = PHYS_TO_VM_PAGE(pa);
if (m != NULL)
vm_page_hold(m);
}

Modified: head/sys/i386/i386/pmap.c
==
--- head/sys/i386/i386/pmap.c   Thu Jul  5 16:25:48 2018(r335995)
+++ head/sys/i386/i386/pmap.c   Thu Jul  5 16:27:34 2018(r335996)
@@ -1672,8 +1672,7 @@ retry:
if (vm_page_pa_tryrelock(pmap, (pde &
PG_PS_FRAME) | (va & PDRMASK), &pa))
goto retry;
-   m = PHYS_TO_VM_PAGE((pde & PG_PS_FRAME) |
-   (va & PDRMASK));
+   m = PHYS_TO_VM_PAGE(pa);
vm_page_hold(m);
}
} else {
@@ -1683,7 +1682,7 @@ retry:
if (vm_page_pa_tryrelock(pmap, pte & PG_FRAME,
&pa))
goto retry;
-   m = PHYS_TO_VM_PAGE(pte & PG_FRAME);
+   m = PHYS_TO_VM_PAGE(pa);
if (m != NULL)
vm_page_hold(m);
}
___
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: r335995 - in head: sys/kern sys/sys usr.sbin/config

2018-07-05 Thread Kyle Evans
Author: kevans
Date: Thu Jul  5 16:25:48 2018
New Revision: 335995
URL: https://svnweb.freebsd.org/changeset/base/335995

Log:
  kern_environment: use any provided environments, evict hintmode/envmode
  
  At the moment, hintmode and envmode are used to indicate whether static
  hints or static env have been provided in the kernel config(5) and the
  static versions are mutually exclusive with loader(8)-provided environment.
  hintmode *can* be reconfigured later to pull from the dynamic environment,
  thus taking advantage of the loader(8) or post-kmem environment setting.
  
  This changeset fixes both problems at once to move us from a semi-confusing
  state to a consistent state: if an environment file, hints file, or
  loader(8) environment are provided, we use them in a well-known order of
  precedence:
  
  - loader(8) environment
  - static environment
  - static hints file
  
  Once the dynamic environment is setup this becomes a moot point. The
  loader(8) and static environments are merged (respecting the above order of
  precedence), and the static hints are merged in on an as-needed basis after
  the dynamic environment has been setup.
  
  Hints lookup are changed to respect all of the above. Before the dynamic
  environment is setup, lookups use the above-mentioned order and fallback to
  the next environment if a matching hint is not found. Once the dynamic
  environment is setup, that is used on its own since it captures all of the
  above information plus any dynamic kenv settings that came up later in boot.
  
  The following tangentially related changes were made to res_find:
  
  - A hintp cookie is now passed in so that related searches continue using
the chain of environments (or dynamic environment) without relying on
global state
  - All three environments will be searched if they actually have valid hints
to use, rather than just choosing the first environment that actually had
a hint and rolling with that only
  
  The hintmode sysctl has been ripped out. static_{env,hints}.disabled are
  still honored and will disable their respective environments from being used
  for hint lookups and from being merged into the dynamic environment, as
  expected.
  
  MFC after:1 month (maybe)
  Differential Revision:https://reviews.freebsd.org/D15953

Modified:
  head/sys/kern/kern_environment.c
  head/sys/kern/subr_hints.c
  head/sys/kern/tty.c
  head/sys/sys/systm.h
  head/usr.sbin/config/config.5
  head/usr.sbin/config/config.h
  head/usr.sbin/config/config.y
  head/usr.sbin/config/mkmakefile.c

Modified: head/sys/kern/kern_environment.c
==
--- head/sys/kern/kern_environment.cThu Jul  5 16:18:05 2018
(r335994)
+++ head/sys/kern/kern_environment.cThu Jul  5 16:25:48 2018
(r335995)
@@ -57,14 +57,21 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
+static char *_getenv_dynamic_locked(const char *name, int *idx);
+static char *_getenv_dynamic(const char *name, int *idx);
+
 static MALLOC_DEFINE(M_KENV, "kenv", "kernel environment");
 
 #define KENV_SIZE  512 /* Maximum number of environment strings */
 
-/* pointer to the static environment */
+/* pointer to the config-generated static environment */
 char   *kern_envp;
-static int env_len;
-static int env_pos;
+
+/* pointer to the md-static environment */
+char   *md_envp;
+static int md_env_len;
+static int md_env_pos;
+
 static char*kernenv_next(char *);
 
 /* dynamic environment variables */
@@ -220,16 +227,9 @@ done:
  * environment obtained from a boot loader, or to provide an empty buffer into
  * which MD code can store an initial environment using kern_setenv() calls.
  *
- * When a copy of an initial environment is passed in, we start by scanning 
that
- * env for overrides to the compiled-in envmode and hintmode variables.
+ * kern_envp is set to the static_env generated by config(8).  This implements
+ * the env keyword described in config(5).
  *
- * If the global envmode is 1, the environment is initialized from the global
- * static_env[], regardless of the arguments passed.  This implements the env
- * keyword described in config(5).  In this case env_pos is set to env_len,
- * causing kern_setenv() to return -1 (if len > 0) or panic (if len == 0) until
- * the dynamic environment is available.  The envmode and static_env variables
- * are defined in env.c which is generated by config(8).
- *
  * If len is non-zero, the caller is providing an empty buffer.  The caller 
will
  * subsequently use kern_setenv() to add up to len bytes of initial environment
  * before the dynamic environment is available.
@@ -237,68 +237,112 @@ done:
  * If len is zero, the caller is providing a pre-loaded buffer containing
  * environment strings.  Additional strings cannot be added until the dynamic
  * environment is available.  The memory pointed to must remain stable at least
- * unt

svn commit: r335994 - head/share/misc

2018-07-05 Thread Jesper Schmitz Mouridsen
Author: jsm (ports committer)
Date: Thu Jul  5 16:18:05 2018
New Revision: 335994
URL: https://svnweb.freebsd.org/changeset/base/335994

Log:
  Add jsm in committers-ports.dot with mentor/mentee
  
  Approved by:  miwi (mentor)
  Differential Revision:https://reviews.freebsd.org/D16143

Modified:
  head/share/misc/committers-ports.dot

Modified: head/share/misc/committers-ports.dot
==
--- head/share/misc/committers-ports.dotThu Jul  5 16:16:28 2018
(r335993)
+++ head/share/misc/committers-ports.dotThu Jul  5 16:18:05 2018
(r335994)
@@ -143,6 +143,7 @@ josef [label="Josef El-Rayes\njo...@freebsd.org\n2004/
 jpaetzel [label="Josh Paetzel\njpaet...@freebsd.org\n2008/09/05"]
 jrm [label="Joseph R. Mingrone\n...@freebsd.org\n2016/09/17"]
 jsa [label="Joseph S. Atkinson\n...@freebsd.org\n2010/07/15"]
+jsm [label="Jesper Schmitz Mouridsen\n...@freebsd.org\n2018/06/30"]
 junovitch [label="Jason Unovitch\njunovi...@freebsd.org\n2015/07/27"]
 jylefort [label="Jean-Yves Lefort\njylef...@freebsd.org\n2005/04/12"]
 kami [label="Dominic Fandrey\nk...@freebsd.org\n2014/09/09"]
@@ -553,6 +554,7 @@ miwi -> farrokhi
 miwi -> fluffy
 miwi -> gahr
 miwi -> joneum
+miwi -> jsm
 miwi -> kmoore
 miwi -> lme
 miwi -> makc
@@ -658,6 +660,7 @@ swills -> dch
 swills -> feld
 swills -> jmd
 swills -> jrm
+swills -> jsm
 swills -> mfechner
 swills -> milki
 swills -> pclin
___
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: r335993 - head/sys/kern

2018-07-05 Thread Bjoern A. Zeeb
Author: bz
Date: Thu Jul  5 16:16:28 2018
New Revision: 335993
URL: https://svnweb.freebsd.org/changeset/base/335993

Log:
  With the introduction of reapers and reaplists in r275800,
  proc0 and init are setup as a circular dependency.
  
  create_init() calls fork1() which calls do_fork(). There the
  newproc (initproc) is setup with a reaper of proc0 who's reaper
  points to itself. The newproc (initproc) is then put on its
  reaper's (proc0) p_reaplist (initproc is a descendants of proc0
  for proc0 to reap). Upon return to create_init(), proc0 is
  added to initproc's p_reaplist (which would mean proc0 is a
  descendant of init, for init to reap). This creates a
  circular dependency which eventually leads to LIST corruptions
  when trying to kill init and a proc0.
  
  For the base system we never really hit this case during reboot.
  The problem only became visible after adding more virtual process
  spaces which could go away cleanly (work existing in an experimental
  branch).
  
  Reviewed by:  kib
  Sponsored by: iXsystems, Inc.
  Differential Revision:https://reviews.freebsd.org/D15924

Modified:
  head/sys/kern/init_main.c

Modified: head/sys/kern/init_main.c
==
--- head/sys/kern/init_main.c   Thu Jul  5 16:15:17 2018(r335992)
+++ head/sys/kern/init_main.c   Thu Jul  5 16:16:28 2018(r335993)
@@ -514,6 +514,7 @@ proc0_init(void *dummy __unused)
p->p_peers = 0;
p->p_leader = p;
p->p_reaper = p;
+   p->p_treeflag |= P_TREE_REAPER;
LIST_INIT(&p->p_reaplist);
 
strncpy(p->p_comm, "kernel", sizeof (p->p_comm));
@@ -851,7 +852,6 @@ create_init(const void *udata __unused)
PROC_LOCK(initproc);
initproc->p_flag |= P_SYSTEM | P_INMEM;
initproc->p_treeflag |= P_TREE_REAPER;
-   LIST_INSERT_HEAD(&initproc->p_reaplist, &proc0, p_reapsibling);
oldcred = initproc->p_ucred;
crcopy(newcred, oldcred);
 #ifdef MAC
___
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: r335979 - in head: . lib/libkvm sys/kern sys/netinet sys/sys usr.bin/netstat usr.bin/sockstat

2018-07-05 Thread Ravi Pokala
Hi Brooks,

-Original Message-
From:  on behalf of Brooks Davis 

Date: 2018-07-05, Thursday at 06:13
To: , , 

Subject: svn commit: r335979 - in head: . lib/libkvm sys/kern sys/netinet 
sys/sys usr.bin/netstat usr.bin/sockstat

> Author: brooks
> Date: Thu Jul  5 13:13:48 2018
> New Revision: 335979
> URL: https://svnweb.freebsd.org/changeset/base/335979
> 
> Log:
>   Make struct xinpcb and friends word-size independent.
>   
>   Replace size_t members with ksize_t (uint64_t) and pointer members
>   (never used as pointers in userspace, but instead as unique
>   idenitifiers) with kvaddr_t (uint64_t). This makes the structs
>   identical between 32-bit and 64-bit ABIs.
...
> Modified: head/UPDATING
> ==
> --- head/UPDATING Thu Jul  5 11:50:59 2018(r335978)
> +++ head/UPDATING Thu Jul  5 13:13:48 2018(r335979)
> @@ -31,6 +31,14 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW:
>   disable the most expensive debugging functionality run
>   "ln -s 'abort:false,junk:false' /etc/malloc.conf".)
>  
> +20180705:
> + The ABI of syscalls used by management tools like sockstat and
> + netstat has been broken to allow 32-bit binaries to work on
> + 64-bit kernels without modification.

Isn't that what the compat32 layer is for?

> These programs will need
> + to match the kernel in order to function.  External programs may
> + require minor modifications to accommodate a change of type in
> + structures from pointers to 64-bit virtual addresses.
> +

Doesn't this contradict the earlier statement about letting things run 
unmodified?

Thanks,

Ravi (rpokala@)


___
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: r335990 - in head: lib/libc/sys sys/compat/freebsd32 sys/kern

2018-07-05 Thread Brooks Davis
Author: brooks
Date: Thu Jul  5 16:03:03 2018
New Revision: 335990
URL: https://svnweb.freebsd.org/changeset/base/335990

Log:
  Revert r335983.
  
  The bfd linker in tree doesn't support multiple names for the same
  symbol (at least with current flags).

Deleted:
  head/lib/libc/sys/compat-stub.c
Modified:
  head/lib/libc/sys/Makefile.inc
  head/lib/libc/sys/Symbol.map
  head/sys/compat/freebsd32/syscalls.master
  head/sys/kern/syscalls.master

Modified: head/lib/libc/sys/Makefile.inc
==
--- head/lib/libc/sys/Makefile.inc  Thu Jul  5 16:00:58 2018
(r335989)
+++ head/lib/libc/sys/Makefile.inc  Thu Jul  5 16:03:03 2018
(r335990)
@@ -48,8 +48,6 @@ SRCS+= brk.c
 SRCS+= pipe.c
 SRCS+= vadvise.c
 
-SRCS+= compat-stub.c
-
 INTERPOSED = \
accept \
accept4 \

Modified: head/lib/libc/sys/Symbol.map
==
--- head/lib/libc/sys/Symbol.mapThu Jul  5 16:00:58 2018
(r335989)
+++ head/lib/libc/sys/Symbol.mapThu Jul  5 16:03:03 2018
(r335990)
@@ -179,6 +179,8 @@ FBSD_1.0 {
munlockall;
munmap;
nanosleep;
+   netbsd_lchown;
+   netbsd_msync;
nfssvc;
nmount;
ntp_adjtime;
@@ -775,6 +777,10 @@ FBSDprivate_1.0 {
__sys_munmap;
_nanosleep;
__sys_nanosleep;
+   _netbsd_lchown;
+   __sys_netbsd_lchown;
+   _netbsd_msync;
+   __sys_netbsd_msync;
_nfssvc;
__sys_nfssvc;
_nmount;

Modified: head/sys/compat/freebsd32/syscalls.master
==
--- head/sys/compat/freebsd32/syscalls.master   Thu Jul  5 16:00:58 2018
(r335989)
+++ head/sys/compat/freebsd32/syscalls.master   Thu Jul  5 16:03:03 2018
(r335990)
@@ -499,10 +499,13 @@
int count); }
 273AUE_NULLUNIMPL  nosys
 274AUE_LCHMOD  NOPROTO { int lchmod(char *path, mode_t mode); }
-275AUE_NULLOBSOL   netbsd_lchown
+275AUE_LCHOWN  NOPROTO { int lchown(char *path, uid_t uid, \
+   gid_t gid); } netbsd_lchown \
+   lchown_args int
 276AUE_LUTIMES STD { int freebsd32_lutimes(char *path, \
struct timeval32 *tptr); }
-277AUE_NULLOBSOL   netbsd_msync
+277AUE_MSYNC   NOPROTO { int msync(void *addr, size_t len, \
+   int flags); } netbsd_msync msync_args int
 278AUE_STAT  COMPAT11|NOPROTO { int nstat(char *path, struct nstat *ub); }
 279AUE_FSTAT COMPAT11|NOPROTO { int nfstat(int fd, struct nstat *sb); }
 280AUE_LSTAT COMPAT11|NOPROTO { int nlstat(char *path, struct nstat *ub); }

Modified: head/sys/kern/syscalls.master
==
--- head/sys/kern/syscalls.master   Thu Jul  5 16:00:58 2018
(r335989)
+++ head/sys/kern/syscalls.master   Thu Jul  5 16:03:03 2018
(r335990)
@@ -630,10 +630,13 @@
size_t count); }
 273AUE_NULLUNIMPL  nosys
 274AUE_LCHMOD  STD { int lchmod(_In_z_ char *path, mode_t mode); }
-275AUE_NULLOBSOL   netbsd_lchown
+275AUE_LCHOWN  NOPROTO { int lchown(char *path, uid_t uid, \
+   gid_t gid); } netbsd_lchown lchown_args \
+   int
 276AUE_LUTIMES STD { int lutimes(_In_z_ char *path, \
_In_ struct timeval *tptr); }
-277AUE_NULLOBSOL   netbsd_msync
+277AUE_MSYNC   NOPROTO { int msync(_In_ void *addr, size_t len, \
+   int flags); } netbsd_msync msync_args int
 278AUE_STATCOMPAT11 { int nstat(_In_z_ char *path, \
_Out_ struct nstat *ub); }
 279AUE_FSTAT   COMPAT11 { int nfstat(int fd, _Out_ struct nstat *sb); }
___
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: r335989 - head/sys/dev/usb/controller

2018-07-05 Thread Ian Lepore
Author: ian
Date: Thu Jul  5 16:00:58 2018
New Revision: 335989
URL: https://svnweb.freebsd.org/changeset/base/335989

Log:
  Detach all children before beginning to tear down the hardware, instead of
  doing it last.  Also, remove the local tracking of whether usb's busdma
  memory allocation got done, because it's safe to call the free_all
  function even if it wasn't.

Modified:
  head/sys/dev/usb/controller/ehci_imx.c

Modified: head/sys/dev/usb/controller/ehci_imx.c
==
--- head/sys/dev/usb/controller/ehci_imx.c  Thu Jul  5 15:52:26 2018
(r335988)
+++ head/sys/dev/usb/controller/ehci_imx.c  Thu Jul  5 16:00:58 2018
(r335989)
@@ -268,7 +268,6 @@ struct imx_ehci_softc {
device_tdev;
struct resource *ehci_mem_res;  /* EHCI core regs. */
struct resource *ehci_irq_res;  /* EHCI core IRQ. */ 
-   boolusb_mem_allocated;
 };
 
 static struct ofw_compat_data compat_data[] = {
@@ -313,13 +312,16 @@ imx_ehci_detach(device_t dev)
 {
struct imx_ehci_softc *sc;
ehci_softc_t *esc;
+   int err;
 
sc = device_get_softc(dev);
 
esc = &sc->ehci_softc;
 
-   if (esc->sc_bus.bdev != NULL)
-   device_delete_child(dev, esc->sc_bus.bdev);
+   /* First detach all children; we can't detach if that fails. */
+   if ((err = device_delete_children(dev)) != 0)
+   return (err);
+
if (esc->sc_flags & EHCI_SCFLG_DONEINIT)
ehci_detach(esc);
if (esc->sc_intr_hdl != NULL)
@@ -332,12 +334,8 @@ imx_ehci_detach(device_t dev)
bus_release_resource(dev, SYS_RES_MEMORY, 0,
sc->ehci_mem_res);
 
-   if (sc->usb_mem_allocated)
-   usb_bus_mem_free_all(&esc->sc_bus, &ehci_iterate_hw_softc);
+   usb_bus_mem_free_all(&esc->sc_bus, &ehci_iterate_hw_softc);
 
-   /* During module unload there are lots of children leftover */
-   device_delete_children(dev);
-
return (0);
 }
 
@@ -415,7 +413,6 @@ imx_ehci_attach(device_t dev)
err = ENOMEM;
goto out;
}
-   sc->usb_mem_allocated = true;
 
/*
 * Set handle to USB related registers subregion used by
___
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: r335916 - head/sys/conf

2018-07-05 Thread Konstantin Belousov
On Thu, Jul 05, 2018 at 07:56:22AM -0700, John Baldwin wrote:
> On 7/4/18 7:22 AM, Konstantin Belousov wrote:
> > On Tue, Jul 03, 2018 at 11:05:42PM +, Matt Macy wrote:
> >> Author: mmacy
> >> Date: Tue Jul  3 23:05:42 2018
> >> New Revision: 335916
> >> URL: https://svnweb.freebsd.org/changeset/base/335916
> >>
> >> Log:
> >>   Enable MODULE_TIED by default for modules compiled with the kernel
> > But why ?
> 
> I think we should enable KLD_TIED to inline critical_* etc. for modules
> built as part of a kernel that are installed alongside the kernel in 
> /boot/.

> I don't think we need to support modules built with kernel A loaded into 
> kernel B.
> 
This is the crusial point.  I do not object, but this this is a radical
change from the previous mode of modules build.

I do not want to put words in other person mouth, but I beliee that the
original intent of KLD_TIED/MODULE_TIED was much more limited.  Only some
specific modules were to be tied.

> I think we should not enable it for "standalone" module builds done in ports 
> or via
> "cd /sys/modules/foo; make" that install to /boot/modules so that those 
> modules can
> work with different kernels.  This still permits someone to load a module 
> into kernel
> A that they had disabled in kernel A's config file (via NO_MODULES or 
> MODULES_OVERRIDE
> or some such) by doing 'cd /sys/modules/foo; make; make load'.
> 
> -- 
> 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: r335988 - head/sys/arm/freescale/vybrid

2018-07-05 Thread Ian Lepore
Author: ian
Date: Thu Jul  5 15:52:26 2018
New Revision: 335988
URL: https://svnweb.freebsd.org/changeset/base/335988

Log:
  Add a missing call to usb_bus_mem_free_all() when detaching.

Modified:
  head/sys/arm/freescale/vybrid/vf_ehci.c

Modified: head/sys/arm/freescale/vybrid/vf_ehci.c
==
--- head/sys/arm/freescale/vybrid/vf_ehci.c Thu Jul  5 15:40:14 2018
(r335987)
+++ head/sys/arm/freescale/vybrid/vf_ehci.c Thu Jul  5 15:52:26 2018
(r335988)
@@ -421,6 +421,8 @@ vybrid_ehci_detach(device_t dev)
sc->sc_intr_hdl = NULL;
}
 
+   usb_bus_mem_free_all(&sc->sc_bus, &ehci_iterate_hw_softc);
+
bus_release_resources(dev, vybrid_ehci_spec, esc->res);
 
return (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: r335987 - head/share/misc

2018-07-05 Thread Sean Chittenden
Author: seanc (ports committer)
Date: Thu Jul  5 15:40:14 2018
New Revision: 335987
URL: https://svnweb.freebsd.org/changeset/base/335987

Log:
  Update with the members of the 10th core team, core.x.

Modified:
  head/share/misc/organization.dot

Modified: head/share/misc/organization.dot
==
--- head/share/misc/organization.dotThu Jul  5 15:36:49 2018
(r335986)
+++ head/share/misc/organization.dotThu Jul  5 15:40:14 2018
(r335987)
@@ -25,7 +25,7 @@ _misc [label="Miscellaneous Hats"]
 
 # Development teams go here alphabetically sorted
 
-core [label="Core Team\nc...@freebsd.org\nallanjude, bapt, bcr,\nbenno, 
emaste, gnn,\nhrs, jhb, kmoore"]
+core [label="Core Team\nc...@freebsd.org\nallanjude, bcr, brooks,\nimp, hrs, 
jeff,\njhb, kmoore, seanc"]
 coresecretary [label="Core Team 
Secretary\ncore-secret...@freebsd.org\nmatthew"]
 doccommitters [label="Doc/www Committers\ndoc-committ...@freebsd.org"]
 doceng [label="Documentation Engineering Team\ndoc...@freebsd.org\ngjb, 
blackend,\ngabor, hrs,\nwblock"]
___
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: r335873 - in head: . sys/amd64/amd64 sys/amd64/include sys/conf sys/i386/i386 sys/i386/include sys/sys sys/vm

2018-07-05 Thread Hans Petter Selasky

On 07/05/18 15:50, Hans Petter Selasky wrote:

Hi,

This change breaks all atomic usage in drm-next-kmod even after r335913.

The problem is simply that SMP is not defined at all for KLD's so all 
non-kernel atomic usage is with MPLOCKED empty!


/*
  * For userland, always use lock prefixes so that the binaries will run
  * on both SMP and !SMP systems.
  */
#if defined(SMP) || !defined(_KERNEL)
#define MPLOCKED    "lock ; "
#else
#define MPLOCKED
#endif


Should the check above be:
#if defined(SMP) || !defined(_KERNEL) || defined(KLD_MODULE)


The problem seems more convoluted. There are more checks I wonder if has 
to be changed.


Currently testing this patch: Same applies for i386.


Index: sys/amd64/include/atomic.h
===
--- sys/amd64/include/atomic.h  (revision 335974)
+++ sys/amd64/include/atomic.h  (working copy)
@@ -132,7 +132,7 @@
  * For userland, always use lock prefixes so that the binaries will run
  * on both SMP and !SMP systems.
  */
-#if defined(SMP) || !defined(_KERNEL)
+#if defined(SMP) || !defined(_KERNEL) || defined(KLD_MODULE)
 #defineMPLOCKED"lock ; "
 #else
 #defineMPLOCKED
@@ -343,7 +343,7 @@
  * and release.
  */
 
-#if defined(_KERNEL)

+#if defined(_KERNEL) || defined(KLD_MODULE)
 
 /*

  * OFFSETOF_MONITORBUF == __pcpu_offset(pc_monitorbuf).
@@ -354,7 +354,7 @@
  */
 #defineOFFSETOF_MONITORBUF 0x100
 
-#if defined(SMP)

+#if defined(SMP) || defined(KLD_MODULE)
 static __inline void
 __storeload_barrier(void)
 {



--HPS
___
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: r335985 - head/sys/arm/freescale/vybrid

2018-07-05 Thread Ian Lepore
Author: ian
Date: Thu Jul  5 15:34:16 2018
New Revision: 335985
URL: https://svnweb.freebsd.org/changeset/base/335985

Log:
  Remove a test and early-out which just can't possibly be right.  It causes
  detach() to do nothing if attach() succeeded, which is the opposite of
  what's needed.  Also, move device_delete_children() from the end to the
  beginning of detach(), so that children won't be trying to make use of the
  hardware we're in the process of shutting down.
  
  PR:   229510

Modified:
  head/sys/arm/freescale/vybrid/vf_ehci.c

Modified: head/sys/arm/freescale/vybrid/vf_ehci.c
==
--- head/sys/arm/freescale/vybrid/vf_ehci.c Thu Jul  5 15:27:38 2018
(r335984)
+++ head/sys/arm/freescale/vybrid/vf_ehci.c Thu Jul  5 15:34:16 2018
(r335985)
@@ -390,8 +390,9 @@ vybrid_ehci_detach(device_t dev)
esc = device_get_softc(dev);
sc = &esc->base;
 
-   if (sc->sc_flags & EHCI_SCFLG_DONEINIT)
-   return (0);
+   /* First detach all children; we can't detach if that fails. */
+   if ((err = device_delete_children(dev)) != 0)
+   return (err);
 
/*
 * only call ehci_detach() after ehci_init()
@@ -419,14 +420,6 @@ vybrid_ehci_detach(device_t dev)
}
sc->sc_intr_hdl = NULL;
}
-
-   if (sc->sc_bus.bdev) {
-   device_delete_child(dev, sc->sc_bus.bdev);
-   sc->sc_bus.bdev = NULL;
-   }
-
-   /* During module unload there are lots of children leftover */
-   device_delete_children(dev);
 
bus_release_resources(dev, vybrid_ehci_spec, esc->res);
 
___
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: r335888 - in head: contrib/blacklist/bin lib/libpjdlog sbin/hastd

2018-07-05 Thread John Baldwin
On 7/4/18 7:25 PM, Ed Maste wrote:
> On 4 July 2018 at 20:55, Eitan Adler  wrote:
>> On Tue, 3 Jul 2018 at 08:22, John Baldwin  wrote:
>>>
>>  since GCC usually breaks
>>> them.
>>
>> Could you explain what you mean or point to a prior conversation?
>>
> I'm not sure if there's a previous discussion, but the short version
> is that the GCC build process includes a 'fixincludes' step which
> installs modified versions of system headers in some path that GCC
> uses in preference to /usr/include. Originally this was done to work
> around broken system includes in proprietary operating systems that
> couldn't easily be fixed upstream. In the case of FreeBSD GCC's
> fixincludes actually just installs broken headers, and removing its
> broken copies is the easy fix.

Worse, the headers in include-fixed don't get updated if you install a
new world with updated system headers, so you can get weird compile
issues because GCC from ports is using stale copies of headers.
It's generally a hack for ancient OS's that isn't relevant on FreeBSD.
The issues that fixincludes thinks it finds and needs to fix aren't
legitimate issues AFAIK (and if they were we'd want to fix our real
headers instead).

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

2018-07-05 Thread John Baldwin
On 7/4/18 7:22 AM, Konstantin Belousov wrote:
> On Tue, Jul 03, 2018 at 11:05:42PM +, Matt Macy wrote:
>> Author: mmacy
>> Date: Tue Jul  3 23:05:42 2018
>> New Revision: 335916
>> URL: https://svnweb.freebsd.org/changeset/base/335916
>>
>> Log:
>>   Enable MODULE_TIED by default for modules compiled with the kernel
> But why ?

I think we should enable KLD_TIED to inline critical_* etc. for modules
built as part of a kernel that are installed alongside the kernel in 
/boot/.
I don't think we need to support modules built with kernel A loaded into kernel 
B.

I think we should not enable it for "standalone" module builds done in ports or 
via
"cd /sys/modules/foo; make" that install to /boot/modules so that those modules 
can
work with different kernels.  This still permits someone to load a module into 
kernel
A that they had disabled in kernel A's config file (via NO_MODULES or 
MODULES_OVERRIDE
or some such) by doing 'cd /sys/modules/foo; make; make load'.

-- 
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: r335983 - in head: lib/libc/sys sys/compat/freebsd32 sys/kern

2018-07-05 Thread Brooks Davis
Author: brooks
Date: Thu Jul  5 14:12:56 2018
New Revision: 335983
URL: https://svnweb.freebsd.org/changeset/base/335983

Log:
  Get rid of netbsd_lchown and netbsd_msync syscall entries.
  
  No valid FreeBSD binary ever called them (they would call lchown and
  msync directly) and we haven't supported NetBSD binaries in ages.
  
  Reviewed by:  kib
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D15814

Added:
  head/lib/libc/sys/compat-stub.c   (contents, props changed)
Modified:
  head/lib/libc/sys/Makefile.inc
  head/lib/libc/sys/Symbol.map
  head/sys/compat/freebsd32/syscalls.master
  head/sys/kern/syscalls.master

Modified: head/lib/libc/sys/Makefile.inc
==
--- head/lib/libc/sys/Makefile.inc  Thu Jul  5 14:09:48 2018
(r335982)
+++ head/lib/libc/sys/Makefile.inc  Thu Jul  5 14:12:56 2018
(r335983)
@@ -48,6 +48,8 @@ SRCS+= brk.c
 SRCS+= pipe.c
 SRCS+= vadvise.c
 
+SRCS+= compat-stub.c
+
 INTERPOSED = \
accept \
accept4 \

Modified: head/lib/libc/sys/Symbol.map
==
--- head/lib/libc/sys/Symbol.mapThu Jul  5 14:09:48 2018
(r335982)
+++ head/lib/libc/sys/Symbol.mapThu Jul  5 14:12:56 2018
(r335983)
@@ -179,8 +179,6 @@ FBSD_1.0 {
munlockall;
munmap;
nanosleep;
-   netbsd_lchown;
-   netbsd_msync;
nfssvc;
nmount;
ntp_adjtime;
@@ -777,10 +775,6 @@ FBSDprivate_1.0 {
__sys_munmap;
_nanosleep;
__sys_nanosleep;
-   _netbsd_lchown;
-   __sys_netbsd_lchown;
-   _netbsd_msync;
-   __sys_netbsd_msync;
_nfssvc;
__sys_nfssvc;
_nmount;

Added: head/lib/libc/sys/compat-stub.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libc/sys/compat-stub.c Thu Jul  5 14:12:56 2018
(r335983)
@@ -0,0 +1,50 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2018 SRI International
+ * All rights reserved.
+ *
+ * This software was developed by SRI International and the University of
+ * Cambridge Computer Laboratory (Department of Computer Science and
+ * Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the
+ * DARPA SSITH research programme.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#include 
+#include 
+#include 
+
+int compat_enosys(void);
+
+int
+compat_enosys(void)
+{
+
+   return (ENOSYS);
+}
+
+__sym_compat(netbsd_lchown, compat_enosys, FBSD_1.0);
+__sym_compat(netbsd_msync, compat_enosys, FBSD_1.0);

Modified: head/sys/compat/freebsd32/syscalls.master
==
--- head/sys/compat/freebsd32/syscalls.master   Thu Jul  5 14:09:48 2018
(r335982)
+++ head/sys/compat/freebsd32/syscalls.master   Thu Jul  5 14:12:56 2018
(r335983)
@@ -499,13 +499,10 @@
int count); }
 273AUE_NULLUNIMPL  nosys
 274AUE_LCHMOD  NOPROTO { int lchmod(char *path, mode_t mode); }
-275AUE_LCHOWN  NOPROTO { int lchown(char *path, uid_t uid, \
-   gid_t gid); } netbsd_lchown \
-   lchown_args int
+275AUE_NULLOBSOL   netbsd_lchown
 276AUE_LUTIMES STD { int freebsd32_lutimes(char *path, \
struct timeval32 *tptr); }
-277AUE_MSYNC   NOPROTO { int msync(void *addr, size_t len, 

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

2018-07-05 Thread Ian Lepore
Author: ian
Date: Thu Jul  5 14:09:48 2018
New Revision: 335982
URL: https://svnweb.freebsd.org/changeset/base/335982

Log:
  Fix an out-of-bounds array access... the irq data for teardown is in two
  arrays, as elements 0 and 1 of one array and elements 1 and 2 of the other.
  Run the loop 0..1 instead of 1..2 and use named constants to offset into
  one of the arrays.
  
  PR:   229508

Modified:
  head/sys/arm/freescale/imx/imx_gpio.c

Modified: head/sys/arm/freescale/imx/imx_gpio.c
==
--- head/sys/arm/freescale/imx/imx_gpio.c   Thu Jul  5 13:45:56 2018
(r335981)
+++ head/sys/arm/freescale/imx/imx_gpio.c   Thu Jul  5 14:09:48 2018
(r335982)
@@ -134,6 +134,8 @@ static struct resource_spec imx_gpio_spec[] = {
{ SYS_RES_IRQ,  1,  RF_ACTIVE },
{ -1, 0 }
 };
+#defineFIRST_IRQRES1
+#defineNUM_IRQRES  2
 
 /*
  * Helpers
@@ -852,9 +854,10 @@ imx51_gpio_detach(device_t dev)
sc = device_get_softc(dev);
 
gpiobus_detach_bus(dev);
-   for (irq = 1; irq <= 2; irq++) {
+   for (irq = 0; irq < NUM_IRQRES; irq++) {
if (sc->gpio_ih[irq])
-   bus_teardown_intr(dev, sc->sc_res[irq], 
sc->gpio_ih[irq]);
+   bus_teardown_intr(dev, sc->sc_res[irq + FIRST_IRQRES],
+   sc->gpio_ih[irq]);
}
bus_release_resources(dev, imx_gpio_spec, sc->sc_res);
mtx_destroy(&sc->sc_mtx);
___
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: r335873 - in head: . sys/amd64/amd64 sys/amd64/include sys/conf sys/i386/i386 sys/i386/include sys/sys sys/vm

2018-07-05 Thread Hans Petter Selasky

On 07/02/18 21:48, Matt Macy wrote:

Author: mmacy
Date: Mon Jul  2 19:48:38 2018
New Revision: 335873
URL:https://svnweb.freebsd.org/changeset/base/335873

Log:
   inline atomics and allow tied modules to inline locks
   
   - inline atomics in modules on i386 and amd64 (they were always

 inline on other arches)
   - allow modules to opt in to inlining locks by specifying
 MODULE_TIED=1 in the makefile
   
   Reviewed by: kib

   Sponsored by: Limelight Networks
   Differential Revision:https://reviews.freebsd.org/D16079


Hi,

This change breaks all atomic usage in drm-next-kmod even after r335913.

The problem is simply that SMP is not defined at all for KLD's so all 
non-kernel atomic usage is with MPLOCKED empty!


/*
 * For userland, always use lock prefixes so that the binaries will run
 * on both SMP and !SMP systems.
 */
#if defined(SMP) || !defined(_KERNEL)
#define MPLOCKED"lock ; "
#else
#define MPLOCKED
#endif


Should the check above be:
#if defined(SMP) || !defined(_KERNEL) || defined(KLD_MODULE)

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

2018-07-05 Thread Konstantin Belousov
Author: kib
Date: Thu Jul  5 13:37:31 2018
New Revision: 335980
URL: https://svnweb.freebsd.org/changeset/base/335980

Log:
  Silence warnings about unused variables when RACCT is defined but RCTL
  is not.
  
  Reported by:  Dries Michiels 
  Sponsored by: The FreeBSD Foundation
  MFC after:3 days

Modified:
  head/sys/kern/kern_jail.c

Modified: head/sys/kern/kern_jail.c
==
--- head/sys/kern/kern_jail.c   Thu Jul  5 13:13:48 2018(r335979)
+++ head/sys/kern/kern_jail.c   Thu Jul  5 13:37:31 2018(r335980)
@@ -3988,8 +3988,10 @@ prison_racct_attach(struct prison *pr)
 static void
 prison_racct_modify(struct prison *pr)
 {
+#ifdef RCTL
struct proc *p;
struct ucred *cred;
+#endif
struct prison_racct *oldprr;
 
ASSERT_RACCT_ENABLED();
___
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: r335979 - in head: . lib/libkvm sys/kern sys/netinet sys/sys usr.bin/netstat usr.bin/sockstat

2018-07-05 Thread Brooks Davis
Author: brooks
Date: Thu Jul  5 13:13:48 2018
New Revision: 335979
URL: https://svnweb.freebsd.org/changeset/base/335979

Log:
  Make struct xinpcb and friends word-size independent.
  
  Replace size_t members with ksize_t (uint64_t) and pointer members
  (never used as pointers in userspace, but instead as unique
  idenitifiers) with kvaddr_t (uint64_t). This makes the structs
  identical between 32-bit and 64-bit ABIs.
  
  On 64-bit bit systems, the ABI is maintained. On 32-bit systems,
  this is an ABI breaking change. The ABI of most of these structs
  was previously broken in r315662.  This also imposes a small API
  change on userspace consumers who must handle kernel pointers
  becoming virtual addresses.
  
  PR:   228301 (exp-run by antoine)
  Reviewed by:  jtl, kib, rwatson (various versions)
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D15386

Modified:
  head/UPDATING
  head/lib/libkvm/kvm.h
  head/sys/kern/kern_descrip.c
  head/sys/kern/uipc_socket.c
  head/sys/kern/uipc_usrreq.c
  head/sys/netinet/in_pcb.c
  head/sys/netinet/in_pcb.h
  head/sys/netinet/sctp_sysctl.c
  head/sys/netinet/sctp_uio.h
  head/sys/netinet/tcp_var.h
  head/sys/sys/file.h
  head/sys/sys/param.h
  head/sys/sys/socketvar.h
  head/sys/sys/types.h
  head/sys/sys/unpcb.h
  head/usr.bin/netstat/inet.c
  head/usr.bin/netstat/unix.c
  head/usr.bin/sockstat/sockstat.c

Modified: head/UPDATING
==
--- head/UPDATING   Thu Jul  5 11:50:59 2018(r335978)
+++ head/UPDATING   Thu Jul  5 13:13:48 2018(r335979)
@@ -31,6 +31,14 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW:
disable the most expensive debugging functionality run
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
 
+20180705:
+   The ABI of syscalls used by management tools like sockstat and
+   netstat has been broken to allow 32-bit binaries to work on
+   64-bit kernels without modification.  These programs will need
+   to match the kernel in order to function.  External programs may
+   require minor modifications to accommodate a change of type in
+   structures from pointers to 64-bit virtual addresses.
+
 20180702:
On i386 and amd64 atomics are now inlined. Out of tree modules using
atomics will need to be rebuilt.

Modified: head/lib/libkvm/kvm.h
==
--- head/lib/libkvm/kvm.h   Thu Jul  5 11:50:59 2018(r335978)
+++ head/lib/libkvm/kvm.h   Thu Jul  5 13:13:48 2018(r335979)
@@ -61,8 +61,6 @@ typedef   __ssize_t   ssize_t;
 #define_SSIZE_T_DECLARED
 #endif
 
-typedefuint64_t kvaddr_t;  /* An address in a target 
image. */
-
 struct kvm_nlist {
const char *n_name;
unsigned char n_type;

Modified: head/sys/kern/kern_descrip.c
==
--- head/sys/kern/kern_descrip.cThu Jul  5 11:50:59 2018
(r335978)
+++ head/sys/kern/kern_descrip.cThu Jul  5 13:13:48 2018
(r335979)
@@ -3362,10 +3362,10 @@ sysctl_kern_file(SYSCTL_HANDLER_ARGS)
if ((fp = fdp->fd_ofiles[n].fde_file) == NULL)
continue;
xf.xf_fd = n;
-   xf.xf_file = fp;
-   xf.xf_data = fp->f_data;
-   xf.xf_vnode = fp->f_vnode;
-   xf.xf_type = fp->f_type;
+   xf.xf_file = (kvaddr_t)fp;
+   xf.xf_data = (kvaddr_t)fp->f_data;
+   xf.xf_vnode = (kvaddr_t)fp->f_vnode;
+   xf.xf_type = (kvaddr_t)fp->f_type;
xf.xf_count = fp->f_count;
xf.xf_msgcount = 0;
xf.xf_offset = foffset_get(fp);

Modified: head/sys/kern/uipc_socket.c
==
--- head/sys/kern/uipc_socket.c Thu Jul  5 11:50:59 2018(r335978)
+++ head/sys/kern/uipc_socket.c Thu Jul  5 13:13:48 2018(r335979)
@@ -3985,12 +3985,12 @@ sotoxsocket(struct socket *so, struct xsocket *xso)
 {
 
xso->xso_len = sizeof *xso;
-   xso->xso_so = so;
+   xso->xso_so = (kvaddr_t)so;
xso->so_type = so->so_type;
xso->so_options = so->so_options;
xso->so_linger = so->so_linger;
xso->so_state = so->so_state;
-   xso->so_pcb = so->so_pcb;
+   xso->so_pcb = (kvaddr_t)so->so_pcb;
xso->xso_protocol = so->so_proto->pr_protocol;
xso->xso_family = so->so_proto->pr_domain->dom_family;
xso->so_timeo = so->so_timeo;

Modified: head/sys/kern/uipc_usrreq.

Re: svn commit: r335833 - in head: share/man/man4 sys/net sys/netpfil/pf

2018-07-05 Thread Antoine Brodin
On Tue, Jul 3, 2018 at 7:42 AM, Kristof Provost  wrote:
> On 3 Jul 2018, at 7:38, Antoine Brodin wrote:
>
> On Sun, Jul 1, 2018 at 3:16 AM, Will Andrews  wrote:
>
> Author: will
> Date: Sun Jul 1 01:16:03 2018
> New Revision: 335833
> URL: https://svnweb.freebsd.org/changeset/base/335833
>
> Log:
> pf: remove unused ioctls.
>
> Several ioctls are unused in pf, in the sense that no base utility
> references them. Additionally, a cursory review of pf-based ports
> indicates they're not used elsewhere either. Some of them have been
> unused since the original import. As far as I can tell, they're also
> unused in OpenBSD. Finally, removing this code removes the need for
> future pf work to take them into account.
>
> Reviewed by: kp
> Differential Revision: https://reviews.freebsd.org/D16076
>
> Modified:
> head/share/man/man4/pf.4
> head/sys/net/pfvar.h
> head/sys/netpfil/pf/pf_ioctl.c
>
> Hi,
>
> This breaks some ports like net/libdnet, please revert or fix the
> ports fallout.
>
> It also uses DIOCCHANGERULE (like sshuttle).
>
> Do you know of any other failures?
> It’d be good to know if reverting just the DIOCCHANGERULE removal would be
> enough to fix all failures, or if there are others that are used as well.

The 2 failures I see are libdnet and miniupnpd missing DIOCCHANGERULE,
 so adding it back may be enough.

Antoine
___
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: r335978 - head/share/man/man7

2018-07-05 Thread Edward Tomasz Napierala
Author: trasz
Date: Thu Jul  5 11:50:59 2018
New Revision: 335978
URL: https://svnweb.freebsd.org/changeset/base/335978

Log:
  Fix mandoc -Tlint warning introduced in r335977.
  
  Reported by:  0mp@
  MFC after:2 weeks
  Sponsored by: DARPA, AFRL

Modified:
  head/share/man/man7/ports.7

Modified: head/share/man/man7/ports.7
==
--- head/share/man/man7/ports.7 Thu Jul  5 11:03:11 2018(r335977)
+++ head/share/man/man7/ports.7 Thu Jul  5 11:50:59 2018(r335978)
@@ -536,7 +536,6 @@ Build and install Emacs:
 cd /usr/ports/editors/emacs
 make install
 .Ed
-.Pp
 .Sh SEE ALSO
 .Xr make 1 ,
 .Xr make.conf 5 ,
___
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: r335977 - head/share/man/man7

2018-07-05 Thread Edward Tomasz Napierala
Author: trasz
Date: Thu Jul  5 11:03:11 2018
New Revision: 335977
URL: https://svnweb.freebsd.org/changeset/base/335977

Log:
  Add trivial usage example to ports(7).
  
  MFC after:2 weeks
  Sponsored by: DARPA, AFRL

Modified:
  head/share/man/man7/ports.7

Modified: head/share/man/man7/ports.7
==
--- head/share/man/man7/ports.7 Thu Jul  5 10:44:18 2018(r335976)
+++ head/share/man/man7/ports.7 Thu Jul  5 11:03:11 2018(r335977)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 13, 2018
+.Dd July 5, 2018
 .Dt PORTS 7
 .Os
 .Sh NAME
@@ -530,6 +530,13 @@ The default ports directory
 .It Pa /usr/ports/Mk/bsd.port.mk
 The big Kahuna.
 .El
+.Sh EXAMPLES
+Build and install Emacs:
+.Bd -literal -offset indent
+cd /usr/ports/editors/emacs
+make install
+.Ed
+.Pp
 .Sh SEE ALSO
 .Xr make 1 ,
 .Xr make.conf 5 ,
___
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: r335976 - head/sys/x86/include

2018-07-05 Thread Konstantin Belousov
Author: kib
Date: Thu Jul  5 10:44:18 2018
New Revision: 335976
URL: https://svnweb.freebsd.org/changeset/base/335976

Log:
  Add a name for the MSR controlling standard extended features report on AMD.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:3 days

Modified:
  head/sys/x86/include/specialreg.h

Modified: head/sys/x86/include/specialreg.h
==
--- head/sys/x86/include/specialreg.h   Thu Jul  5 10:34:01 2018
(r335975)
+++ head/sys/x86/include/specialreg.h   Thu Jul  5 10:44:18 2018
(r335976)
@@ -1008,6 +1008,7 @@
 #defineMSR_SMM_MASK0xc0010113  /* SMM TSEG address mask */
 #defineMSR_VM_CR   0xc0010114  /* SVM: feature control */
 #defineMSR_VM_HSAVE_PA 0xc0010117  /* SVM: host save area address 
*/
+#defineMSR_AMD_CPUID07 0xc0011002  /* CPUID 07 %ebx override */
 #defineMSR_EXTFEATURES 0xc0011005  /* Extended CPUID Features 
override */
 #defineMSR_IC_CFG  0xc0011021  /* Instruction Cache 
Configuration */
 
___
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: r335975 - head/sys/x86/include

2018-07-05 Thread Konstantin Belousov
Author: kib
Date: Thu Jul  5 10:34:01 2018
New Revision: 335975
URL: https://svnweb.freebsd.org/changeset/base/335975

Log:
  Order the portion of the AMD-specific MSRs names definitions numerically.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:3 days

Modified:
  head/sys/x86/include/specialreg.h

Modified: head/sys/x86/include/specialreg.h
==
--- head/sys/x86/include/specialreg.h   Thu Jul  5 03:33:58 2018
(r335974)
+++ head/sys/x86/include/specialreg.h   Thu Jul  5 10:34:01 2018
(r335975)
@@ -998,18 +998,18 @@
 #defineMSR_TOP_MEM 0xc001001a  /* boundary for ram below 4G */
 #defineMSR_TOP_MEM20xc001001d  /* boundary for ram above 4G */
 #defineMSR_NB_CFG1 0xc001001f  /* NB configuration 1 */
+#defineMSR_K8_UCODE_UPDATE 0xc0010020  /* update microcode */
+#defineMSR_MC0_CTL_MASK 0xc0010044
 #defineMSR_P_STATE_LIMIT 0xc0010061/* P-state Current Limit 
Register */
 #defineMSR_P_STATE_CONTROL 0xc0010062  /* P-state Control Register */
 #defineMSR_P_STATE_STATUS 0xc0010063   /* P-state Status Register */
 #defineMSR_P_STATE_CONFIG(n) (0xc0010064 + (n)) /* P-state Config */
 #defineMSR_SMM_ADDR0xc0010112  /* SMM TSEG base address */
 #defineMSR_SMM_MASK0xc0010113  /* SMM TSEG address mask */
+#defineMSR_VM_CR   0xc0010114  /* SVM: feature control */
+#defineMSR_VM_HSAVE_PA 0xc0010117  /* SVM: host save area address 
*/
 #defineMSR_EXTFEATURES 0xc0011005  /* Extended CPUID Features 
override */
 #defineMSR_IC_CFG  0xc0011021  /* Instruction Cache 
Configuration */
-#defineMSR_K8_UCODE_UPDATE 0xc0010020  /* update microcode */
-#defineMSR_MC0_CTL_MASK0xc0010044
-#defineMSR_VM_CR   0xc0010114 /* SVM: feature control */
-#defineMSR_VM_HSAVE_PA 0xc0010117 /* SVM: host save area 
address */
 
 /* MSR_VM_CR related */
 #defineVM_CR_SVMDIS0x10/* SVM: disabled by BIOS */
___
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"