svn commit: r349714 - head/sys/dev/proto

2019-07-03 Thread Marcel Moolenaar
Author: marcel
Date: Thu Jul  4 02:51:34 2019
New Revision: 349714
URL: https://svnweb.freebsd.org/changeset/base/349714

Log:
  Lock busdma operations and serialize detach against open/close
  
  Use sx to allow M_WAITOK allocations (suggested by markj).
  
  admbugs: 782
  Reviewed by:  markj

Modified:
  head/sys/dev/proto/proto.h
  head/sys/dev/proto/proto_busdma.c
  head/sys/dev/proto/proto_busdma.h
  head/sys/dev/proto/proto_core.c

Modified: head/sys/dev/proto/proto.h
==
--- head/sys/dev/proto/proto.h  Wed Jul  3 22:41:54 2019(r349713)
+++ head/sys/dev/proto/proto.h  Thu Jul  4 02:51:34 2019(r349714)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2014, 2015 Marcel Moolenaar
+ * Copyright (c) 2014, 2015, 2019 Marcel Moolenaar
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -36,7 +36,8 @@
 #definePROTO_RES_BUSDMA11
 
 struct proto_res {
-   int r_type;
+   u_int   r_type:8;
+   u_int   r_opened:1;
int r_rid;
union {
struct resource *res;
@@ -47,13 +48,14 @@ struct proto_res {
void*cookie;
struct cdev *cdev;
} r_u;
-   uintptr_t   r_opened;
 };
 
 struct proto_softc {
device_tsc_dev;
struct proto_res sc_res[PROTO_RES_MAX];
int sc_rescnt;
+   int sc_opencnt;
+   struct mtx  sc_mtx;
 };
 
 extern devclass_t proto_devclass;

Modified: head/sys/dev/proto/proto_busdma.c
==
--- head/sys/dev/proto/proto_busdma.c   Wed Jul  3 22:41:54 2019
(r349713)
+++ head/sys/dev/proto/proto_busdma.c   Thu Jul  4 02:51:34 2019
(r349714)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2015 Marcel Moolenaar
+ * Copyright (c) 2015, 2019 Marcel Moolenaar
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -355,6 +356,7 @@ proto_busdma_attach(struct proto_softc *sc)
struct proto_busdma *busdma;
 
busdma = malloc(sizeof(*busdma), M_PROTO_BUSDMA, M_WAITOK | M_ZERO);
+   sx_init(>sxlck, "proto-busdma");
return (busdma);
 }
 
@@ -363,6 +365,7 @@ proto_busdma_detach(struct proto_softc *sc, struct pro
 {
 
proto_busdma_cleanup(sc, busdma);
+   sx_destroy(>sxlck);
free(busdma, M_PROTO_BUSDMA);
return (0);
 }
@@ -373,10 +376,12 @@ proto_busdma_cleanup(struct proto_softc *sc, struct pr
struct proto_md *md, *md1;
struct proto_tag *tag, *tag1;
 
+   sx_xlock(>sxlck);
LIST_FOREACH_SAFE(md, >mds, mds, md1)
proto_busdma_md_destroy_internal(busdma, md);
LIST_FOREACH_SAFE(tag, >tags, tags, tag1)
proto_busdma_tag_destroy(busdma, tag);
+   sx_xunlock(>sxlck);
return (0);
 }
 
@@ -388,6 +393,8 @@ proto_busdma_ioctl(struct proto_softc *sc, struct prot
struct proto_md *md;
int error;
 
+   sx_xlock(>sxlck);
+
error = 0;
switch (ioc->request) {
case PROTO_IOC_BUSDMA_TAG_CREATE:
@@ -470,6 +477,9 @@ proto_busdma_ioctl(struct proto_softc *sc, struct prot
error = EINVAL;
break;
}
+
+   sx_xunlock(>sxlck);
+
return (error);
 }
 
@@ -477,11 +487,20 @@ int
 proto_busdma_mmap_allowed(struct proto_busdma *busdma, vm_paddr_t physaddr)
 {
struct proto_md *md;
+   int result;
 
+   sx_xlock(>sxlck);
+
+   result = 0;
LIST_FOREACH(md, >mds, mds) {
if (physaddr >= trunc_page(md->physaddr) &&
-   physaddr <= trunc_page(md->physaddr + md->tag->maxsz))
-   return (1);
+   physaddr <= trunc_page(md->physaddr + md->tag->maxsz)) {
+   result = 1;
+   break;
+   }
}
-   return (0);
+
+   sx_xunlock(>sxlck);
+
+   return (result);
 }

Modified: head/sys/dev/proto/proto_busdma.h
==
--- head/sys/dev/proto/proto_busdma.h   Wed Jul  3 22:41:54 2019
(r349713)
+++ head/sys/dev/proto/proto_busdma.h   Thu Jul  4 02:51:34 2019
(r349714)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2015 Marcel Moolenaar
+ * Copyright (c) 2015, 2019 Marcel Moolenaar
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -60,6 +60,7 @@ struct proto_busdma {
LIST_HEAD(,proto_tag)   tags;
LIST_HEAD(,proto_md)mds;
bus_dma_tag_t   bd_roottag;
+   struct sx   sxlck;
 };
 
 struct proto_busdma 

svn commit: r349713 - head/sys/vm

2019-07-03 Thread Doug Moore
Author: dougm
Date: Wed Jul  3 22:41:54 2019
New Revision: 349713
URL: https://svnweb.freebsd.org/changeset/base/349713

Log:
  Eliminate a goto and a label in vm_map_wire_locked by inserting an 'else'.
  
  Reviewed by: alc
  Approved by: kib, markj (mentors, implicit)
  Differential Revision: https://reviews.freebsd.org/D20845

Modified:
  head/sys/vm/vm_map.c

Modified: head/sys/vm/vm_map.c
==
--- head/sys/vm/vm_map.cWed Jul  3 21:30:18 2019(r349712)
+++ head/sys/vm/vm_map.cWed Jul  3 22:41:54 2019(r349713)
@@ -3170,9 +3170,7 @@ vm_map_wire_locked(vm_map_t map, vm_offset_t start, vm
rv = KERN_INVALID_ADDRESS;
goto done;
}
-   goto next_entry;
-   }
-   if (entry->wired_count == 0) {
+   } else if (entry->wired_count == 0) {
entry->wired_count++;
 
npages = atop(entry->end - entry->start);
@@ -3250,7 +3248,6 @@ vm_map_wire_locked(vm_map_t map, vm_offset_t start, vm
 * Check the map for holes in the specified region.
 * If VM_MAP_WIRE_HOLESOK was specified, skip this check.
 */
-   next_entry:
if ((flags & VM_MAP_WIRE_HOLESOK) == 0 &&
entry->end < end && entry->next->start > entry->end) {
end = entry->end;
___
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: r349711 - head/sys/dev/iwm

2019-07-03 Thread Mark Johnston
Author: markj
Date: Wed Jul  3 21:05:40 2019
New Revision: 349711
URL: https://svnweb.freebsd.org/changeset/base/349711

Log:
  iwm: Drain callouts after stopping the device during detach.
  
  Otherwise there is a window where they may be rescheduled.  This
  typically manifested as a page fault shortly after unloading if_iwm.ko.
  Close the race by draining callouts after calling iwm_stop_device(),
  which is also what Dragonfly does.
  
  Change whitespace to reduce gratuitous diffs with Dragonfly.
  
  Reported and tested by:   seanc
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/iwm/if_iwm.c

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Wed Jul  3 20:55:08 2019(r349710)
+++ head/sys/dev/iwm/if_iwm.c   Wed Jul  3 21:05:40 2019(r349711)
@@ -6330,12 +6330,9 @@ iwm_detach_local(struct iwm_softc *sc, int do_net80211
if (!sc->sc_attached)
return 0;
sc->sc_attached = 0;
-
-   if (do_net80211)
+   if (do_net80211) {
ieee80211_draintask(>sc_ic, >sc_es_task);
-
-   callout_drain(>sc_led_blink_to);
-   callout_drain(>sc_watchdog_to);
+   }
iwm_stop_device(sc);
if (do_net80211) {
IWM_LOCK(sc);
@@ -6343,6 +6340,8 @@ iwm_detach_local(struct iwm_softc *sc, int do_net80211
IWM_UNLOCK(sc);
ieee80211_ifdetach(>sc_ic);
}
+   callout_drain(>sc_led_blink_to);
+   callout_drain(>sc_watchdog_to);
 
iwm_phy_db_free(sc->sc_phy_db);
sc->sc_phy_db = NULL;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r349641 - head/tools/build/mk

2019-07-03 Thread Tijl Coosemans
On Wed, 3 Jul 2019 09:14:48 -0700 John Baldwin  wrote:
> On 7/3/19 2:14 AM, Tijl Coosemans wrote:
>> Author: tijl
>> Date: Wed Jul  3 09:14:39 2019
>> New Revision: 349641
>> URL: https://svnweb.freebsd.org/changeset/base/349641
>> 
>> Log:
>>   Also remove lib32 versions of libradius.
>>   
>>   MFC after: 1 week  
> 
> I do wonder if we shouldn't try to make OLD_LIBS a bit
> smarter by having it expand to also include the lib32
> (and libsoft) variants.  Having some kind of helper
> to deal with the non-dynamic libs would also be nice
> (it would remove libfoo.a, libfoo_p.a, and libfoo.so
> which always live in /usr/lib, /usr/lib32, and /usr/libsoft).

I hope this file just goes away with base packages.
___
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: r349706 - head

2019-07-03 Thread Tijl Coosemans
Author: tijl
Date: Wed Jul  3 20:52:10 2019
New Revision: 349706
URL: https://svnweb.freebsd.org/changeset/base/349706

Log:
  Fix path of lib32 libcasper.
  
  Reported by:  jhb
  MFC after:1 week

Modified:
  head/ObsoleteFiles.inc

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Wed Jul  3 20:52:07 2019(r349705)
+++ head/ObsoleteFiles.inc  Wed Jul  3 20:52:10 2019(r349706)
@@ -825,7 +825,7 @@ OLD_FILES+=usr/share/man/man3/arc4random_stir.3.gz
 OLD_FILES+=usr/bin/send-pr
 # 20180725: Cleanup old libcasper.so.0
 OLD_LIBS+=lib/libcasper.so.0
-OLD_LIBS+=lib32/libcasper.so.0
+OLD_LIBS+=usr/lib32/libcasper.so.0
 # 20180722: indent(1) option renamed, test files follow
 OLD_FILES+=usr/bin/indent/tests/nsac.0
 OLD_FILES+=usr/bin/indent/tests/nsac.0.pro
___
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: r349640 - head

2019-07-03 Thread Tijl Coosemans
On Wed, 3 Jul 2019 09:11:53 -0700 John Baldwin  wrote:
> On 7/3/19 2:08 AM, Tijl Coosemans wrote:
>> Author: tijl
>> Date: Wed Jul  3 09:08:17 2019
>> New Revision: 349640
>> URL: https://svnweb.freebsd.org/changeset/base/349640
>> 
>> Log:
>>   Also remove lib32 version of libcasper.so.0.
>> 
>> Modified:
>>   head/ObsoleteFiles.inc
>> 
>> Modified: head/ObsoleteFiles.inc
>> ==
>> --- head/ObsoleteFiles.inc   Wed Jul  3 09:06:39 2019(r349639)
>> +++ head/ObsoleteFiles.inc   Wed Jul  3 09:08:17 2019(r349640)
>> @@ -825,6 +825,7 @@ OLD_FILES+=usr/share/man/man3/arc4random_stir.3.gz
>>  OLD_FILES+=usr/bin/send-pr
>>  # 20180725: Cleanup old libcasper.so.0
>>  OLD_LIBS+=lib/libcasper.so.0
>> +OLD_LIBS+=lib32/libcasper.so.0  
> 
> Should this be usr/lib32 instead of lib32?

Yes, fixed in r349706.
___
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: r349697 - head/sys/vm

2019-07-03 Thread Ed Maste
Author: emaste
Date: Wed Jul  3 19:59:56 2019
New Revision: 349697
URL: https://svnweb.freebsd.org/changeset/base/349697

Log:
  correct pmap_ts_referenced return type
  
  pmap_ts_referenced returns a count, not a boolean, and is supposed to
  have int as the return type not boolean_t.
  
  This worked previously because boolean_t is an int typedef.
  
  Discussed with:   kib
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/vm/pmap.h

Modified: head/sys/vm/pmap.h
==
--- head/sys/vm/pmap.h  Wed Jul  3 19:59:48 2019(r349696)
+++ head/sys/vm/pmap.h  Wed Jul  3 19:59:56 2019(r349697)
@@ -164,7 +164,7 @@ void pmap_remove_all(vm_page_t m);
 voidpmap_remove_pages(pmap_t);
 voidpmap_remove_write(vm_page_t m);
 voidpmap_sync_icache(pmap_t, vm_offset_t, vm_size_t);
-boolean_t   pmap_ts_referenced(vm_page_t m);
+int pmap_ts_referenced(vm_page_t m);
 voidpmap_unwire(pmap_t pmap, vm_offset_t start, vm_offset_t end);
 voidpmap_zero_page(vm_page_t);
 voidpmap_zero_page_area(vm_page_t, int off, int size);
___
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: r349677 - in head: sys/kern tools/test/callout_free

2019-07-03 Thread Eric van Gyzen
Author: vangyzen
Date: Wed Jul  3 19:22:44 2019
New Revision: 349677
URL: https://svnweb.freebsd.org/changeset/base/349677

Log:
  Save the last callout function executed on each CPU
  
  Save the last callout function pointer (and its argument) executed
  on each CPU for inspection by a debugger.  Add a ddb `show callout_last`
  command to show these pointers.  Add a kernel module that I used
  for testing that command.
  
  Relocate `ce_migration_cpu` to reduce padding and therefore preserve
  the size of `struct callout_cpu` (320 bytes on amd64) despite the
  added members.
  
  This should help diagnose reference-after-free bugs where the
  callout's mutex has already been freed when `softclock_call_cc`
  tries to unlock it.
  
  You might hope that the pointer would still be available, but it
  isn't.  The argument to that function is on the stack (because
  `softclock_call_cc` uses it later), and that might be enough in
  some cases, but even then, it's very laborious.  A pointer to the
  callout is saved right before these newly added fields, but that
  callout might have been freed.  We still have the pointer to its
  associated mutex, and the name within might be enough, but it might
  also have been freed.
  
  Reviewed by:  markj jhb
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D20794

Added:
  head/tools/test/callout_free/
  head/tools/test/callout_free/Makefile   (contents, props changed)
  head/tools/test/callout_free/callout_free.c   (contents, props changed)
Modified:
  head/sys/kern/kern_timeout.c

Modified: head/sys/kern/kern_timeout.c
==
--- head/sys/kern/kern_timeout.cWed Jul  3 19:22:25 2019
(r349676)
+++ head/sys/kern/kern_timeout.cWed Jul  3 19:22:44 2019
(r349677)
@@ -65,6 +65,7 @@ __FBSDID("$FreeBSD$");
 
 #ifdef DDB
 #include 
+#include 
 #include 
 #endif
 
@@ -143,12 +144,14 @@ u_int callwheelsize, callwheelmask;
 struct cc_exec {
struct callout  *cc_curr;
void(*cc_drain)(void *);
+   void*cc_last_func;
+   void*cc_last_arg;
 #ifdef SMP
void(*ce_migration_func)(void *);
void*ce_migration_arg;
-   int ce_migration_cpu;
sbintime_t  ce_migration_time;
sbintime_t  ce_migration_prec;
+   int ce_migration_cpu;
 #endif
boolcc_cancel;
boolcc_waiting;
@@ -177,6 +180,8 @@ struct callout_cpu {
 #definecallout_migrating(c)((c)->c_iflags & CALLOUT_DFRMIGRATION)
 
 #definecc_exec_curr(cc, dir)   cc->cc_exec_entity[dir].cc_curr
+#definecc_exec_last_func(cc, dir)  
cc->cc_exec_entity[dir].cc_last_func
+#definecc_exec_last_arg(cc, dir)   
cc->cc_exec_entity[dir].cc_last_arg
 #definecc_exec_drain(cc, dir)  cc->cc_exec_entity[dir].cc_drain
 #definecc_exec_next(cc)cc->cc_next
 #definecc_exec_cancel(cc, dir) 
cc->cc_exec_entity[dir].cc_cancel
@@ -686,6 +691,8 @@ softclock_call_cc(struct callout *c, struct callout_cp
c->c_iflags &= ~CALLOUT_PENDING;

cc_exec_curr(cc, direct) = c;
+   cc_exec_last_func(cc, direct) = c_func;
+   cc_exec_last_arg(cc, direct) = c_arg;
cc_exec_cancel(cc, direct) = false;
cc_exec_drain(cc, direct) = NULL;
CC_UNLOCK(cc);
@@ -1669,5 +1676,43 @@ DB_SHOW_COMMAND(callout, db_show_callout)
}
 
_show_callout((struct callout *)addr);
+}
+
+static void
+_show_last_callout(int cpu, int direct, const char *dirstr)
+{
+   struct callout_cpu *cc;
+   void *func, *arg;
+
+   cc = CC_CPU(cpu);
+   func = cc_exec_last_func(cc, direct);
+   arg = cc_exec_last_arg(cc, direct);
+   db_printf("cpu %d last%s callout function: %p ", cpu, dirstr, func);
+   db_printsym((db_expr_t)func, DB_STGY_ANY);
+   db_printf("\ncpu %d last%s callout argument: %p\n", cpu, dirstr, arg);
+}
+
+DB_SHOW_COMMAND(callout_last, db_show_callout_last)
+{
+   int cpu, last;
+
+   if (have_addr) {
+   if (addr < 0 || addr > mp_maxid || CPU_ABSENT(addr)) {
+   db_printf("no such cpu: %d\n", (int)addr);
+   return;
+   }
+   cpu = last = addr;
+   } else {
+   cpu = 0;
+   last = mp_maxid;
+   }
+
+   while (cpu <= last) {
+   if (!CPU_ABSENT(cpu)) {
+   _show_last_callout(cpu, 0, "");
+   _show_last_callout(cpu, 1, " direct");
+   }
+   cpu++;
+   }
 }
 #endif /* DDB */

Added: head/tools/test/callout_free/Makefile

svn commit: r349671 - head/sys/vm

2019-07-03 Thread Mark Johnston
Author: markj
Date: Wed Jul  3 18:46:39 2019
New Revision: 349671
URL: https://svnweb.freebsd.org/changeset/base/349671

Log:
  Cache the next queue element when traversing a page queue.
  
  When QUEUE_MACRO_DEBUG_TRASH is configured, removing a queue element
  invalidates its queue linkage pointers.  vm_pageout_collect_batch()
  was relying on these pointers remaining valid after a removal, so
  modify it to fetch the next queued page before dequeuing the current
  page.
  
  Submitted by: Don Morris 
  Reviewed by:  cem, vangyzen
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D20842

Modified:
  head/sys/vm/vm_pageout.c

Modified: head/sys/vm/vm_pageout.c
==
--- head/sys/vm/vm_pageout.cWed Jul  3 18:29:18 2019(r349670)
+++ head/sys/vm/vm_pageout.cWed Jul  3 18:46:39 2019(r349671)
@@ -266,7 +266,7 @@ static __always_inline void
 vm_pageout_collect_batch(struct scan_state *ss, const bool dequeue)
 {
struct vm_pagequeue *pq;
-   vm_page_t m, marker;
+   vm_page_t m, marker, n;
 
marker = ss->marker;
pq = ss->pq;
@@ -277,7 +277,8 @@ vm_pageout_collect_batch(struct scan_state *ss, const 
vm_pagequeue_lock(pq);
for (m = TAILQ_NEXT(marker, plinks.q); m != NULL &&
ss->scanned < ss->maxscan && ss->bq.bq_cnt < VM_BATCHQUEUE_SIZE;
-   m = TAILQ_NEXT(m, plinks.q), ss->scanned++) {
+   m = n, ss->scanned++) {
+   n = TAILQ_NEXT(m, plinks.q);
if ((m->flags & PG_MARKER) == 0) {
KASSERT((m->aflags & PGA_ENQUEUED) != 0,
("page %p not enqueued", 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: r349656 - head/usr.sbin/bhyve

2019-07-03 Thread Sean Chittenden
Author: seanc (ports committer)
Date: Wed Jul  3 17:24:24 2019
New Revision: 349656
URL: https://svnweb.freebsd.org/changeset/base/349656

Log:
  bhyve/audio: don't leak resources on failed initialization.
  
  Coverity CID: 1402793
  Approved by:  markj, jhb, bhyve
  Differential Revision:https://reviews.freebsd.org/D20841

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

Modified: head/usr.sbin/bhyve/audio.c
==
--- head/usr.sbin/bhyve/audio.c Wed Jul  3 17:09:41 2019(r349655)
+++ head/usr.sbin/bhyve/audio.c Wed Jul  3 17:24:24 2019(r349656)
@@ -103,6 +103,7 @@ audio_init(const char *dev_name, uint8_t dir)
if (aud->fd == -1) {
DPRINTF("Failed to open dev: %s, errno: %d\n",
aud->dev_name, errno);
+   free(aud);
return (NULL);
}
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r349641 - head/tools/build/mk

2019-07-03 Thread John Baldwin
On 7/3/19 2:14 AM, Tijl Coosemans wrote:
> Author: tijl
> Date: Wed Jul  3 09:14:39 2019
> New Revision: 349641
> URL: https://svnweb.freebsd.org/changeset/base/349641
> 
> Log:
>   Also remove lib32 versions of libradius.
>   
>   MFC after:  1 week

I do wonder if we shouldn't try to make OLD_LIBS a bit
smarter by having it expand to also include the lib32
(and libsoft) variants.  Having some kind of helper
to deal with the non-dynamic libs would also be nice
(it would remove libfoo.a, libfoo_p.a, and libfoo.so
which always live in /usr/lib, /usr/lib32, and /usr/libsoft).

-- 
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: r349640 - head

2019-07-03 Thread John Baldwin
On 7/3/19 2:08 AM, Tijl Coosemans wrote:
> Author: tijl
> Date: Wed Jul  3 09:08:17 2019
> New Revision: 349640
> URL: https://svnweb.freebsd.org/changeset/base/349640
> 
> Log:
>   Also remove lib32 version of libcasper.so.0.
> 
> Modified:
>   head/ObsoleteFiles.inc
> 
> Modified: head/ObsoleteFiles.inc
> ==
> --- head/ObsoleteFiles.incWed Jul  3 09:06:39 2019(r349639)
> +++ head/ObsoleteFiles.incWed Jul  3 09:08:17 2019(r349640)
> @@ -825,6 +825,7 @@ OLD_FILES+=usr/share/man/man3/arc4random_stir.3.gz
>  OLD_FILES+=usr/bin/send-pr
>  # 20180725: Cleanup old libcasper.so.0
>  OLD_LIBS+=lib/libcasper.so.0
> +OLD_LIBS+=lib32/libcasper.so.0

Should this be usr/lib32 instead of lib32?

-- 
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: r349649 - head/sys/dev/cxgbe/tom

2019-07-03 Thread John Baldwin
Author: jhb
Date: Wed Jul  3 16:06:11 2019
New Revision: 349649
URL: https://svnweb.freebsd.org/changeset/base/349649

Log:
  Use unmapped (M_NOMAP) mbufs for zero-copy AIO writes via TOE.
  
  Previously the TOE code used its own custom unmapped mbufs via
  EXT_FLAG_VENDOR1.  The old version always wired the entire AIO request
  buffer first for the duration of the AIO operation and constructed
  multiple mbufs which used the wired buffer as an external buffer.
  
  The new version determines how much room is available in the socket
  buffer and only wires the pages needed for the available room building
  chains of M_NOMAP mbufs.  This means that a large AIO write will now
  limit the amount of wired memory it uses to the size of the socket
  buffer.
  
  Reviewed by:  gallatin, np
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D20839

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

Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c
==
--- head/sys/dev/cxgbe/tom/t4_cpl_io.c  Wed Jul  3 09:51:59 2019
(r349648)
+++ head/sys/dev/cxgbe/tom/t4_cpl_io.c  Wed Jul  3 16:06:11 2019
(r349649)
@@ -76,28 +76,6 @@ __FBSDID("$FreeBSD$");
 static voidt4_aiotx_cancel(struct kaiocb *job);
 static voidt4_aiotx_queue_toep(struct socket *so, struct toepcb *toep);
 
-static size_t
-aiotx_mbuf_pgoff(struct mbuf *m)
-{
-   struct aiotx_buffer *ab;
-
-   MPASS(IS_AIOTX_MBUF(m));
-   ab = m->m_ext.ext_arg1;
-   return ((ab->ps.offset + (uintptr_t)m->m_ext.ext_arg2) % PAGE_SIZE);
-}
-
-static vm_page_t *
-aiotx_mbuf_pages(struct mbuf *m)
-{
-   struct aiotx_buffer *ab;
-   int npages;
-
-   MPASS(IS_AIOTX_MBUF(m));
-   ab = m->m_ext.ext_arg1;
-   npages = (ab->ps.offset + (uintptr_t)m->m_ext.ext_arg2) / PAGE_SIZE;
-   return (ab->ps.pages + npages);
-}
-
 void
 send_flowc_wr(struct toepcb *toep, struct flowc_tx_params *ftxp)
 {
@@ -647,10 +625,7 @@ write_tx_sgl(void *dst, struct mbuf *start, struct mbu
 
i = -1;
for (m = start; m != stop; m = m->m_next) {
-   if (IS_AIOTX_MBUF(m))
-   rc = sglist_append_vmpages(, aiotx_mbuf_pages(m),
-   aiotx_mbuf_pgoff(m), m->m_len);
-   else if (m->m_flags & M_NOMAP)
+   if (m->m_flags & M_NOMAP)
rc = sglist_append_mb_ext_pgs(, m);
else
rc = sglist_append(, mtod(m, void *), m->m_len);
@@ -713,7 +688,7 @@ t4_push_frames(struct adapter *sc, struct toepcb *toep
struct sockbuf *sb = >so_snd;
int tx_credits, shove, compl, sowwakeup;
struct ofld_tx_sdesc *txsd;
-   bool aiotx_mbuf_seen;
+   bool nomap_mbuf_seen;
 
INP_WLOCK_ASSERT(inp);
KASSERT(toep->flags & TPF_FLOWC_WR_SENT,
@@ -766,14 +741,11 @@ t4_push_frames(struct adapter *sc, struct toepcb *toep
plen = 0;
nsegs = 0;
max_nsegs_1mbuf = 0; /* max # of SGL segments in any one mbuf */
-   aiotx_mbuf_seen = false;
+   nomap_mbuf_seen = false;
for (m = sndptr; m != NULL; m = m->m_next) {
int n;
 
-   if (IS_AIOTX_MBUF(m))
-   n = sglist_count_vmpages(aiotx_mbuf_pages(m),
-   aiotx_mbuf_pgoff(m), m->m_len);
-   else if (m->m_flags & M_NOMAP)
+   if (m->m_flags & M_NOMAP)
n = sglist_count_mb_ext_pgs(m);
else
n = sglist_count(mtod(m, void *), m->m_len);
@@ -802,8 +774,8 @@ t4_push_frames(struct adapter *sc, struct toepcb *toep
break;
}
 
-   if (IS_AIOTX_MBUF(m))
-   aiotx_mbuf_seen = true;
+   if (m->m_flags & M_NOMAP)
+   nomap_mbuf_seen = true;
if (max_nsegs_1mbuf < n)
max_nsegs_1mbuf = n;
sb_sndptr = m;  /* new sb->sb_sndptr if all goes well */
@@ -852,7 +824,7 @@ t4_push_frames(struct adapter *sc, struct toepcb *toep
panic("%s: excess tx.", __func__);
 
shove = m == NULL && !(tp->t_flags & TF_MORETOCOME);
-   if (plen <= max_imm && !aiotx_mbuf_seen) {
+   if (plen <= max_imm && !nomap_mbuf_seen) {
 
/* Immediate data tx */
 
@@ -1910,71 +1882,94 @@ t4_uninit_cpl_io_handlers(void)
 }
 
 /*
- * Use the 'backend3' field in AIO jobs to store the amount of data
- * sent by the AIO job so far and the 'backend4' field to hold an
- * error that should be reported when the 

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

2019-07-03 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Jul  3 09:48:20 2019
New Revision: 349645
URL: https://svnweb.freebsd.org/changeset/base/349645

Log:
  Remove dead code added after r348743 in the LinuxKPI. The
  LINUXKPI_VERSION macro is not defined for any compiled LinuxKPI code
  which basically means __GFP_NOTWIRED is never checked when allocating
  pages. This should work fine with the existing external DRM code as
  long as the page wiring and unwiring is balanced.
  
  MFC after:3 days
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/gfp.h
  head/sys/compat/linuxkpi/common/src/linux_page.c

Modified: head/sys/compat/linuxkpi/common/include/linux/gfp.h
==
--- head/sys/compat/linuxkpi/common/include/linux/gfp.h Wed Jul  3 09:46:30 
2019(r349644)
+++ head/sys/compat/linuxkpi/common/include/linux/gfp.h Wed Jul  3 09:48:20 
2019(r349645)
@@ -58,9 +58,6 @@
 #define__GFP_NO_KSWAPD 0
 #define__GFP_WAIT  M_WAITOK
 #define__GFP_DMA32 (1U << 24) /* LinuxKPI only */
-#if defined(LINUXKPI_VERSION) && LINUXKPI_VERSION == 5
-#define__GFP_NOTWIRED  (1U << 25)
-#endif
 #define__GFP_BITS_SHIFT 25
 #define__GFP_BITS_MASK ((1 << __GFP_BITS_SHIFT) - 1)
 #define__GFP_NOFAILM_WAITOK
@@ -101,9 +98,6 @@ static inline struct page *
 alloc_page(gfp_t flags)
 {
 
-#ifdef __GFP_NOTWIRED
-   flags |= __GFP_NOTWIRED;
-#endif
return (linux_alloc_pages(flags, 0));
 }
 
@@ -111,9 +105,6 @@ static inline struct page *
 alloc_pages(gfp_t flags, unsigned int order)
 {
 
-#ifdef __GFP_NOTWIRED
-   flags |= __GFP_NOTWIRED;
-#endif
return (linux_alloc_pages(flags, order));
 }
 
@@ -121,9 +112,6 @@ static inline struct page *
 alloc_pages_node(int node_id, gfp_t flags, unsigned int order)
 {
 
-#ifdef __GFP_NOTWIRED
-   flags |= __GFP_NOTWIRED;
-#endif
return (linux_alloc_pages(flags, order));
 }
 

Modified: head/sys/compat/linuxkpi/common/src/linux_page.c
==
--- head/sys/compat/linuxkpi/common/src/linux_page.cWed Jul  3 09:46:30 
2019(r349644)
+++ head/sys/compat/linuxkpi/common/src/linux_page.cWed Jul  3 09:48:20 
2019(r349645)
@@ -93,10 +93,6 @@ linux_alloc_pages(gfp_t flags, unsigned int order)
unsigned long npages = 1UL << order;
int req = VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | VM_ALLOC_NORMAL;
 
-#ifdef __GFP_NOTWIRED
-   if ((flags & __GFP_NOTWIRED) != 0)
-   req &= ~VM_ALLOC_WIRED;
-#endif
if ((flags & M_ZERO) != 0)
req |= VM_ALLOC_ZERO;
if (order == 0 && (flags & GFP_DMA32) == 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: r349641 - head/tools/build/mk

2019-07-03 Thread Tijl Coosemans
Author: tijl
Date: Wed Jul  3 09:14:39 2019
New Revision: 349641
URL: https://svnweb.freebsd.org/changeset/base/349641

Log:
  Also remove lib32 versions of libradius.
  
  MFC after:1 week

Modified:
  head/tools/build/mk/OptionalObsoleteFiles.inc

Modified: head/tools/build/mk/OptionalObsoleteFiles.inc
==
--- head/tools/build/mk/OptionalObsoleteFiles.inc   Wed Jul  3 09:08:17 
2019(r349640)
+++ head/tools/build/mk/OptionalObsoleteFiles.inc   Wed Jul  3 09:14:39 
2019(r349641)
@@ -8321,6 +8321,12 @@ OLD_LIBS+=usr/lib/libradius.so.4
 OLD_FILES+=usr/lib/libradius_p.a
 OLD_FILES+=usr/lib/pam_radius.so
 OLD_LIBS+=usr/lib/pam_radius.so.6
+OLD_FILES+=usr/lib32/libradius.a
+OLD_FILES+=usr/lib32/libradius.so
+OLD_LIBS+=usr/lib32/libradius.so.4
+OLD_FILES+=usr/lib32/libradius_p.a
+OLD_FILES+=usr/lib32/pam_radius.so
+OLD_LIBS+=usr/lib32/pam_radius.so.6
 OLD_FILES+=usr/include/radlib.h
 OLD_FILES+=usr/include/radlib_vs.h
 OLD_FILES+=usr/share/man/man3/libradius.3.gz
___
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: r349640 - head

2019-07-03 Thread Tijl Coosemans
Author: tijl
Date: Wed Jul  3 09:08:17 2019
New Revision: 349640
URL: https://svnweb.freebsd.org/changeset/base/349640

Log:
  Also remove lib32 version of libcasper.so.0.

Modified:
  head/ObsoleteFiles.inc

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Wed Jul  3 09:06:39 2019(r349639)
+++ head/ObsoleteFiles.inc  Wed Jul  3 09:08:17 2019(r349640)
@@ -825,6 +825,7 @@ OLD_FILES+=usr/share/man/man3/arc4random_stir.3.gz
 OLD_FILES+=usr/bin/send-pr
 # 20180725: Cleanup old libcasper.so.0
 OLD_LIBS+=lib/libcasper.so.0
+OLD_LIBS+=lib32/libcasper.so.0
 # 20180722: indent(1) option renamed, test files follow
 OLD_FILES+=usr/bin/indent/tests/nsac.0
 OLD_FILES+=usr/bin/indent/tests/nsac.0.pro
___
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: r349639 - head

2019-07-03 Thread Tijl Coosemans
Author: tijl
Date: Wed Jul  3 09:06:39 2019
New Revision: 349639
URL: https://svnweb.freebsd.org/changeset/base/349639

Log:
  Also remove lib32 version of libprivateifconfig after r344530.

Modified:
  head/ObsoleteFiles.inc

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Wed Jul  3 03:42:51 2019(r349638)
+++ head/ObsoleteFiles.inc  Wed Jul  3 09:06:39 2019(r349639)
@@ -388,6 +388,8 @@ OLD_FILES+=usr/include/sys/seq.h
 # 20190222: libifconfig made INTERNALLIB
 OLD_FILES+=usr/lib/libprivateifconfig.a
 OLD_FILES+=usr/lib/libprivateifconfig_p.a
+OLD_FILES+=usr/lib32/libprivateifconfig.a
+OLD_FILES+=usr/lib32/libprivateifconfig_p.a
 # 20190131: pfil(9) changed
 OLD_FILES+=usr/share/man/man9/pfil_hook_get.9.gz
 OLD_FILES+=usr/share/man/man9/pfil_rlock.9.gz
___
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"