svn commit: r356169 - head/usr.sbin/fstyp

2019-12-28 Thread Adrian Chadd
Author: adrian
Date: Sun Dec 29 06:59:09 2019
New Revision: 356169
URL: https://svnweb.freebsd.org/changeset/base/356169

Log:
  Make this compile under external gcc toolchain if WITH_ICONV isn't defined.
  
  This quietens a bunch of unused variable warnings that are treated as errors.

Modified:
  head/usr.sbin/fstyp/ntfs.c

Modified: head/usr.sbin/fstyp/ntfs.c
==
--- head/usr.sbin/fstyp/ntfs.c  Sun Dec 29 05:36:01 2019(r356168)
+++ head/usr.sbin/fstyp/ntfs.c  Sun Dec 29 06:59:09 2019(r356169)
@@ -134,12 +134,15 @@ int
 fstyp_ntfs(FILE *fp, char *label, size_t size)
 {
struct ntfs_bootfile *bf;
+   char *filerecp;
+#ifdef WITH_ICONV
struct ntfs_filerec *fr;
struct ntfs_attr *atr;
off_t voloff;
-   char *filerecp, *ap;
+   char *ap;
int8_t mftrecsz;
int recsize;
+#endif /* WITH_ICONV */
 
filerecp = NULL;
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r356168 - head/sys/i386/i386

2019-12-28 Thread Alan Cox
Author: alc
Date: Sun Dec 29 05:36:01 2019
New Revision: 356168
URL: https://svnweb.freebsd.org/changeset/base/356168

Log:
  Correctly implement PMAP_ENTER_NOREPLACE in pmap_enter_{l2,pde}() on kernel
  mappings.
  
  Reduce code duplication by defining a function, pmap_abort_ptp(), for
  handling a common error case.
  
  Simplify error handling in pmap_enter_quick_locked().
  
  Reviewed by:  kib
  Tested by:pho
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D22890

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

Modified: head/sys/i386/i386/pmap.c
==
--- head/sys/i386/i386/pmap.c   Sun Dec 29 04:58:27 2019(r356167)
+++ head/sys/i386/i386/pmap.c   Sun Dec 29 05:36:01 2019(r356168)
@@ -314,6 +314,7 @@ static pv_entry_t pmap_pvh_remove(struct md_page *pvh,
vm_offset_t va);
 static int pmap_pvh_wired_mappings(struct md_page *pvh, int count);
 
+static voidpmap_abort_ptp(pmap_t pmap, vm_offset_t va, vm_page_t mpte);
 static boolean_t pmap_demote_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va);
 static boolpmap_enter_4mpage(pmap_t pmap, vm_offset_t va, vm_page_t m,
vm_prot_t prot);
@@ -2008,6 +2009,27 @@ pmap_unuse_pt(pmap_t pmap, vm_offset_t va, struct spgl
 }
 
 /*
+ * Release a page table page reference after a failed attempt to create a
+ * mapping.
+ */
+static void
+pmap_abort_ptp(pmap_t pmap, vm_offset_t va, vm_page_t mpte)
+{
+   struct spglist free;
+
+   SLIST_INIT();
+   if (pmap_unwire_ptp(pmap, mpte, )) {
+   /*
+* Although "va" was never mapped, paging-structure caches
+* could nonetheless have entries that refer to the freed
+* page table pages.  Invalidate those entries.
+*/
+   pmap_invalidate_page_int(pmap, va);
+   vm_page_free_pages_toq(, true);
+   }
+}
+
+/*
  * Initialize the pmap for the swapper process.
  */
 static void
@@ -3895,6 +3917,24 @@ pmap_enter_4mpage(pmap_t pmap, vm_offset_t va, vm_page
 }
 
 /*
+ * Returns true if every page table entry in the page table page that maps
+ * the specified kernel virtual address is zero.
+ */
+static bool
+pmap_every_pte_zero(vm_offset_t va)
+{
+   pt_entry_t *pt_end, *pte;
+
+   KASSERT((va & PDRMASK) == 0, ("va is misaligned"));
+   pte = vtopte(va);
+   for (pt_end = pte + NPTEPG; pte < pt_end; pte++) {
+   if (*pte != 0)
+   return (false);
+   }
+   return (true);
+}
+
+/*
  * Tries to create the specified 2 or 4 MB page mapping.  Returns KERN_SUCCESS
  * if the mapping was created, and either KERN_FAILURE or
  * KERN_RESOURCE_SHORTAGE otherwise.  Returns KERN_FAILURE if
@@ -3921,7 +3961,9 @@ pmap_enter_pde(pmap_t pmap, vm_offset_t va, pd_entry_t
pde = pmap_pde(pmap, va);
oldpde = *pde;
if ((oldpde & PG_V) != 0) {
-   if ((flags & PMAP_ENTER_NOREPLACE) != 0) {
+   if ((flags & PMAP_ENTER_NOREPLACE) != 0 && (pmap !=
+   kernel_pmap || (oldpde & PG_PS) != 0 ||
+   !pmap_every_pte_zero(va))) {
CTR2(KTR_PMAP, "pmap_enter_pde: failure for va %#lx"
" in pmap %p", va, pmap);
return (KERN_FAILURE);
@@ -3940,8 +3982,14 @@ pmap_enter_pde(pmap_t pmap, vm_offset_t va, pd_entry_t
if (pmap_remove_ptes(pmap, va, va + NBPDR, ))
   pmap_invalidate_all_int(pmap);
}
-   vm_page_free_pages_toq(, true);
-   if (pmap == kernel_pmap) {
+   if (pmap != kernel_pmap) {
+   vm_page_free_pages_toq(, true);
+   KASSERT(*pde == 0, ("pmap_enter_pde: non-zero pde %p",
+   pde));
+   } else {
+   KASSERT(SLIST_EMPTY(),
+   ("pmap_enter_pde: freed kernel page table page"));
+
/*
 * Both pmap_remove_pde() and pmap_remove_ptes() will
 * leave the kernel page table page zero filled.
@@ -3949,9 +3997,7 @@ pmap_enter_pde(pmap_t pmap, vm_offset_t va, pd_entry_t
mt = PHYS_TO_VM_PAGE(*pde & PG_FRAME);
if (pmap_insert_pt_page(pmap, mt, false))
panic("pmap_enter_pde: trie insert failed");
-   } else
-   KASSERT(*pde == 0, ("pmap_enter_pde: non-zero pde %p",
-   pde));
+   }
}
if ((newpde & PG_MANAGED) != 0) {
/*
@@ -3982,8 +4028,8 @@ pmap_enter_pde(pmap_t pmap, vm_offset_t va, pd_entry_t
pde_store(pde, newpde);
 
pmap_pde_mappings++;
-   CTR2(KTR_PMAP, "pmap_enter_pde: success for va %#lx"
-   

svn commit: r356166 - head/sys/riscv/sifive

2019-12-28 Thread Philip Paeps
Author: philip
Date: Sun Dec 29 04:26:10 2019
New Revision: 356166
URL: https://svnweb.freebsd.org/changeset/base/356166

Log:
  fuspi: Fix 'sleepable after non-sleepable' lock
  
  With WITNESS enabled we see the following warning:
  
  lock order reversal: (sleepable after non-sleepable)
   1st 0xffd0847c7210 fu540spi0 (fu540spi0) @
   /usr/home/kp/axiado/hornet-freebsd/src/sys/riscv/sifive/fu540_spi.c:297
2nd 0xffc00372bb30 Clock topology lock (Clock topology lock) @
/usr/home/kp/axiado/hornet-freebsd/src/sys/dev/extres/clk/clk.c:1137
stack backtrace:
#0 0xffc0002a579e at witness_checkorder+0xb72
#1 0xffc0002a5556 at witness_checkorder+0x92a
#2 0xffc000254c7a at _sx_slock_int+0x66
#3 0xffc00025537a at _sx_slock+0x8
#4 0xffc000123022 at clk_get_freq+0x38
#5 0xffc0005463e4 at __clzdi2+0x2bb8
#6 0xffc00014af58 at randomdev_getkey+0x76e
#7 0xffc0001278b0 at simplebus_add_device+0x7ee
#8 0xffc00027c9a8 at device_attach+0x2e6
#9 0xffc00027c634 at device_probe_and_attach+0x7a
#10 0xffc00027d76a at bus_generic_attach+0x10
#11 0xffc00014aab0 at randomdev_getkey+0x2c6
#12 0xffc00027c9a8 at device_attach+0x2e6
#13 0xffc00027c634 at device_probe_and_attach+0x7a
#14 0xffc00027d76a at bus_generic_attach+0x10
#15 0xffc000278bd2 at config_intrhook_oneshot+0x52
#16 0xffc000278b3e at config_intrhook_establish+0x146
#17 0xffc000278cf2 at config_intrhook_disestablish+0xfe
  
  The clock topology lock can sleep, which means we cannot attempt to
  acquire it while holding the non-sleepable mutex.
  
  Fix that by retrieving the clock speed once, during attach and not every
  time during SPI transaction setup.
  
  Submitted by:   kp
  Sponsored by:   Axiado

Modified:
  head/sys/riscv/sifive/fu540_spi.c

Modified: head/sys/riscv/sifive/fu540_spi.c
==
--- head/sys/riscv/sifive/fu540_spi.c   Sun Dec 29 02:12:18 2019
(r356165)
+++ head/sys/riscv/sifive/fu540_spi.c   Sun Dec 29 04:26:10 2019
(r356166)
@@ -80,6 +80,7 @@ struct fuspi_softc {
void*ih;
 
clk_t   clk;
+   uint64_tfreq;
uint32_tcs_max;
 };
 
@@ -207,22 +208,14 @@ fuspi_setup(struct fuspi_softc *sc, uint32_t cs, uint3
 uint32_t freq)
 {
uint32_t csmode, fmt, sckdiv, sckmode;
-   uint64_t clock;
-   int ret;
 
FUSPI_ASSERT_LOCKED(sc);
 
-   ret = clk_get_freq(sc->clk, );
-   if (ret) {
-   device_printf(sc->dev, "Cannot get clock frequency: %d\n", ret);
-   return (ret);
-   }
-
/*
 * Fsck = Fin / 2 * (div + 1)
 * -> div = Fin / (2 * Fsck) - 1
 */
-   sckdiv = (howmany(clock >> 1, freq) - 1) & FUSPI_SCKDIV_MASK;
+   sckdiv = (howmany(sc->freq >> 1, freq) - 1) & FUSPI_SCKDIV_MASK;
FUSPI_WRITE(sc, FUSPI_REG_SCKDIV, sckdiv);
 
switch (mode) {
@@ -328,6 +321,12 @@ fuspi_attach(device_t dev)
error = clk_enable(sc->clk);
if (error) {
device_printf(dev, "Couldn't enable clock: %d\n", error);
+   goto fail;
+   }
+
+   error = clk_get_freq(sc->clk, >freq);
+   if (error) {
+   device_printf(sc->dev, "Couldn't get frequency: %d\n", error);
goto fail;
}
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r356159 - head/sys/vm

2019-12-28 Thread Oliver Pinter
Is there any performance measurement from before and after. It would be
nice to see them.

On Saturday, December 28, 2019, Mark Johnston  wrote:

> Author: markj
> Date: Sat Dec 28 19:04:29 2019
> New Revision: 356159
> URL: https://svnweb.freebsd.org/changeset/base/356159
>
> Log:
>   Remove some unused functions.
>
>   The previous series of patches orphaned some vm_page functions, so
>   remove them.
>
>   Reviewed by:  dougm, kib
>   Sponsored by: Netflix, Intel
>   Differential Revision:https://reviews.freebsd.org/D22886
>
> Modified:
>   head/sys/vm/vm_page.c
>   head/sys/vm/vm_page.h
>
> Modified: head/sys/vm/vm_page.c
> 
> ==
> --- head/sys/vm/vm_page.c   Sat Dec 28 19:04:15 2019(r356158)
> +++ head/sys/vm/vm_page.c   Sat Dec 28 19:04:29 2019(r356159)
> @@ -3662,52 +3662,6 @@ vm_page_enqueue(vm_page_t m, uint8_t queue)
>  }
>
>  /*
> - * vm_page_requeue:[ internal use only ]
> - *
> - * Schedule a requeue of the given page.
> - *
> - * The page must be locked.
> - */
> -void
> -vm_page_requeue(vm_page_t m)
> -{
> -
> -   vm_page_assert_locked(m);
> -   KASSERT(vm_page_queue(m) != PQ_NONE,
> -   ("%s: page %p is not logically enqueued", __func__, m));
> -   KASSERT(m->ref_count > 0,
> -   ("%s: page %p does not carry any references", __func__, m));
> -
> -   if ((m->a.flags & PGA_REQUEUE) == 0)
> -   vm_page_aflag_set(m, PGA_REQUEUE);
> -   vm_page_pqbatch_submit(m, atomic_load_8(>a.queue));
> -}
> -
> -/*
> - * vm_page_swapqueue:  [ internal use only ]
> - *
> - * Move the page from one queue to another, or to the tail of its
> - * current queue, in the face of a possible concurrent free of the
> - * page.
> - */
> -void
> -vm_page_swapqueue(vm_page_t m, uint8_t oldq, uint8_t newq)
> -{
> -   vm_page_astate_t new, old;
> -
> -   old = vm_page_astate_load(m);
> -   do {
> -   if (old.queue != oldq || (old.flags & PGA_DEQUEUE) != 0)
> -   return;
> -   new = old;
> -   new.flags |= PGA_REQUEUE;
> -   new.queue = newq;
> -   } while (!vm_page_pqstate_commit_dequeue(m, , new));
> -
> -   vm_page_pqbatch_submit(m, newq);
> -}
> -
> -/*
>   * vm_page_free_prep:
>   *
>   * Prepares the given page to be put on the free list,
>
> Modified: head/sys/vm/vm_page.h
> 
> ==
> --- head/sys/vm/vm_page.h   Sat Dec 28 19:04:15 2019(r356158)
> +++ head/sys/vm/vm_page.h   Sat Dec 28 19:04:29 2019(r356159)
> @@ -649,7 +649,6 @@ bool vm_page_remove_xbusy(vm_page_t);
>  int vm_page_rename(vm_page_t, vm_object_t, vm_pindex_t);
>  void vm_page_replace(vm_page_t mnew, vm_object_t object,
>  vm_pindex_t pindex, vm_page_t mold);
> -void vm_page_requeue(vm_page_t m);
>  int vm_page_sbusied(vm_page_t m);
>  vm_page_t vm_page_scan_contig(u_long npages, vm_page_t m_start,
>  vm_page_t m_end, u_long alignment, vm_paddr_t boundary, int options);
> @@ -659,7 +658,6 @@ int vm_page_sleep_if_busy(vm_page_t m, const char *msg
>  int vm_page_sleep_if_xbusy(vm_page_t m, const char *msg);
>  vm_offset_t vm_page_startup(vm_offset_t vaddr);
>  void vm_page_sunbusy(vm_page_t m);
> -void vm_page_swapqueue(vm_page_t m, uint8_t oldq, uint8_t newq);
>  bool vm_page_try_remove_all(vm_page_t m);
>  bool vm_page_try_remove_write(vm_page_t m);
>  int vm_page_trysbusy(vm_page_t m);
> @@ -833,31 +831,6 @@ vm_page_aflag_set(vm_page_t m, uint16_t bits)
> addr = (void *)>a;
> val = bits << VM_PAGE_AFLAG_SHIFT;
> atomic_set_32(addr, val);
> -}
> -
> -/*
> - * Atomically update the queue state of the page.  The operation
> fails if
> - * any of the queue flags in "fflags" are set or if the "queue" field
> of
> - * the page does not match the expected value; if the operation is
> - * successful, the flags in "nflags" are set and all other queue state
> - * flags are cleared.
> - */
> -static inline bool
> -vm_page_pqstate_cmpset(vm_page_t m, uint32_t oldq, uint32_t newq,
> -uint32_t fflags, uint32_t nflags)
> -{
> -   vm_page_astate_t new, old;
> -
> -   old = vm_page_astate_load(m);
> -   do {
> -   if ((old.flags & fflags) != 0 || old.queue != oldq)
> -   return (false);
> -   new = old;
> -   new.flags = (new.flags & ~PGA_QUEUE_OP_MASK) | nflags;
> -   new.queue = newq;
> -   } while (!vm_page_astate_fcmpset(m, , new));
> -
> -   return (true);
>  }
>
>  /*
> ___
> svn-src-h...@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: r356165 - head/share/man/man5

2019-12-28 Thread Kyle Evans
Author: kevans
Date: Sun Dec 29 02:12:18 2019
New Revision: 356165
URL: https://svnweb.freebsd.org/changeset/base/356165

Log:
  Regenerate src.conf(5) after r356164

Modified:
  head/share/man/man5/src.conf.5

Modified: head/share/man/man5/src.conf.5
==
--- head/share/man/man5/src.conf.5  Sun Dec 29 02:11:58 2019
(r356164)
+++ head/share/man/man5/src.conf.5  Sun Dec 29 02:12:18 2019
(r356165)
@@ -1,6 +1,6 @@
 .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman.
 .\" $FreeBSD$
-.Dd December 27, 2019
+.Dd December 28, 2019
 .Dt SRC.CONF 5
 .Os
 .Sh NAME
@@ -836,7 +836,7 @@ Set to build Hesiod support.
 .It Va WITHOUT_HTML
 Set to not build HTML docs.
 .It Va WITH_HTTPD
-Set to build and install httpd
+Set to build and install simple_httpd
 .It Va WITHOUT_HYPERV
 Set to not build or install HyperV utilities.
 .Pp
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r356164 - head/tools/build/options

2019-12-28 Thread Kyle Evans
Author: kevans
Date: Sun Dec 29 02:11:58 2019
New Revision: 356164
URL: https://svnweb.freebsd.org/changeset/base/356164

Log:
  Change reference in HTTPD descriptions to 'simple_httpd'
  
  This should help people examining src.conf(5) draw the connection between
  the HTTPD knobs and the particular implementation we're installing,
  simple_httpd.
  
  Reported by:  saken658 via GitHub

Modified:
  head/tools/build/options/WITHOUT_HTTPD
  head/tools/build/options/WITH_HTTPD

Modified: head/tools/build/options/WITHOUT_HTTPD
==
--- head/tools/build/options/WITHOUT_HTTPD  Sat Dec 28 23:40:32 2019
(r356163)
+++ head/tools/build/options/WITHOUT_HTTPD  Sun Dec 29 02:11:58 2019
(r356164)
@@ -1,2 +1,2 @@
 .\" $FreeBSD$
-Set to neither build nor install httpd
+Set to neither build nor install simple_httpd

Modified: head/tools/build/options/WITH_HTTPD
==
--- head/tools/build/options/WITH_HTTPD Sat Dec 28 23:40:32 2019
(r356163)
+++ head/tools/build/options/WITH_HTTPD Sun Dec 29 02:11:58 2019
(r356164)
@@ -1,2 +1,2 @@
 .\" $FreeBSD$
-Set to build and install httpd
+Set to build and install simple_httpd
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r356163 - in vendor/libarchive/dist: . .github/workflows build/ci/cirrus_ci build/ci/github_actions examples/minitar libarchive libarchive/test test_utils

2019-12-28 Thread Martin Matuska
Author: mm
Date: Sat Dec 28 23:40:32 2019
New Revision: 356163
URL: https://svnweb.freebsd.org/changeset/base/356163

Log:
  Update vendor/libarchive/dist to git 1dae5a549fe4ab99fd3a49a9edcf897a7b2b1844
  
  Relevant vendor changes:
Issue #351: Refactor and implement private state logic for write filters
PR #1252: RAR5 reader - verify window size for solid files (OSS-Fuzz 15482)
PR #1255: zip writer - don't append unused NUL for directories
PR #1260: Fix sparse file offset overflow on 32-bit systems
PR #1263: UNICODE filename support for reading lha/lzh format
Issue #1276: Bugfix and optimize archive_wstring_append_from_mbs()
PR #1288: Add the "xattrhdr" option to pax write options
PR #1295: 7z reader - fix reading archives with digests in PackInfo
PR #1296: RAR5 reader - verify window size for multivolume archives
PR #1297: ZIP reader - support LZMA_STREAM_END marker in 'lzma alone' files
Issue #1298: Fix a heap-buffer-overflow in archive_string_append_from_wcs()
OSS-Fuzz 19360, 19362: LHA reader - plug two memory leaks on error
Fix possible off-by-one when dealing with readlink(2)

Added:
  vendor/libarchive/dist/build/ci/github_actions/
  vendor/libarchive/dist/build/ci/github_actions/ci.cmd   (contents, props 
changed)
  vendor/libarchive/dist/build/ci/github_actions/macos.sh   (contents, props 
changed)
  vendor/libarchive/dist/libarchive/test/test_pax_xattr_header.c   (contents, 
props changed)
  vendor/libarchive/dist/libarchive/test/test_pax_xattr_header_all.tar.uu
  vendor/libarchive/dist/libarchive/test/test_pax_xattr_header_libarchive.tar.uu
  vendor/libarchive/dist/libarchive/test/test_pax_xattr_header_schily.tar.uu
  
vendor/libarchive/dist/libarchive/test/test_read_format_7zip_packinfo_digests.7z.uu
  
vendor/libarchive/dist/libarchive/test/test_read_format_7zip_packinfo_digests.c 
  (contents, props changed)
  vendor/libarchive/dist/libarchive/test/test_read_format_lha_filename_utf16.c  
 (contents, props changed)
  
vendor/libarchive/dist/libarchive/test/test_read_format_lha_filename_utf16.lzh.uu
  
vendor/libarchive/dist/libarchive/test/test_read_format_rar5_different_solid_window_size.rar.uu
  
vendor/libarchive/dist/libarchive/test/test_read_format_rar5_different_winsize_on_merge.rar.uu
Modified:
  vendor/libarchive/dist/.cirrus.yml
  vendor/libarchive/dist/.github/workflows/ci.yml
  vendor/libarchive/dist/Makefile.am
  vendor/libarchive/dist/build/ci/cirrus_ci/Dockerfile.fc30.distcheck
  vendor/libarchive/dist/configure.ac
  vendor/libarchive/dist/examples/minitar/minitar.c
  vendor/libarchive/dist/libarchive/archive_entry.h
  vendor/libarchive/dist/libarchive/archive_entry_acl.3
  vendor/libarchive/dist/libarchive/archive_hmac.c
  vendor/libarchive/dist/libarchive/archive_read_disk_entry_from_file.c
  vendor/libarchive/dist/libarchive/archive_read_disk_posix.c
  vendor/libarchive/dist/libarchive/archive_read_support_format_7zip.c
  vendor/libarchive/dist/libarchive/archive_read_support_format_lha.c
  vendor/libarchive/dist/libarchive/archive_read_support_format_rar5.c
  vendor/libarchive/dist/libarchive/archive_read_support_format_zip.c
  vendor/libarchive/dist/libarchive/archive_string.c
  vendor/libarchive/dist/libarchive/archive_write.c
  vendor/libarchive/dist/libarchive/archive_write_add_filter_b64encode.c
  vendor/libarchive/dist/libarchive/archive_write_add_filter_bzip2.c
  vendor/libarchive/dist/libarchive/archive_write_add_filter_compress.c
  vendor/libarchive/dist/libarchive/archive_write_add_filter_gzip.c
  vendor/libarchive/dist/libarchive/archive_write_add_filter_lz4.c
  vendor/libarchive/dist/libarchive/archive_write_add_filter_lzop.c
  vendor/libarchive/dist/libarchive/archive_write_add_filter_program.c
  vendor/libarchive/dist/libarchive/archive_write_add_filter_uuencode.c
  vendor/libarchive/dist/libarchive/archive_write_add_filter_xz.c
  vendor/libarchive/dist/libarchive/archive_write_add_filter_zstd.c
  vendor/libarchive/dist/libarchive/archive_write_disk_posix.c
  vendor/libarchive/dist/libarchive/archive_write_private.h
  vendor/libarchive/dist/libarchive/archive_write_set_format_pax.c
  vendor/libarchive/dist/libarchive/archive_write_set_format_zip.c
  vendor/libarchive/dist/libarchive/archive_write_set_options.3
  vendor/libarchive/dist/libarchive/test/CMakeLists.txt
  vendor/libarchive/dist/libarchive/test/test_open_failure.c
  vendor/libarchive/dist/libarchive/test/test_open_fd.c
  vendor/libarchive/dist/libarchive/test/test_read_disk_directory_traversals.c
  vendor/libarchive/dist/libarchive/test/test_read_format_rar5.c
  vendor/libarchive/dist/libarchive/test/test_sparse_basic.c
  vendor/libarchive/dist/test_utils/test_main.c

Modified: vendor/libarchive/dist/.cirrus.yml
==
--- vendor/libarchive/dist/.cirrus.yml  Sat Dec 28 23:21:53 2019
(r356162)
+++ vendor/libarchive/dist/.cirrus.yml  Sat Dec 28 23:40:32 2019

svn commit: r356162 - head/sys/geom/shsec

2019-12-28 Thread Alexander Motin
Author: mav
Date: Sat Dec 28 23:21:53 2019
New Revision: 356162
URL: https://svnweb.freebsd.org/changeset/base/356162

Log:
  Fix GEOM_SHSEC orphanization.
  
  Previous code closed and destroyed consumer even with I/O in progress.
  This patch postpones the destruction till the last close, identical to
  GEOM_STRIPE, since they seem to have common origin.
  
  MFC after:2 weeks
  Sponsored by: iXsystems, Inc.

Modified:
  head/sys/geom/shsec/g_shsec.c

Modified: head/sys/geom/shsec/g_shsec.c
==
--- head/sys/geom/shsec/g_shsec.c   Sat Dec 28 22:32:14 2019
(r356161)
+++ head/sys/geom/shsec/g_shsec.c   Sat Dec 28 23:21:53 2019
(r356162)
@@ -165,7 +165,7 @@ g_shsec_remove_disk(struct g_consumer *cp)
}
 
if (cp->acr > 0 || cp->acw > 0 || cp->ace > 0)
-   g_access(cp, -cp->acr, -cp->acw, -cp->ace);
+   return;
g_detach(cp);
g_destroy_consumer(cp);
 }
@@ -191,7 +191,7 @@ g_shsec_orphan(struct g_consumer *cp)
 static int
 g_shsec_access(struct g_provider *pp, int dr, int dw, int de)
 {
-   struct g_consumer *cp1, *cp2;
+   struct g_consumer *cp1, *cp2, *tmp;
struct g_shsec_softc *sc;
struct g_geom *gp;
int error;
@@ -222,21 +222,25 @@ g_shsec_access(struct g_provider *pp, int dr, int dw, 
de--;
 
error = ENXIO;
-   LIST_FOREACH(cp1, >consumer, consumer) {
+   LIST_FOREACH_SAFE(cp1, >consumer, consumer, tmp) {
error = g_access(cp1, dr, dw, de);
-   if (error == 0)
-   continue;
-   /*
-* If we fail here, backout all previous changes.
-*/
-   LIST_FOREACH(cp2, >consumer, consumer) {
-   if (cp1 == cp2)
-   return (error);
-   g_access(cp2, -dr, -dw, -de);
+   if (error != 0)
+   goto fail;
+   if (cp1->acr == 0 && cp1->acw == 0 && cp1->ace == 0 &&
+   cp1->flags & G_CF_ORPHAN) {
+   g_detach(cp1);
+   g_destroy_consumer(cp1);
}
-   /* NOTREACHED */
}
+   return (error);
 
+fail:
+   /* If we fail here, backout all previous changes. */
+   LIST_FOREACH(cp2, >consumer, consumer) {
+   if (cp1 == cp2)
+   break;
+   g_access(cp2, -dr, -dw, -de);
+   }
return (error);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r356142 - in head/sys: dev/ofw sys

2019-12-28 Thread Warner Losh
On Sat, Dec 28, 2019, 3:38 PM Rodney W. Grimes 
wrote:

> >
> > On Fri, 27 Dec 2019, Rodney W. Grimes wrote:
> >
> > > [ Charset UTF-8 unsupported, converting... ]
> > >>
> > >> On 2019-12-27 23:24, Rodney W. Grimes wrote:
> > >>> [ Charset UTF-8 unsupported, converting... ]
> >  On 2019-12-27 22:16, Rodney W. Grimes wrote:
> > >> Author: pfg
> > >> Date: Sat Dec 28 02:58:30 2019
> > >> New Revision: 356142
> > >> URL: https://svnweb.freebsd.org/changeset/base/356142
> > >>
> > >> Log:
> > >>   SPDX: update some tags with two licenses.
> > >>
> > >> Modified:
> > >>   head/sys/dev/ofw/openfirm.h
> > >>   head/sys/sys/sched.h
> > >>
> > >> Modified: head/sys/dev/ofw/openfirm.h
> > >>
> ==
> > >> --- head/sys/dev/ofw/openfirm.hSat Dec 28 02:11:41 2019
>   (r356141)
> > >> +++ head/sys/dev/ofw/openfirm.hSat Dec 28 02:58:30 2019
>   (r356142)
> > >> @@ -1,7 +1,7 @@
> > >>  /*$NetBSD: openfirm.h,v 1.1 1998/05/15 10:16:00 tsubai Exp
> $  */
> > >>
> > >>  /*-
> > >> - * SPDX-License-Identifier: BSD-4-Clause
> > >> + * SPDX-License-Identifier: (BSD-4-Clause AND
> BSD-2-Clause-FreeBSD)
> > >>   *
> > >>   * Copyright (C) 1995, 1996 Wolfgang Solfrank.
> > >>   * Copyright (C) 1995, 1996 TooLs GmbH.
> > >>
> > >> Modified: head/sys/sys/sched.h
> > >>
> ==
> > >> --- head/sys/sys/sched.h   Sat Dec 28 02:11:41 2019
> (r356141)
> > >> +++ head/sys/sys/sched.h   Sat Dec 28 02:58:30 2019
> (r356142)
> > >> @@ -1,5 +1,5 @@
> > >>  /*-
> > >> - * SPDX-License-Identifier: BSD-4-Clause
> > >> + * SPDX-License-Identifier: (BSD-4-Clause AND
> BSD-2-Clause-FreeBSD)
> > >>   *
> > >>   * Copyright (c) 1996, 1997
> > >>   *  HD Associates, Inc.  All rights reserved.
> > >>
> > > This situation should not of occured, and leads to an ambigous
> license state.
> >  It actually happens a lot (I mean two or more licenses in the same
> >  file): SPDX explicitly uses AND (not OR) for cases like this.
> > 
> > > What code is under license 2 clause and what under 4 clause?
> >  Anyone redistributing the file has to respect both licenses. If you
> are
> >  lucky enough to have access to version control you may be able to
> >  discern the author and the corresponding license, otherwise you are
> >  trapped with both.
> > >>> So the 2 clause add is null, so why have it there?
> > >>
> > >> So that eventually, when the project gets to a point where sufficient
> > >> part of the code is rewritten they can opt to change the license to
> the
> > >> simpler form. There are ways to relicense projects gradually, and its
> > >> nothing new, in fact it is very much in the BSD spirit to gradually
> > >> replace more restricted UNIX code.
> > >
> > > The only changing we have done to BSD licenses as in thost cases
> > > that the Regents requested/granted the right to change to lesser
> > > clauses.  Until you get HD & Associtates (in this one case) to
> > > grant that right your walking on a grey edge I would rather not
> > > walk on.
> > >
> > > The reference to BSD spirit and replacing more restricted UNIX (tm)
> > > code is way off base in this context.  This is not an AT & T
> > > license we are talking about here.  And again you can not just
> > > modify the existing 4 clause licensed file by slapping a 2 clause
> > > license into it, or the project would of done that everyplace
> > > ages ago.
> > >
> > > What is done here in this file is a mistake, and should be corrected.
> > > Can you point me to other files that actually have multiple BSD
> > > licenses in them?
> >
> > It seems to be the prevailing theory that headers are not even
> > really copyrightable.  This has even been tested in court a few times
> > (bsd, java).
>
> Yes, also true of scripts and Makefiles, which are generally
> considered under the recipts concept, yet we still have many
> which people are claiming copyright to.
>
> >
> > http://lkml.iu.edu/hypermail/linux/kernel/0301.1/0362.html
> >
> > The original definitions from this file were part of posix.1b and so
> it's
> > hard to argue they are anything but public.  Coincidentally I know Greg
> > and I'm sure he would not object to reducing the whole file to a two
> > clause license.
>
> Then lets make life very simple in this one case, and I agree with
> your intuition about Greg, shoot an email off to him and ask to
> drop his licence to 2 clause.
>
> > However, I'm not so certain as you are that it is not possible to have
> two
> > copyrights in the same file so long as they are compatible.  In many
> cases
> > we have multiple authors attributed to an individual file.  There are
> > cases where software is purposefully licensed under 

svn commit: r356161 - stable/11/sys/fs/nfs

2019-12-28 Thread Rick Macklem
Author: rmacklem
Date: Sat Dec 28 22:32:14 2019
New Revision: 356161
URL: https://svnweb.freebsd.org/changeset/base/356161

Log:
  MFC: r355194
  Fix two races while handling nfsuserd daemon start/stop.
  
  A crash was reported where the nr_client field was NULL during an upcall
  to the nfsuserd daemon. Since nr_client == NULL only occurs when the
  nfsuserd daemon is being shut down, it appeared to be caused by a race
  between doing an upcall and the daemon shutting down.
  By inspection two races were identified:
  1 - The nfsrv_nfsuserd variable is used to indicate whether or not the
  daemon is running. However it did not handle the intermediate phase
  where the daemon is starting or stopping.
  
  This was fixed by making nfsrv_nfsuserd tri-state and having the
  functions that are called during start/stop to obey the intermediate
  state.
  
  2 - nfsrv_nfsuserd was checked to see that the daemon was running at
  the beginning of an upcall, but nothing prevented the daemon from
  being shut down while an upcall was still in progress.
  This race probably caused the crash.
  
  The patch fixes this by adding a count of upcalls in progress and
  having the shut down function delay until this count goes to zero
  before getting rid of nr_client and related data used by an upcall.

Modified:
  stable/11/sys/fs/nfs/nfs.h
  stable/11/sys/fs/nfs/nfs_commonport.c
  stable/11/sys/fs/nfs/nfs_commonsubs.c
  stable/11/sys/fs/nfs/nfsport.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/fs/nfs/nfs.h
==
--- stable/11/sys/fs/nfs/nfs.h  Sat Dec 28 22:24:16 2019(r356160)
+++ stable/11/sys/fs/nfs/nfs.h  Sat Dec 28 22:32:14 2019(r356161)
@@ -751,6 +751,9 @@ struct nfsslot {
struct mbuf *nfssl_reply;
 };
 
+/* Enumerated type for nfsuserd state. */
+typedef enum { NOTRUNNING=0, STARTSTOP=1, RUNNING=2 } nfsuserd_state;
+
 #endif /* _KERNEL */
 
 #endif /* _NFS_NFS_H */

Modified: stable/11/sys/fs/nfs/nfs_commonport.c
==
--- stable/11/sys/fs/nfs/nfs_commonport.c   Sat Dec 28 22:24:16 2019
(r356160)
+++ stable/11/sys/fs/nfs/nfs_commonport.c   Sat Dec 28 22:32:14 2019
(r356161)
@@ -51,7 +51,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 extern int nfscl_ticks;
-extern int nfsrv_nfsuserd;
+extern nfsuserd_state nfsrv_nfsuserd;
 extern struct nfssockreq nfsrv_nfsuserdsock;
 extern void (*nfsd_call_recall)(struct vnode *, int, struct ucred *,
 struct thread *);
@@ -713,7 +713,7 @@ nfscommon_modevent(module_t mod, int type, void *data)
break;
 
case MOD_UNLOAD:
-   if (newnfs_numnfsd != 0 || nfsrv_nfsuserd != 0 ||
+   if (newnfs_numnfsd != 0 || nfsrv_nfsuserd != NOTRUNNING ||
nfs_numnfscbd != 0) {
error = EBUSY;
break;

Modified: stable/11/sys/fs/nfs/nfs_commonsubs.c
==
--- stable/11/sys/fs/nfs/nfs_commonsubs.c   Sat Dec 28 22:24:16 2019
(r356160)
+++ stable/11/sys/fs/nfs/nfs_commonsubs.c   Sat Dec 28 22:32:14 2019
(r356161)
@@ -62,7 +62,8 @@ struct timeval nfsboottime;   /* Copy boottime once, so 
 int nfscl_ticks;
 int nfsrv_useacl = 1;
 struct nfssockreq nfsrv_nfsuserdsock;
-int nfsrv_nfsuserd = 0;
+nfsuserd_state nfsrv_nfsuserd = NOTRUNNING;
+static int nfsrv_userdupcalls = 0;
 struct nfsreqhead nfsd_reqq;
 uid_t nfsrv_defaultuid = UID_NOBODY;
 gid_t nfsrv_defaultgid = GID_NOGROUP;
@@ -3105,18 +3106,22 @@ nfsrv_nfsuserdport(struct nfsuserd_args *nargs, NFSPRO
int error;
 
NFSLOCKNAMEID();
-   if (nfsrv_nfsuserd) {
+   if (nfsrv_nfsuserd != NOTRUNNING) {
NFSUNLOCKNAMEID();
error = EPERM;
goto out;
}
-   nfsrv_nfsuserd = 1;
-   NFSUNLOCKNAMEID();
+   nfsrv_nfsuserd = STARTSTOP;
/*
 * Set up the socket record and connect.
+* Set nr_client NULL before unlocking, just to ensure that no other
+* process/thread/core will use a bogus old value.  This could only
+* occur if the use of the nameid lock to protect nfsrv_nfsuserd is
+* broken.
 */
rp = _nfsuserdsock;
rp->nr_client = NULL;
+   NFSUNLOCKNAMEID();
rp->nr_sotype = SOCK_DGRAM;
rp->nr_soproto = IPPROTO_UDP;
rp->nr_lock = (NFSR_RESERVEDPORT | NFSR_LOCALHOST);
@@ -3152,9 +3157,15 @@ nfsrv_nfsuserdport(struct nfsuserd_args *nargs, NFSPRO
rp->nr_vers = RPCNFSUSERD_VERS;
if (error == 0)
error = newnfs_connect(NULL, rp, NFSPROCCRED(p), p, 0);
-   if (error) {
+   if (error == 0) {
+   NFSLOCKNAMEID();
+   nfsrv_nfsuserd = RUNNING;
+   

svn commit: r356160 - stable/12/sys/fs/nfs

2019-12-28 Thread Rick Macklem
Author: rmacklem
Date: Sat Dec 28 22:24:16 2019
New Revision: 356160
URL: https://svnweb.freebsd.org/changeset/base/356160

Log:
  MFC: r355194
  Fix two races while handling nfsuserd daemon start/stop.
  
  A crash was reported where the nr_client field was NULL during an upcall
  to the nfsuserd daemon. Since nr_client == NULL only occurs when the
  nfsuserd daemon is being shut down, it appeared to be caused by a race
  between doing an upcall and the daemon shutting down.
  By inspection two races were identified:
  1 - The nfsrv_nfsuserd variable is used to indicate whether or not the
  daemon is running. However it did not handle the intermediate phase
  where the daemon is starting or stopping.
  
  This was fixed by making nfsrv_nfsuserd tri-state and having the
  functions that are called during start/stop to obey the intermediate
  state.
  
  2 - nfsrv_nfsuserd was checked to see that the daemon was running at
  the beginning of an upcall, but nothing prevented the daemon from
  being shut down while an upcall was still in progress.
  This race probably caused the crash.
  
  The patch fixes this by adding a count of upcalls in progress and
  having the shut down function delay until this count goes to zero
  before getting rid of nr_client and related data used by an upcall.

Modified:
  stable/12/sys/fs/nfs/nfs.h
  stable/12/sys/fs/nfs/nfs_commonport.c
  stable/12/sys/fs/nfs/nfs_commonsubs.c
  stable/12/sys/fs/nfs/nfsport.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/fs/nfs/nfs.h
==
--- stable/12/sys/fs/nfs/nfs.h  Sat Dec 28 19:04:29 2019(r356159)
+++ stable/12/sys/fs/nfs/nfs.h  Sat Dec 28 22:24:16 2019(r356160)
@@ -797,6 +797,9 @@ struct nfsslot {
struct mbuf *nfssl_reply;
 };
 
+/* Enumerated type for nfsuserd state. */
+typedef enum { NOTRUNNING=0, STARTSTOP=1, RUNNING=2 } nfsuserd_state;
+
 #endif /* _KERNEL */
 
 #endif /* _NFS_NFS_H */

Modified: stable/12/sys/fs/nfs/nfs_commonport.c
==
--- stable/12/sys/fs/nfs/nfs_commonport.c   Sat Dec 28 19:04:29 2019
(r356159)
+++ stable/12/sys/fs/nfs/nfs_commonport.c   Sat Dec 28 22:24:16 2019
(r356160)
@@ -56,7 +56,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 extern int nfscl_ticks;
-extern int nfsrv_nfsuserd;
+extern nfsuserd_state nfsrv_nfsuserd;
 extern struct nfssockreq nfsrv_nfsuserdsock;
 extern void (*nfsd_call_recall)(struct vnode *, int, struct ucred *,
 struct thread *);
@@ -774,7 +774,7 @@ nfscommon_modevent(module_t mod, int type, void *data)
break;
 
case MOD_UNLOAD:
-   if (newnfs_numnfsd != 0 || nfsrv_nfsuserd != 0 ||
+   if (newnfs_numnfsd != 0 || nfsrv_nfsuserd != NOTRUNNING ||
nfs_numnfscbd != 0) {
error = EBUSY;
break;

Modified: stable/12/sys/fs/nfs/nfs_commonsubs.c
==
--- stable/12/sys/fs/nfs/nfs_commonsubs.c   Sat Dec 28 19:04:29 2019
(r356159)
+++ stable/12/sys/fs/nfs/nfs_commonsubs.c   Sat Dec 28 22:24:16 2019
(r356160)
@@ -64,7 +64,8 @@ struct timeval nfsboottime;   /* Copy boottime once, so 
 int nfscl_ticks;
 int nfsrv_useacl = 1;
 struct nfssockreq nfsrv_nfsuserdsock;
-int nfsrv_nfsuserd = 0;
+nfsuserd_state nfsrv_nfsuserd = NOTRUNNING;
+static int nfsrv_userdupcalls = 0;
 struct nfsreqhead nfsd_reqq;
 uid_t nfsrv_defaultuid = UID_NOBODY;
 gid_t nfsrv_defaultgid = GID_NOGROUP;
@@ -3524,18 +3525,22 @@ nfsrv_nfsuserdport(struct nfsuserd_args *nargs, NFSPRO
int error;
 
NFSLOCKNAMEID();
-   if (nfsrv_nfsuserd) {
+   if (nfsrv_nfsuserd != NOTRUNNING) {
NFSUNLOCKNAMEID();
error = EPERM;
goto out;
}
-   nfsrv_nfsuserd = 1;
-   NFSUNLOCKNAMEID();
+   nfsrv_nfsuserd = STARTSTOP;
/*
 * Set up the socket record and connect.
+* Set nr_client NULL before unlocking, just to ensure that no other
+* process/thread/core will use a bogus old value.  This could only
+* occur if the use of the nameid lock to protect nfsrv_nfsuserd is
+* broken.
 */
rp = _nfsuserdsock;
rp->nr_client = NULL;
+   NFSUNLOCKNAMEID();
rp->nr_sotype = SOCK_DGRAM;
rp->nr_soproto = IPPROTO_UDP;
rp->nr_lock = (NFSR_RESERVEDPORT | NFSR_LOCALHOST);
@@ -3571,9 +3576,15 @@ nfsrv_nfsuserdport(struct nfsuserd_args *nargs, NFSPRO
rp->nr_vers = RPCNFSUSERD_VERS;
if (error == 0)
error = newnfs_connect(NULL, rp, NFSPROCCRED(p), p, 0);
-   if (error) {
+   if (error == 0) {
+   NFSLOCKNAMEID();
+   nfsrv_nfsuserd = RUNNING;
+   

Re: svn commit: r356142 - in head/sys: dev/ofw sys

2019-12-28 Thread Rodney W. Grimes
> 
> On Fri, 27 Dec 2019, Rodney W. Grimes wrote:
> 
> > [ Charset UTF-8 unsupported, converting... ]
> >>
> >> On 2019-12-27 23:24, Rodney W. Grimes wrote:
> >>> [ Charset UTF-8 unsupported, converting... ]
>  On 2019-12-27 22:16, Rodney W. Grimes wrote:
> >> Author: pfg
> >> Date: Sat Dec 28 02:58:30 2019
> >> New Revision: 356142
> >> URL: https://svnweb.freebsd.org/changeset/base/356142
> >>
> >> Log:
> >>   SPDX: update some tags with two licenses.
> >>
> >> Modified:
> >>   head/sys/dev/ofw/openfirm.h
> >>   head/sys/sys/sched.h
> >>
> >> Modified: head/sys/dev/ofw/openfirm.h
> >> ==
> >> --- head/sys/dev/ofw/openfirm.hSat Dec 28 02:11:41 2019
> >> (r356141)
> >> +++ head/sys/dev/ofw/openfirm.hSat Dec 28 02:58:30 2019
> >> (r356142)
> >> @@ -1,7 +1,7 @@
> >>  /*$NetBSD: openfirm.h,v 1.1 1998/05/15 10:16:00 tsubai Exp $  
> >> */
> >>
> >>  /*-
> >> - * SPDX-License-Identifier: BSD-4-Clause
> >> + * SPDX-License-Identifier: (BSD-4-Clause AND BSD-2-Clause-FreeBSD)
> >>   *
> >>   * Copyright (C) 1995, 1996 Wolfgang Solfrank.
> >>   * Copyright (C) 1995, 1996 TooLs GmbH.
> >>
> >> Modified: head/sys/sys/sched.h
> >> ==
> >> --- head/sys/sys/sched.h   Sat Dec 28 02:11:41 2019
> >> (r356141)
> >> +++ head/sys/sys/sched.h   Sat Dec 28 02:58:30 2019
> >> (r356142)
> >> @@ -1,5 +1,5 @@
> >>  /*-
> >> - * SPDX-License-Identifier: BSD-4-Clause
> >> + * SPDX-License-Identifier: (BSD-4-Clause AND BSD-2-Clause-FreeBSD)
> >>   *
> >>   * Copyright (c) 1996, 1997
> >>   *  HD Associates, Inc.  All rights reserved.
> >>
> > This situation should not of occured, and leads to an ambigous license 
> > state.
>  It actually happens a lot (I mean two or more licenses in the same
>  file): SPDX explicitly uses AND (not OR) for cases like this.
> 
> > What code is under license 2 clause and what under 4 clause?
>  Anyone redistributing the file has to respect both licenses. If you are
>  lucky enough to have access to version control you may be able to
>  discern the author and the corresponding license, otherwise you are
>  trapped with both.
> >>> So the 2 clause add is null, so why have it there?
> >>
> >> So that eventually, when the project gets to a point where sufficient
> >> part of the code is rewritten they can opt to change the license to the
> >> simpler form. There are ways to relicense projects gradually, and its
> >> nothing new, in fact it is very much in the BSD spirit to gradually
> >> replace more restricted UNIX code.
> >
> > The only changing we have done to BSD licenses as in thost cases
> > that the Regents requested/granted the right to change to lesser
> > clauses.  Until you get HD & Associtates (in this one case) to
> > grant that right your walking on a grey edge I would rather not
> > walk on.
> >
> > The reference to BSD spirit and replacing more restricted UNIX (tm)
> > code is way off base in this context.  This is not an AT & T
> > license we are talking about here.  And again you can not just
> > modify the existing 4 clause licensed file by slapping a 2 clause
> > license into it, or the project would of done that everyplace
> > ages ago.
> >
> > What is done here in this file is a mistake, and should be corrected.
> > Can you point me to other files that actually have multiple BSD
> > licenses in them?
> 
> It seems to be the prevailing theory that headers are not even 
> really copyrightable.  This has even been tested in court a few times 
> (bsd, java).

Yes, also true of scripts and Makefiles, which are generally
considered under the recipts concept, yet we still have many
which people are claiming copyright to.

> 
> http://lkml.iu.edu/hypermail/linux/kernel/0301.1/0362.html
> 
> The original definitions from this file were part of posix.1b and so it's 
> hard to argue they are anything but public.  Coincidentally I know Greg 
> and I'm sure he would not object to reducing the whole file to a two 
> clause license.

Then lets make life very simple in this one case, and I agree with
your intuition about Greg, shoot an email off to him and ask to
drop his licence to 2 clause.

> However, I'm not so certain as you are that it is not possible to have two 
> copyrights in the same file so long as they are compatible.  In many cases 
> we have multiple authors attributed to an individual file.  There are 
> cases where software is purposefully licensed under multiple licenses.

Ok, first off understand that Copyrights and Licenses are 2 very different
things.  You can have N Copyrights in a file, having 2 or more licenses
in a file without stating when which 

Re: svn commit: r356142 - in head/sys: dev/ofw sys

2019-12-28 Thread Jeff Roberson



On Fri, 27 Dec 2019, Rodney W. Grimes wrote:


[ Charset UTF-8 unsupported, converting... ]


On 2019-12-27 23:24, Rodney W. Grimes wrote:

[ Charset UTF-8 unsupported, converting... ]

On 2019-12-27 22:16, Rodney W. Grimes wrote:

Author: pfg
Date: Sat Dec 28 02:58:30 2019
New Revision: 356142
URL: https://svnweb.freebsd.org/changeset/base/356142

Log:
  SPDX: update some tags with two licenses.

Modified:
  head/sys/dev/ofw/openfirm.h
  head/sys/sys/sched.h

Modified: head/sys/dev/ofw/openfirm.h
==
--- head/sys/dev/ofw/openfirm.h Sat Dec 28 02:11:41 2019(r356141)
+++ head/sys/dev/ofw/openfirm.h Sat Dec 28 02:58:30 2019(r356142)
@@ -1,7 +1,7 @@
 /* $NetBSD: openfirm.h,v 1.1 1998/05/15 10:16:00 tsubai Exp $  */

 /*-
- * SPDX-License-Identifier: BSD-4-Clause
+ * SPDX-License-Identifier: (BSD-4-Clause AND BSD-2-Clause-FreeBSD)
  *
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
  * Copyright (C) 1995, 1996 TooLs GmbH.

Modified: head/sys/sys/sched.h
==
--- head/sys/sys/sched.hSat Dec 28 02:11:41 2019(r356141)
+++ head/sys/sys/sched.hSat Dec 28 02:58:30 2019(r356142)
@@ -1,5 +1,5 @@
 /*-
- * SPDX-License-Identifier: BSD-4-Clause
+ * SPDX-License-Identifier: (BSD-4-Clause AND BSD-2-Clause-FreeBSD)
  *
  * Copyright (c) 1996, 1997
  *  HD Associates, Inc.  All rights reserved.


This situation should not of occured, and leads to an ambigous license state.

It actually happens a lot (I mean two or more licenses in the same
file): SPDX explicitly uses AND (not OR) for cases like this.


What code is under license 2 clause and what under 4 clause?

Anyone redistributing the file has to respect both licenses. If you are
lucky enough to have access to version control you may be able to
discern the author and the corresponding license, otherwise you are
trapped with both.

So the 2 clause add is null, so why have it there?


So that eventually, when the project gets to a point where sufficient
part of the code is rewritten they can opt to change the license to the
simpler form. There are ways to relicense projects gradually, and its
nothing new, in fact it is very much in the BSD spirit to gradually
replace more restricted UNIX code.


The only changing we have done to BSD licenses as in thost cases
that the Regents requested/granted the right to change to lesser
clauses.  Until you get HD & Associtates (in this one case) to
grant that right your walking on a grey edge I would rather not
walk on.

The reference to BSD spirit and replacing more restricted UNIX (tm)
code is way off base in this context.  This is not an AT & T
license we are talking about here.  And again you can not just
modify the existing 4 clause licensed file by slapping a 2 clause
license into it, or the project would of done that everyplace
ages ago.

What is done here in this file is a mistake, and should be corrected.
Can you point me to other files that actually have multiple BSD
licenses in them?


It seems to be the prevailing theory that headers are not even 
really copyrightable.  This has even been tested in court a few times 
(bsd, java).


http://lkml.iu.edu/hypermail/linux/kernel/0301.1/0362.html

The original definitions from this file were part of posix.1b and so it's 
hard to argue they are anything but public.  Coincidentally I know Greg 
and I'm sure he would not object to reducing the whole file to a two 
clause license.


However, I'm not so certain as you are that it is not possible to have two 
copyrights in the same file so long as they are compatible.  In many cases 
we have multiple authors attributed to an individual file.  There are 
cases where software is purposefully licensed under multiple licenses.


https://en.wikipedia.org/wiki/Multi-licensing

This is not an identical situation but it is a common one.  I called my 
brother who is an IP lawyer and spoke with him about it today.  He 
believes this is sufficiently nuanced that we would need a proper legal 
opinion to determine that.


I wrote the original file 17 years ago and placed a two clause copyright 
in it.  trhodes combined sys/posix4/sched.h with sys/sched.h 13 years ago 
in the following commit: 
https://svnweb.freebsd.org/base/head/sys/sys/sched.h?revision=164185=markup


So the original license was in fact two clause.

If a mistake was made, it was made 13 years ago and it is almost 
guaranteed to be legally harmless.  It has nothing to do with what Pedro 
committed today.  I don't trust the armchair lawyering of software 
engineers and so to resolve this we would need to ask the foundation to 
pay their lawyers to pursue it.


In my opinion, this has already wasted everyone's time with an irrelevant 
nit-picking argument.  The onus is not on Pedro to chase this down just so 
he can add SPDX tags.  If this is important to you then you are 

Re: svn commit: r356159 - head/sys/vm

2019-12-28 Thread Jeff Roberson

Fantastic!

On Sat, 28 Dec 2019, Mark Johnston wrote:


Author: markj
Date: Sat Dec 28 19:04:29 2019
New Revision: 356159
URL: https://svnweb.freebsd.org/changeset/base/356159

Log:
 Remove some unused functions.

 The previous series of patches orphaned some vm_page functions, so
 remove them.

 Reviewed by:   dougm, kib
 Sponsored by:  Netflix, Intel
 Differential Revision: https://reviews.freebsd.org/D22886

Modified:
 head/sys/vm/vm_page.c
 head/sys/vm/vm_page.h

Modified: head/sys/vm/vm_page.c
==
--- head/sys/vm/vm_page.c   Sat Dec 28 19:04:15 2019(r356158)
+++ head/sys/vm/vm_page.c   Sat Dec 28 19:04:29 2019(r356159)
@@ -3662,52 +3662,6 @@ vm_page_enqueue(vm_page_t m, uint8_t queue)
}

/*
- * vm_page_requeue:[ internal use only ]
- *
- * Schedule a requeue of the given page.
- *
- * The page must be locked.
- */
-void
-vm_page_requeue(vm_page_t m)
-{
-
-   vm_page_assert_locked(m);
-   KASSERT(vm_page_queue(m) != PQ_NONE,
-   ("%s: page %p is not logically enqueued", __func__, m));
-   KASSERT(m->ref_count > 0,
-   ("%s: page %p does not carry any references", __func__, m));
-
-   if ((m->a.flags & PGA_REQUEUE) == 0)
-   vm_page_aflag_set(m, PGA_REQUEUE);
-   vm_page_pqbatch_submit(m, atomic_load_8(>a.queue));
-}
-
-/*
- * vm_page_swapqueue:  [ internal use only ]
- *
- * Move the page from one queue to another, or to the tail of its
- * current queue, in the face of a possible concurrent free of the
- * page.
- */
-void
-vm_page_swapqueue(vm_page_t m, uint8_t oldq, uint8_t newq)
-{
-   vm_page_astate_t new, old;
-
-   old = vm_page_astate_load(m);
-   do {
-   if (old.queue != oldq || (old.flags & PGA_DEQUEUE) != 0)
-   return;
-   new = old;
-   new.flags |= PGA_REQUEUE;
-   new.queue = newq;
-   } while (!vm_page_pqstate_commit_dequeue(m, , new));
-
-   vm_page_pqbatch_submit(m, newq);
-}
-
-/*
 *  vm_page_free_prep:
 *
 *  Prepares the given page to be put on the free list,

Modified: head/sys/vm/vm_page.h
==
--- head/sys/vm/vm_page.h   Sat Dec 28 19:04:15 2019(r356158)
+++ head/sys/vm/vm_page.h   Sat Dec 28 19:04:29 2019(r356159)
@@ -649,7 +649,6 @@ bool vm_page_remove_xbusy(vm_page_t);
int vm_page_rename(vm_page_t, vm_object_t, vm_pindex_t);
void vm_page_replace(vm_page_t mnew, vm_object_t object,
vm_pindex_t pindex, vm_page_t mold);
-void vm_page_requeue(vm_page_t m);
int vm_page_sbusied(vm_page_t m);
vm_page_t vm_page_scan_contig(u_long npages, vm_page_t m_start,
vm_page_t m_end, u_long alignment, vm_paddr_t boundary, int options);
@@ -659,7 +658,6 @@ int vm_page_sleep_if_busy(vm_page_t m, const char *msg
int vm_page_sleep_if_xbusy(vm_page_t m, const char *msg);
vm_offset_t vm_page_startup(vm_offset_t vaddr);
void vm_page_sunbusy(vm_page_t m);
-void vm_page_swapqueue(vm_page_t m, uint8_t oldq, uint8_t newq);
bool vm_page_try_remove_all(vm_page_t m);
bool vm_page_try_remove_write(vm_page_t m);
int vm_page_trysbusy(vm_page_t m);
@@ -833,31 +831,6 @@ vm_page_aflag_set(vm_page_t m, uint16_t bits)
addr = (void *)>a;
val = bits << VM_PAGE_AFLAG_SHIFT;
atomic_set_32(addr, val);
-}
-
-/*
- * Atomically update the queue state of the page.  The operation fails if
- * any of the queue flags in "fflags" are set or if the "queue" field of
- * the page does not match the expected value; if the operation is
- * successful, the flags in "nflags" are set and all other queue state
- * flags are cleared.
- */
-static inline bool
-vm_page_pqstate_cmpset(vm_page_t m, uint32_t oldq, uint32_t newq,
-uint32_t fflags, uint32_t nflags)
-{
-   vm_page_astate_t new, old;
-
-   old = vm_page_astate_load(m);
-   do {
-   if ((old.flags & fflags) != 0 || old.queue != oldq)
-   return (false);
-   new = old;
-   new.flags = (new.flags & ~PGA_QUEUE_OP_MASK) | nflags;
-   new.queue = newq;
-   } while (!vm_page_astate_fcmpset(m, , new));
-
-   return (true);
}

/*


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


svn commit: r356157 - in head/sys: cddl/contrib/opensolaris/uts/common/fs/zfs dev/md fs/tmpfs kern vm

2019-12-28 Thread Mark Johnston
Author: markj
Date: Sat Dec 28 19:04:00 2019
New Revision: 356157
URL: https://svnweb.freebsd.org/changeset/base/356157

Log:
  Remove page locking for queue operations.
  
  With the previous reviews, the page lock is no longer required in order
  to perform queue operations on a page.  It is also no longer needed in
  the page queue scans.  This change effectively eliminates remaining uses
  of the page lock and also the false sharing caused by multiple pages
  sharing a page lock.
  
  Reviewed by:  jeff
  Tested by:pho
  Sponsored by: Netflix, Intel
  Differential Revision:https://reviews.freebsd.org/D22885

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
  head/sys/dev/md/md.c
  head/sys/fs/tmpfs/tmpfs_subr.c
  head/sys/kern/uipc_shm.c
  head/sys/vm/swap_pager.c
  head/sys/vm/vm_fault.c
  head/sys/vm/vm_object.c
  head/sys/vm/vm_page.c
  head/sys/vm/vm_page.h
  head/sys/vm/vm_pageout.c
  head/sys/vm/vm_swapout.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c   Sat Dec 28 
19:03:46 2019(r356156)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c   Sat Dec 28 
19:04:00 2019(r356157)
@@ -1761,12 +1761,10 @@ dmu_read_pages(objset_t *os, uint64_t object, vm_page_
bcopy((char *)db->db_data + bufoff, va, PAGESIZE);
zfs_unmap_page(sf);
vm_page_valid(m);
-   vm_page_lock(m);
if ((m->busy_lock & VPB_BIT_WAITERS) != 0)
vm_page_activate(m);
else
vm_page_deactivate(m);
-   vm_page_unlock(m);
vm_page_sunbusy(m);
}
*rbehind = i;
@@ -1884,12 +1882,10 @@ dmu_read_pages(objset_t *os, uint64_t object, vm_page_
}
zfs_unmap_page(sf);
vm_page_valid(m);
-   vm_page_lock(m);
if ((m->busy_lock & VPB_BIT_WAITERS) != 0)
vm_page_activate(m);
else
vm_page_deactivate(m);
-   vm_page_unlock(m);
vm_page_sunbusy(m);
}
*rahead = i;

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sat Dec 
28 19:03:46 2019(r356156)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sat Dec 
28 19:04:00 2019(r356157)
@@ -545,9 +545,7 @@ mappedread_sf(vnode_t *vp, int nbytes, uio_t *uio)
zfs_vmobject_wlock(obj);
if (error == 0) {
vm_page_valid(pp);
-   vm_page_lock(pp);
vm_page_activate(pp);
-   vm_page_unlock(pp);
}
vm_page_sunbusy(pp);
if (error != 0 && !vm_page_wired(pp) &&

Modified: head/sys/dev/md/md.c
==
--- head/sys/dev/md/md.cSat Dec 28 19:03:46 2019(r356156)
+++ head/sys/dev/md/md.cSat Dec 28 19:04:00 2019(r356157)
@@ -1145,12 +1145,7 @@ mdstart_swap(struct md_s *sc, struct bio *bp)
}
if (m != NULL) {
vm_page_xunbusy(m);
-   vm_page_lock(m);
-   if (vm_page_active(m))
-   vm_page_reference(m);
-   else
-   vm_page_activate(m);
-   vm_page_unlock(m);
+   vm_page_reference(m);
}
 
/* Actions on further pages start at offset 0 */

Modified: head/sys/fs/tmpfs/tmpfs_subr.c
==
--- head/sys/fs/tmpfs/tmpfs_subr.c  Sat Dec 28 19:03:46 2019
(r356156)
+++ head/sys/fs/tmpfs/tmpfs_subr.c  Sat Dec 28 19:04:00 2019
(r356157)
@@ -1490,9 +1490,7 @@ retry:
 * current operation is not regarded
 * as an access.
 */
-   vm_page_lock(m);
vm_page_launder(m);
-   vm_page_unlock(m);
} else {
vm_page_free(m);
if (ignerr)

Modified: head/sys/kern/uipc_shm.c

svn commit: r356156 - head/sys/vm

2019-12-28 Thread Mark Johnston
Author: markj
Date: Sat Dec 28 19:03:46 2019
New Revision: 356156
URL: https://svnweb.freebsd.org/changeset/base/356156

Log:
  Generalize lazy dequeue logic for wired pages.
  
  Some recent work aims to remove the use of the page lock for
  synchronizing updates to page queue state.  This change adds a mechanism
  to preserve the existing behaviour of lazily dequeuing wired pages,
  which was previously synchronized using the page lock.
  
  Handle this by setting PGA_DEQUEUE when a managed page's wire count
  transitions from 0 to 1.  When the page daemon encounters a page with a
  flag in PGA_QUEUE_OP_MASK set, it creates a batch queue entry for that
  page, but in so doing it does not modify the page itself and thus racing
  with a concurrent free of the page is harmless.  The flag is advisory;
  the page daemon still checks for wirings after acquiring the object and
  page xbusy locks.
  
  vm_page_unwire_managed() now clears PGA_DEQUEUE on a 1->0 transition.
  It must do this before dropping the reference to avoid a use-after-free
  but also handles races with concurrent wirings to ensure that
  PGA_DEQUEUE is not left unset on a wired page.
  
  Reviewed by:  jeff
  Tested by:pho
  Sponsored by: Netflix, Intel
  Differential Revision:https://reviews.freebsd.org/D22882

Modified:
  head/sys/vm/vm_page.c
  head/sys/vm/vm_pageout.c

Modified: head/sys/vm/vm_page.c
==
--- head/sys/vm/vm_page.c   Sat Dec 28 19:03:32 2019(r356155)
+++ head/sys/vm/vm_page.c   Sat Dec 28 19:03:46 2019(r356156)
@@ -3530,8 +3530,6 @@ vm_page_pqbatch_submit(vm_page_t m, uint8_t queue)
 
KASSERT((m->oflags & VPO_UNMANAGED) == 0,
("page %p is unmanaged", m));
-   KASSERT(mtx_owned(vm_page_lockptr(m)) || m->object == NULL,
-   ("missing synchronization for page %p", m));
KASSERT(queue < PQ_COUNT, ("invalid queue %d", queue));
 
domain = vm_phys_domain(m);
@@ -3904,8 +3902,11 @@ vm_page_wire(vm_page_t m)
old = atomic_fetchadd_int(>ref_count, 1);
KASSERT(VPRC_WIRE_COUNT(old) != VPRC_WIRE_COUNT_MAX,
("vm_page_wire: counter overflow for page %p", m));
-   if (VPRC_WIRE_COUNT(old) == 0)
+   if (VPRC_WIRE_COUNT(old) == 0) {
+   if ((m->oflags & VPO_UNMANAGED) == 0)
+   vm_page_aflag_set(m, PGA_DEQUEUE);
vm_wire_add(1);
+   }
 }
 
 /*
@@ -3928,8 +3929,11 @@ vm_page_wire_mapped(vm_page_t m)
return (false);
} while (!atomic_fcmpset_int(>ref_count, , old + 1));
 
-   if (VPRC_WIRE_COUNT(old) == 0)
+   if (VPRC_WIRE_COUNT(old) == 0) {
+   if ((m->oflags & VPO_UNMANAGED) == 0)
+   vm_page_aflag_set(m, PGA_DEQUEUE);
vm_wire_add(1);
+   }
return (true);
 }
 
@@ -3942,37 +3946,43 @@ static void
 vm_page_unwire_managed(vm_page_t m, uint8_t nqueue, bool noreuse)
 {
u_int old;
-   bool locked;
 
KASSERT((m->oflags & VPO_UNMANAGED) == 0,
("%s: page %p is unmanaged", __func__, m));
 
/*
 * Update LRU state before releasing the wiring reference.
-* We only need to do this once since we hold the page lock.
 * Use a release store when updating the reference count to
 * synchronize with vm_page_free_prep().
 */
old = m->ref_count;
-   locked = false;
do {
KASSERT(VPRC_WIRE_COUNT(old) > 0,
("vm_page_unwire: wire count underflow for page %p", m));
-   if (!locked && VPRC_WIRE_COUNT(old) == 1) {
-   vm_page_lock(m);
-   locked = true;
+
+   if (old > VPRC_OBJREF + 1) {
+   /*
+* The page has at least one other wiring reference.  An
+* earlier iteration of this loop may have called
+* vm_page_release_toq() and cleared PGA_DEQUEUE, so
+* re-set it if necessary.
+*/
+   if ((vm_page_astate_load(m).flags & PGA_DEQUEUE) == 0)
+   vm_page_aflag_set(m, PGA_DEQUEUE);
+   } else if (old == VPRC_OBJREF + 1) {
+   /*
+* This is the last wiring.  Clear PGA_DEQUEUE and
+* update the page's queue state to reflect the
+* reference.  If the page does not belong to an object
+* (i.e., the VPRC_OBJREF bit is clear), we only need to
+* clear leftover queue state.
+*/
vm_page_release_toq(m, nqueue, false);
+   } else if (old == 1) {
+   vm_page_aflag_clear(m, PGA_DEQUEUE);
}
} while 

svn commit: r356158 - head/sys/vm

2019-12-28 Thread Mark Johnston
Author: markj
Date: Sat Dec 28 19:04:15 2019
New Revision: 356158
URL: https://svnweb.freebsd.org/changeset/base/356158

Log:
  Update the vm_page.h block comment to reflect recent changes.
  
  Explain the new locking rules for per-page queue state updates.
  
  Reviewed by:  jeff, kib
  Sponsored by: Netflix, Intel
  Differential Revision:https://reviews.freebsd.org/D22884

Modified:
  head/sys/vm/vm_page.h

Modified: head/sys/vm/vm_page.h
==
--- head/sys/vm/vm_page.h   Sat Dec 28 19:04:00 2019(r356157)
+++ head/sys/vm/vm_page.h   Sat Dec 28 19:04:15 2019(r356158)
@@ -171,34 +171,32 @@
  * The page daemon must therefore handle the possibility of a concurrent
  * free of the page.
  *
- * The queue field is the index of the page queue containing the page,
- * or PQ_NONE if the page is not enqueued.  The queue lock of a page is
- * the page queue lock corresponding to the page queue index, or the
- * page lock (P) for the page if it is not enqueued.  To modify the
- * queue field, the queue lock for the old value of the field must be
- * held.  There is one exception to this rule: the page daemon may
- * transition the queue field from PQ_INACTIVE to PQ_NONE immediately
- * prior to freeing a page during an inactive queue scan.  At that
- * point the page has already been physically dequeued and no other
- * references to that vm_page structure exist.
+ * The queue state of a page consists of the queue and act_count fields of
+ * its atomically updated state, and the subset of atomic flags specified
+ * by PGA_QUEUE_STATE_MASK.  The queue field contains the page's page queue
+ * index, or PQ_NONE if it does not belong to a page queue.  To modify the
+ * queue field, the page queue lock corresponding to the old value must be
+ * held, unless that value is PQ_NONE, in which case the queue index must
+ * be updated using an atomic RMW operation.  There is one exception to
+ * this rule: the page daemon may transition the queue field from
+ * PQ_INACTIVE to PQ_NONE immediately prior to freeing the page during an
+ * inactive queue scan.  At that point the page is already dequeued and no
+ * other references to that vm_page structure can exist.  The PGA_ENQUEUED
+ * flag, when set, indicates that the page structure is physically inserted
+ * into the queue corresponding to the page's queue index, and may only be
+ * set or cleared with the corresponding page queue lock held.
  *
- * To avoid contention on page queue locks, page queue operations
- * (enqueue, dequeue, requeue) are batched using per-CPU queues.  A
- * deferred operation is requested by inserting an entry into a batch
- * queue; the entry is simply a pointer to the page, and the request
- * type is encoded in the page's aflags field using the values in
- * PGA_QUEUE_STATE_MASK.  The type-stability of struct vm_pages is
- * crucial to this scheme since the processing of entries in a given
- * batch queue may be deferred indefinitely.  In particular, a page may
- * be freed before its pending batch queue entries have been processed.
- * The page lock (P) must be held to schedule a batched queue
- * operation, and the page queue lock must be held in order to process
- * batch queue entries for the page queue.  There is one exception to
- * this rule: the thread freeing a page may schedule a dequeue without
- * holding the page lock.  In this scenario the only other thread which
- * may hold a reference to the page is the page daemon, which is
- * careful to avoid modifying the page's queue state once the dequeue
- * has been requested by setting PGA_DEQUEUE.
+ * To avoid contention on page queue locks, page queue operations (enqueue,
+ * dequeue, requeue) are batched using fixed-size per-CPU queues.  A
+ * deferred operation is requested by setting one of the flags in
+ * PGA_QUEUE_OP_MASK and inserting an entry into a batch queue.  When a
+ * queue is full, an attempt to insert a new entry will lock the page
+ * queues and trigger processing of the pending entries.  The
+ * type-stability of vm_page structures is crucial to this scheme since the
+ * processing of entries in a given batch queue may be deferred
+ * indefinitely.  In particular, a page may be freed with pending batch
+ * queue entries.  The page queue operation flags must be set using atomic
+ * RWM operations.
  */
 
 #if PAGE_SIZE == 4096
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r356159 - head/sys/vm

2019-12-28 Thread Mark Johnston
Author: markj
Date: Sat Dec 28 19:04:29 2019
New Revision: 356159
URL: https://svnweb.freebsd.org/changeset/base/356159

Log:
  Remove some unused functions.
  
  The previous series of patches orphaned some vm_page functions, so
  remove them.
  
  Reviewed by:  dougm, kib
  Sponsored by: Netflix, Intel
  Differential Revision:https://reviews.freebsd.org/D22886

Modified:
  head/sys/vm/vm_page.c
  head/sys/vm/vm_page.h

Modified: head/sys/vm/vm_page.c
==
--- head/sys/vm/vm_page.c   Sat Dec 28 19:04:15 2019(r356158)
+++ head/sys/vm/vm_page.c   Sat Dec 28 19:04:29 2019(r356159)
@@ -3662,52 +3662,6 @@ vm_page_enqueue(vm_page_t m, uint8_t queue)
 }
 
 /*
- * vm_page_requeue:[ internal use only ]
- *
- * Schedule a requeue of the given page.
- *
- * The page must be locked.
- */
-void
-vm_page_requeue(vm_page_t m)
-{
-
-   vm_page_assert_locked(m);
-   KASSERT(vm_page_queue(m) != PQ_NONE,
-   ("%s: page %p is not logically enqueued", __func__, m));
-   KASSERT(m->ref_count > 0,
-   ("%s: page %p does not carry any references", __func__, m));
-
-   if ((m->a.flags & PGA_REQUEUE) == 0)
-   vm_page_aflag_set(m, PGA_REQUEUE);
-   vm_page_pqbatch_submit(m, atomic_load_8(>a.queue));
-}
-
-/*
- * vm_page_swapqueue:  [ internal use only ]
- *
- * Move the page from one queue to another, or to the tail of its
- * current queue, in the face of a possible concurrent free of the
- * page.
- */
-void
-vm_page_swapqueue(vm_page_t m, uint8_t oldq, uint8_t newq)
-{
-   vm_page_astate_t new, old;
-
-   old = vm_page_astate_load(m);
-   do {
-   if (old.queue != oldq || (old.flags & PGA_DEQUEUE) != 0)
-   return;
-   new = old;
-   new.flags |= PGA_REQUEUE;
-   new.queue = newq;
-   } while (!vm_page_pqstate_commit_dequeue(m, , new));
-
-   vm_page_pqbatch_submit(m, newq);
-}
-
-/*
  * vm_page_free_prep:
  *
  * Prepares the given page to be put on the free list,

Modified: head/sys/vm/vm_page.h
==
--- head/sys/vm/vm_page.h   Sat Dec 28 19:04:15 2019(r356158)
+++ head/sys/vm/vm_page.h   Sat Dec 28 19:04:29 2019(r356159)
@@ -649,7 +649,6 @@ bool vm_page_remove_xbusy(vm_page_t);
 int vm_page_rename(vm_page_t, vm_object_t, vm_pindex_t);
 void vm_page_replace(vm_page_t mnew, vm_object_t object,
 vm_pindex_t pindex, vm_page_t mold);
-void vm_page_requeue(vm_page_t m);
 int vm_page_sbusied(vm_page_t m);
 vm_page_t vm_page_scan_contig(u_long npages, vm_page_t m_start,
 vm_page_t m_end, u_long alignment, vm_paddr_t boundary, int options);
@@ -659,7 +658,6 @@ int vm_page_sleep_if_busy(vm_page_t m, const char *msg
 int vm_page_sleep_if_xbusy(vm_page_t m, const char *msg);
 vm_offset_t vm_page_startup(vm_offset_t vaddr);
 void vm_page_sunbusy(vm_page_t m);
-void vm_page_swapqueue(vm_page_t m, uint8_t oldq, uint8_t newq);
 bool vm_page_try_remove_all(vm_page_t m);
 bool vm_page_try_remove_write(vm_page_t m);
 int vm_page_trysbusy(vm_page_t m);
@@ -833,31 +831,6 @@ vm_page_aflag_set(vm_page_t m, uint16_t bits)
addr = (void *)>a;
val = bits << VM_PAGE_AFLAG_SHIFT;
atomic_set_32(addr, val);
-}
-
-/*
- * Atomically update the queue state of the page.  The operation fails if
- * any of the queue flags in "fflags" are set or if the "queue" field of
- * the page does not match the expected value; if the operation is
- * successful, the flags in "nflags" are set and all other queue state
- * flags are cleared.
- */
-static inline bool
-vm_page_pqstate_cmpset(vm_page_t m, uint32_t oldq, uint32_t newq,
-uint32_t fflags, uint32_t nflags)
-{
-   vm_page_astate_t new, old;
-
-   old = vm_page_astate_load(m);
-   do {
-   if ((old.flags & fflags) != 0 || old.queue != oldq)
-   return (false);
-   new = old;
-   new.flags = (new.flags & ~PGA_QUEUE_OP_MASK) | nflags;
-   new.queue = newq;
-   } while (!vm_page_astate_fcmpset(m, , new));
-
-   return (true);
 }
 
 /*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r356155 - head/sys/vm

2019-12-28 Thread Mark Johnston
Author: markj
Date: Sat Dec 28 19:03:32 2019
New Revision: 356155
URL: https://svnweb.freebsd.org/changeset/base/356155

Log:
  Start implementing queue state updates using fcmpset loops.
  
  This is in preparation for eliminating the use of the vm_page lock for
  protecting queue state operations.
  
  Introduce the vm_page_pqstate_commit_*() functions.  These functions act
  as helpers around vm_page_astate_fcmpset() and are specialized for
  specific types of operations.  vm_page_pqstate_commit() wraps these
  functions.
  
  Convert a number of routines to use these new helpers.  Use
  vm_page_release_toq() in vm_page_unwire() and vm_page_release() to
  atomically release a wiring reference and release the page into a queue.
  This has the side effect that vm_page_unwire() will leave the page in
  the active queue if it is already present there.
  
  Convert the page queue scans to use the new helpers.  Simplify
  vm_pageout_reinsert_inactive(), which requeues pages that were found to
  be busy during an inactive queue scan, to avoid duplicating the work of
  vm_pqbatch_process_page().  In particular, if PGA_REQUEUE or
  PGA_REQUEUE_HEAD is set, let that be handled during batch processing.
  
  Reviewed by:  jeff
  Tested by:pho
  Sponsored by: Netflix, Intel
  Differential Revision:https://reviews.freebsd.org/D22770
  Differential Revision:https://reviews.freebsd.org/D22771
  Differential Revision:https://reviews.freebsd.org/D22772
  Differential Revision:https://reviews.freebsd.org/D22773
  Differential Revision:https://reviews.freebsd.org/D22776

Modified:
  head/sys/vm/vm_page.c
  head/sys/vm/vm_page.h
  head/sys/vm/vm_pageout.c

Modified: head/sys/vm/vm_page.c
==
--- head/sys/vm/vm_page.c   Sat Dec 28 19:03:17 2019(r356154)
+++ head/sys/vm/vm_page.c   Sat Dec 28 19:03:32 2019(r356155)
@@ -134,6 +134,11 @@ static int vm_pageproc_waiters;
 static SYSCTL_NODE(_vm_stats, OID_AUTO, page, CTLFLAG_RD, 0,
 "VM page statistics");
 
+static counter_u64_t pqstate_commit_retries = EARLY_COUNTER;
+SYSCTL_COUNTER_U64(_vm_stats_page, OID_AUTO, pqstate_commit_retries,
+CTLFLAG_RD, _commit_retries,
+"Number of failed per-page atomic queue state updates");
+
 static counter_u64_t queue_ops = EARLY_COUNTER;
 SYSCTL_COUNTER_U64(_vm_stats_page, OID_AUTO, queue_ops,
 CTLFLAG_RD, _ops,
@@ -148,6 +153,7 @@ static void
 counter_startup(void)
 {
 
+   pqstate_commit_retries = counter_u64_alloc(M_WAITOK);
queue_ops = counter_u64_alloc(M_WAITOK);
queue_nops = counter_u64_alloc(M_WAITOK);
 }
@@ -179,7 +185,6 @@ static void vm_page_alloc_check(vm_page_t m);
 static bool _vm_page_busy_sleep(vm_object_t obj, vm_page_t m,
 const char *wmesg, bool nonshared, bool locked);
 static void vm_page_clear_dirty_mask(vm_page_t m, vm_page_bits_t pagebits);
-static void vm_page_dequeue_complete(vm_page_t m);
 static void vm_page_enqueue(vm_page_t m, uint8_t queue);
 static bool vm_page_free_prep(vm_page_t m);
 static void vm_page_free_toq(vm_page_t m);
@@ -188,9 +193,11 @@ static int vm_page_insert_after(vm_page_t m, vm_object
 vm_pindex_t pindex, vm_page_t mpred);
 static void vm_page_insert_radixdone(vm_page_t m, vm_object_t object,
 vm_page_t mpred);
-static void vm_page_mvqueue(vm_page_t m, uint8_t queue);
+static void vm_page_mvqueue(vm_page_t m, const uint8_t queue,
+const uint16_t nflag);
 static int vm_page_reclaim_run(int req_class, int domain, u_long npages,
 vm_page_t m_run, vm_paddr_t high);
+static void vm_page_release_toq(vm_page_t m, uint8_t nqueue, bool noreuse);
 static int vm_domain_alloc_fail(struct vm_domain *vmd, vm_object_t object,
 int req);
 static int vm_page_zone_import(void *arg, void **store, int cnt, int domain,
@@ -3266,84 +3273,244 @@ vm_waitpfault(struct domainset *dset, int timo)
 }
 
 static struct vm_pagequeue *
+_vm_page_pagequeue(vm_page_t m, uint8_t queue)
+{
+
+   return (_pagequeue_domain(m)->vmd_pagequeues[queue]);
+}
+
+#ifdef INVARIANTS
+static struct vm_pagequeue *
 vm_page_pagequeue(vm_page_t m)
 {
 
-   uint8_t queue;
+   return (_vm_page_pagequeue(m, vm_page_astate_load(m).queue));
+}
+#endif
 
-   if ((queue = atomic_load_8(>a.queue)) == PQ_NONE)
-   return (NULL);
-   return (_pagequeue_domain(m)->vmd_pagequeues[queue]);
+static __always_inline bool
+vm_page_pqstate_fcmpset(vm_page_t m, vm_page_astate_t *old, vm_page_astate_t 
new)
+{
+   vm_page_astate_t tmp;
+
+   tmp = *old;
+   do {
+   if (__predict_true(vm_page_astate_fcmpset(m, old, new)))
+   return (true);
+   counter_u64_add(pqstate_commit_retries, 1);
+   } while (old->_bits == tmp._bits);
+
+   return (false);
 }
 
-static inline void
-vm_pqbatch_process_page(struct vm_pagequeue *pq, vm_page_t m)
+/*
+ * Do the work of committing a 

svn commit: r356154 - head/sys/vm

2019-12-28 Thread Mark Johnston
Author: markj
Date: Sat Dec 28 19:03:17 2019
New Revision: 356154
URL: https://svnweb.freebsd.org/changeset/base/356154

Log:
  Don't update per-page activation counts in the swapout code.
  
  This avoids duplicating the work of the page daemon's active queue scan.
  Moreover, this duplication was inconsistent:
  - PGA_REFERENCED is not counted in act_count unless pmap_ts_referenced()
returned 0, but the page daemon always counts PGA_REFERENCED towards
the activation count.
  - The swapout daemon always activates a referenced page, but the page
daemon only does so when the containing object is mapped at least
once.
  
  The main purpose of swapout_deactivate_pages() is to shrink the number
  of pages mapped into a given pmap.  To do this without unmapping active
  pages, use the non-destructive pmap_is_referenced() instead of the
  destructive pmap_ts_referenced() and deactivate pages accordingly.
  This simplifies some future changes to the locking protocol for page
  queue state.
  
  Reviewed by:  kib
  Discussed with:   jeff
  Tested by:pho
  Sponsored by: Netflix, Intel
  Differential Revision:https://reviews.freebsd.org/D22674

Modified:
  head/sys/vm/vm_swapout.c

Modified: head/sys/vm/vm_swapout.c
==
--- head/sys/vm/vm_swapout.cSat Dec 28 18:08:26 2019(r356153)
+++ head/sys/vm/vm_swapout.cSat Dec 28 19:03:17 2019(r356154)
@@ -173,51 +173,26 @@ static void vm_thread_swapout(struct thread *td);
 static void
 vm_swapout_object_deactivate_page(pmap_t pmap, vm_page_t m, bool unmap)
 {
-   int act_delta;
 
-   if (vm_page_tryxbusy(m) == 0)
-   return;
-   VM_CNT_INC(v_pdpages);
-
/*
-* The page may acquire a wiring after this check.
-* The page daemon handles wired pages, so there is
-* no harm done if a wiring appears while we are
-* attempting to deactivate the page.
+* Ignore unreclaimable wired pages.  Repeat the check after busying
+* since a busy holder may wire the page.
 */
+   if (vm_page_wired(m) || !vm_page_tryxbusy(m))
+   return;
+
if (vm_page_wired(m) || !pmap_page_exists_quick(pmap, m)) {
vm_page_xunbusy(m);
return;
}
-   act_delta = pmap_ts_referenced(m);
-   vm_page_lock(m);
-   if ((m->a.flags & PGA_REFERENCED) != 0) {
-   if (act_delta == 0)
-   act_delta = 1;
-   vm_page_aflag_clear(m, PGA_REFERENCED);
+   if (!pmap_is_referenced(m)) {
+   vm_page_lock(m);
+   if (!vm_page_active(m))
+   (void)vm_page_try_remove_all(m);
+   else if (unmap && vm_page_try_remove_all(m))
+   vm_page_deactivate(m);
+   vm_page_unlock(m);
}
-   if (!vm_page_active(m) && act_delta != 0) {
-   vm_page_activate(m);
-   m->a.act_count += act_delta;
-   } else if (vm_page_active(m)) {
-   /*
-* The page daemon does not requeue pages
-* after modifying their activation count.
-*/
-   if (act_delta == 0) {
-   m->a.act_count -= min(m->a.act_count, ACT_DECLINE);
-   if (unmap && m->a.act_count == 0) {
-   (void)vm_page_try_remove_all(m);
-   vm_page_deactivate(m);
-   }
-   } else {
-   vm_page_activate(m);
-   if (m->a.act_count < ACT_MAX - ACT_ADVANCE)
-   m->a.act_count += ACT_ADVANCE;
-   }
-   } else if (vm_page_inactive(m))
-   (void)vm_page_try_remove_all(m);
-   vm_page_unlock(m);
vm_page_xunbusy(m);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r356153 - vendor/llvm-project/llvmorg-10-init-8157-g186155b89c2

2019-12-28 Thread Dimitry Andric
Author: dim
Date: Sat Dec 28 18:08:26 2019
New Revision: 356153
URL: https://svnweb.freebsd.org/changeset/base/356153

Log:
  Tag stripped llvm-project trunk r375505, with its git describe output as
  name: llvmorg-10-init-8157-g186155b89c2

Added:
  vendor/llvm-project/llvmorg-10-init-8157-g186155b89c2/
 - copied from r356152, vendor/llvm-project/master/
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r356152 - vendor/llvm-project/trunk-r375505

2019-12-28 Thread Dimitry Andric
Author: dim
Date: Sat Dec 28 18:04:52 2019
New Revision: 356152
URL: https://svnweb.freebsd.org/changeset/base/356152

Log:
  Tag stripped llvm-project trunk r375505, the last commit before the
  upstream Subversion repository was made read-only, and the LLVM project
  migrated to GitHub.
  
  Corresponds to:
  
https://github.com/llvm/llvm-project/commit/186155b89c2d2a2f62337081e3ca15f676c9434b

Added:
  vendor/llvm-project/trunk-r375505/
 - copied from r356151, vendor/llvm-project/master/
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r356151 - head/sys/geom/gate

2019-12-28 Thread Alexander Motin
Author: mav
Date: Sat Dec 28 17:52:53 2019
New Revision: 356151
URL: https://svnweb.freebsd.org/changeset/base/356151

Log:
  Fix GEOM_GATE orphanization.
  
  Previous code closed and destroyed direct read consumer even with I/O still
  in progress.  This patch adds locking and request counting to postpone the
  close till the last of running requests completes.
  
  MFC after:2 weeks
  Sponsored by: iXsystems, Inc.

Modified:
  head/sys/geom/gate/g_gate.c
  head/sys/geom/gate/g_gate.h

Modified: head/sys/geom/gate/g_gate.c
==
--- head/sys/geom/gate/g_gate.c Sat Dec 28 16:40:44 2019(r356150)
+++ head/sys/geom/gate/g_gate.c Sat Dec 28 17:52:53 2019(r356151)
@@ -89,6 +89,19 @@ static struct g_gate_softc **g_gate_units;
 static u_int g_gate_nunits;
 static struct mtx g_gate_units_lock;
 
+static void
+g_gate_detach(void *arg, int flags __unused)
+{
+   struct g_consumer *cp = arg;
+
+   g_topology_assert();
+   G_GATE_DEBUG(1, "Destroying read consumer on provider %s orphan.",
+   cp->provider->name);
+   (void)g_access(cp, -1, 0, 0);
+   g_detach(cp);
+   g_destroy_consumer(cp);
+}
+
 static int
 g_gate_destroy(struct g_gate_softc *sc, boolean_t force)
 {
@@ -140,6 +153,7 @@ g_gate_destroy(struct g_gate_softc *sc, boolean_t forc
g_gate_nunits--;
mtx_unlock(_gate_units_lock);
mtx_destroy(>sc_queue_mtx);
+   mtx_destroy(>sc_read_mtx);
g_topology_lock();
if ((cp = sc->sc_readcons) != NULL) {
sc->sc_readcons = NULL;
@@ -208,8 +222,11 @@ g_gate_queue_io(struct bio *bp)
 static void
 g_gate_done(struct bio *cbp)
 {
+   struct g_gate_softc *sc;
struct bio *pbp;
+   struct g_consumer *cp;
 
+   cp = cbp->bio_from;
pbp = cbp->bio_parent;
if (cbp->bio_error == 0) {
pbp->bio_completed = cbp->bio_completed;
@@ -222,12 +239,20 @@ g_gate_done(struct bio *cbp)
pbp->bio_children--;
g_gate_queue_io(pbp);
}
+
+   sc = cp->geom->softc;
+   mtx_lock(>sc_read_mtx);
+   if (--cp->index == 0 && sc->sc_readcons != cp)
+   g_post_event(g_gate_detach, cp, M_NOWAIT, NULL);
+   mtx_unlock(>sc_read_mtx);
 }
 
 static void
 g_gate_start(struct bio *pbp)
 {
struct g_gate_softc *sc;
+   struct g_consumer *cp;
+   struct bio *cbp;
 
sc = pbp->bio_to->geom->softc;
if (sc == NULL || (sc->sc_flags & G_GATE_FLAG_DESTROY) != 0) {
@@ -237,21 +262,26 @@ g_gate_start(struct bio *pbp)
G_GATE_LOGREQ(2, pbp, "Request received.");
switch (pbp->bio_cmd) {
case BIO_READ:
-   if (sc->sc_readcons != NULL) {
-   struct bio *cbp;
-
-   cbp = g_clone_bio(pbp);
-   if (cbp == NULL) {
-   g_io_deliver(pbp, ENOMEM);
-   return;
-   }
-   cbp->bio_done = g_gate_done;
-   cbp->bio_offset = pbp->bio_offset + sc->sc_readoffset;
-   cbp->bio_to = sc->sc_readcons->provider;
-   g_io_request(cbp, sc->sc_readcons);
+   if (sc->sc_readcons == NULL)
+   break;
+   cbp = g_clone_bio(pbp);
+   if (cbp == NULL) {
+   g_io_deliver(pbp, ENOMEM);
return;
}
-   break;
+   mtx_lock(>sc_read_mtx);
+   if ((cp = sc->sc_readcons) == NULL) {
+   mtx_unlock(>sc_read_mtx);
+   g_destroy_bio(cbp);
+   pbp->bio_children--;
+   break;
+   }
+   cp->index++;
+   cbp->bio_offset = pbp->bio_offset + sc->sc_readoffset;
+   mtx_unlock(>sc_read_mtx);
+   cbp->bio_done = g_gate_done;
+   g_io_request(cbp, cp);
+   return;
case BIO_DELETE:
case BIO_WRITE:
case BIO_FLUSH:
@@ -377,20 +407,18 @@ g_gate_orphan(struct g_consumer *cp)
 {
struct g_gate_softc *sc;
struct g_geom *gp;
+   int done;
 
g_topology_assert();
gp = cp->geom;
sc = gp->softc;
-   if (sc == NULL)
-   return;
-   KASSERT(cp == sc->sc_readcons, ("cp=%p sc_readcons=%p", cp,
-   sc->sc_readcons));
-   sc->sc_readcons = NULL;
-   G_GATE_DEBUG(1, "Destroying read consumer on provider %s orphan.",
-   cp->provider->name);
-   (void)g_access(cp, -1, 0, 0);
-   g_detach(cp);
-   g_destroy_consumer(cp);
+   mtx_lock(>sc_read_mtx);
+   if (sc->sc_readcons == cp)
+   sc->sc_readcons = NULL;
+   done = (cp->index == 0);
+   mtx_unlock(>sc_read_mtx);
+   if (done)
+   g_gate_detach(cp, 

svn commit: r356150 - head/sys/vm

2019-12-28 Thread Konstantin Belousov
Author: kib
Date: Sat Dec 28 16:40:44 2019
New Revision: 356150
URL: https://svnweb.freebsd.org/changeset/base/356150

Log:
  vm_object_shadow(): fix object reference leak.
  
  In r355270 by me, vm_object_shadow() was changed to handle the
  reference counting for the shared case, but the extra reference that
  was done in vmspace_fork() for the shared/need_copy case was not
  removed.
  
  Submitted by: jeff

Modified:
  head/sys/vm/vm_map.c

Modified: head/sys/vm/vm_map.c
==
--- head/sys/vm/vm_map.cSat Dec 28 15:30:50 2019(r356149)
+++ head/sys/vm/vm_map.cSat Dec 28 16:40:44 2019(r356150)
@@ -4127,8 +4127,6 @@ vmspace_fork(struct vmspace *vm1, vm_ooffset_t *fork_c
true);
old_entry->eflags &= ~MAP_ENTRY_NEEDS_COPY;
old_entry->cred = NULL;
-   vm_object_reference(
-   old_entry->object.vm_object);
 
/*
 * As in vm_map_merged_neighbor_dispose(),
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r356149 - in head/sys: arm64/conf arm64/rockchip conf

2019-12-28 Thread Emmanuel Vadot
Author: manu
Date: Sat Dec 28 15:30:50 2019
New Revision: 356149
URL: https://svnweb.freebsd.org/changeset/base/356149

Log:
  arm64: rockchip: Add driver for the io domain
  
  This driver configure the registers in the GRF according to the value
  of the regulators for the platform.
  Some IP can run with either 3.0V or 1.8V, if we don't configure them
  correctly according to the external voltage used they will not work.
  It's only done at boot time for now and might be needed at runtime for
  IP like sdmmc.
  
  Reviewed by:  mmel
  Tested On:RockPro64, Firefly-RK3399 (gonzo), AIO-3288 (mmel)
  MFC after:1 month
  Differential Revision:https://reviews.freebsd.org/D22854

Added:
  head/sys/arm64/rockchip/rk_iodomain.c   (contents, props changed)
Modified:
  head/sys/arm64/conf/GENERIC
  head/sys/conf/files.arm64

Modified: head/sys/arm64/conf/GENERIC
==
--- head/sys/arm64/conf/GENERIC Sat Dec 28 15:28:39 2019(r356148)
+++ head/sys/arm64/conf/GENERIC Sat Dec 28 15:30:50 2019(r356149)
@@ -331,6 +331,9 @@ device  regulator
 device syscon
 device aw_syscon
 
+# IO Domains
+device rk_iodomain
+
 # The `bpf' device enables the Berkeley Packet Filter.
 # Be aware of the administrative consequences of enabling this!
 # Note that 'bpf' is required for DHCP.

Added: head/sys/arm64/rockchip/rk_iodomain.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm64/rockchip/rk_iodomain.c   Sat Dec 28 15:30:50 2019
(r356149)
@@ -0,0 +1,207 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2019 Emmanuel Vadot 
+ *
+ * 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.
+ *
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include "syscon_if.h"
+
+#defineRK3288_GRF_IO_VSEL  0x380
+#defineRK3399_GRF_IO_VSEL  0xe640
+#defineRK3399_PMUGRF_IO_VSEL   0x180
+
+struct rk_iodomain_supply {
+   char*name;
+   uint32_tbit;
+};
+
+struct rk_iodomain_conf {
+   struct rk_iodomain_supply   *supply;
+   int nsupply;
+   uint32_tgrf_reg;
+};
+
+struct rk_iodomain_softc {
+   device_tdev;
+   struct syscon   *grf;
+   phandle_t   node;
+   struct rk_iodomain_conf *conf;
+};
+
+static struct rk_iodomain_supply rk3288_supply[] = {
+   {"lcdc-supply", 0},
+   {"dvp-supply", 1},
+   {"flash0-supply", 2},
+   {"flash1-supply", 3},
+   {"wifi-supply", 4},
+   {"bb-supply", 5},
+   {"audio-supply", 6},
+   {"sdcard-supply", 7},
+   {"gpio30-supply", 8},
+   {"gpio1830-supply", 9},
+};
+
+static struct rk_iodomain_conf rk3288_conf = {
+   .supply = rk3288_supply,
+   .nsupply = nitems(rk3288_supply),
+   .grf_reg = RK3288_GRF_IO_VSEL,
+};
+
+static struct rk_iodomain_supply rk3399_supply[] = {
+   {"bt656-supply", 0},
+   {"audio-supply", 1},
+   {"sdmmc-supply", 2},
+   {"gpio1830-supply", 3},
+};
+
+static struct rk_iodomain_conf rk3399_conf = {
+   .supply = rk3399_supply,
+   .nsupply = nitems(rk3399_supply),
+   .grf_reg = RK3399_GRF_IO_VSEL,
+};
+
+static struct rk_iodomain_supply rk3399_pmu_supply[] = {
+   {"pmu1830-supply", 9},
+};
+
+static struct rk_iodomain_conf rk3399_pmu_conf = {
+   .supply = 

svn commit: r356148 - head/sys/arm64/rockchip

2019-12-28 Thread Emmanuel Vadot
Author: manu
Date: Sat Dec 28 15:28:39 2019
New Revision: 356148
URL: https://svnweb.freebsd.org/changeset/base/356148

Log:
  arm64: rockchip: rk808: Add remaining regulators
  
  The RK808 driver was missing the LDO and switch regulators.
  Add support for them.
  
  Reviewed by:  mmel
  MFC after:1 month
  Differential Revision:https://reviews.freebsd.org/D22852

Modified:
  head/sys/arm64/rockchip/rk805.c
  head/sys/arm64/rockchip/rk805reg.h

Modified: head/sys/arm64/rockchip/rk805.c
==
--- head/sys/arm64/rockchip/rk805.c Sat Dec 28 13:35:54 2019
(r356147)
+++ head/sys/arm64/rockchip/rk805.c Sat Dec 28 15:28:39 2019
(r356148)
@@ -221,6 +221,114 @@ static struct rk805_regdef rk808_regdefs[] = {
.voltage_step = 10,
.voltage_nstep = 16,
},
+   {
+   .id = RK808_LDO1,
+   .name = "LDO_REG1",
+   .enable_reg = RK808_LDO_EN,
+   .enable_mask = 0x1,
+   .voltage_reg = RK805_LDO1_ON_VSEL,
+   .voltage_mask = 0x1F,
+   .voltage_min = 180,
+   .voltage_max = 340,
+   .voltage_step = 10,
+   .voltage_nstep = 17,
+   },
+   {
+   .id = RK808_LDO2,
+   .name = "LDO_REG2",
+   .enable_reg = RK808_LDO_EN,
+   .enable_mask = 0x2,
+   .voltage_reg = RK805_LDO2_ON_VSEL,
+   .voltage_mask = 0x1F,
+   .voltage_min = 180,
+   .voltage_max = 340,
+   .voltage_step = 10,
+   .voltage_nstep = 17,
+   },
+   {
+   .id = RK808_LDO3,
+   .name = "LDO_REG3",
+   .enable_reg = RK808_LDO_EN,
+   .enable_mask = 0x4,
+   .voltage_reg = RK805_LDO3_ON_VSEL,
+   .voltage_mask = 0xF,
+   .voltage_min = 80,
+   .voltage_max = 250,
+   .voltage_step = 10,
+   .voltage_nstep = 18,
+   },
+   {
+   .id = RK808_LDO4,
+   .name = "LDO_REG4",
+   .enable_reg = RK808_LDO_EN,
+   .enable_mask = 0x8,
+   .voltage_reg = RK808_LDO4_ON_VSEL,
+   .voltage_mask = 0x1F,
+   .voltage_min = 180,
+   .voltage_max = 340,
+   .voltage_step = 10,
+   .voltage_nstep = 17,
+   },
+   {
+   .id = RK808_LDO5,
+   .name = "LDO_REG5",
+   .enable_reg = RK808_LDO_EN,
+   .enable_mask = 0x10,
+   .voltage_reg = RK808_LDO5_ON_VSEL,
+   .voltage_mask = 0x1F,
+   .voltage_min = 180,
+   .voltage_max = 340,
+   .voltage_step = 10,
+   .voltage_nstep = 17,
+   },
+   {
+   .id = RK808_LDO6,
+   .name = "LDO_REG6",
+   .enable_reg = RK808_LDO_EN,
+   .enable_mask = 0x20,
+   .voltage_reg = RK808_LDO6_ON_VSEL,
+   .voltage_mask = 0x1F,
+   .voltage_min = 80,
+   .voltage_max = 250,
+   .voltage_step = 10,
+   .voltage_nstep = 18,
+   },
+   {
+   .id = RK808_LDO7,
+   .name = "LDO_REG7",
+   .enable_reg = RK808_LDO_EN,
+   .enable_mask = 0x40,
+   .voltage_reg = RK808_LDO7_ON_VSEL,
+   .voltage_mask = 0x1F,
+   .voltage_min = 80,
+   .voltage_max = 250,
+   .voltage_step = 10,
+   .voltage_nstep = 18,
+   },
+   {
+   .id = RK808_LDO8,
+   .name = "LDO_REG8",
+   .enable_reg = RK808_LDO_EN,
+   .enable_mask = 0x80,
+   .voltage_reg = RK808_LDO8_ON_VSEL,
+   .voltage_mask = 0x1F,
+   .voltage_min = 180,
+   .voltage_max = 340,
+   .voltage_step = 10,
+   .voltage_nstep = 17,
+   },
+   {
+   .id = RK808_SWITCH1,
+   .name = "SWITCH_REG1",
+   .enable_reg = RK805_DCDC_EN,
+   .enable_mask = 0x20,
+   },
+   {
+   .id = RK808_SWITCH2,
+   .name = "SWITCH_REG2",
+   .enable_reg = RK805_DCDC_EN,
+   .enable_mask = 0x40,
+   },
 };
 
 static int

Modified: head/sys/arm64/rockchip/rk805reg.h
==
--- head/sys/arm64/rockchip/rk805reg.h  Sat Dec 28 13:35:54 2019
(r356147)
+++ head/sys/arm64/rockchip/rk805reg.h  Sat Dec 28 15:28:39 2019
(r356148)
@@ -58,6 +58,16 @@
 #defineRK805_LDO2_SLEEP_VSEL   0x3E
 #define

Re: svn commit: r356142 - in head/sys: dev/ofw sys

2019-12-28 Thread Pedro Giffuni



On 28/12/2019 00:27, Rodney W. Grimes wrote:

[ Charset UTF-8 unsupported, converting... ]

On 2019-12-27 23:24, Rodney W. Grimes wrote:

[ Charset UTF-8 unsupported, converting... ]

On 2019-12-27 22:16, Rodney W. Grimes wrote:

Author: pfg
Date: Sat Dec 28 02:58:30 2019
New Revision: 356142
URL: https://svnweb.freebsd.org/changeset/base/356142

Log:
   SPDX: update some tags with two licenses.

Modified:
   head/sys/dev/ofw/openfirm.h
   head/sys/sys/sched.h

Modified: head/sys/dev/ofw/openfirm.h
==
--- head/sys/dev/ofw/openfirm.h Sat Dec 28 02:11:41 2019(r356141)
+++ head/sys/dev/ofw/openfirm.h Sat Dec 28 02:58:30 2019(r356142)
@@ -1,7 +1,7 @@
  /*$NetBSD: openfirm.h,v 1.1 1998/05/15 10:16:00 tsubai Exp $  */
  
  /*-

- * SPDX-License-Identifier: BSD-4-Clause
+ * SPDX-License-Identifier: (BSD-4-Clause AND BSD-2-Clause-FreeBSD)
   *
   * Copyright (C) 1995, 1996 Wolfgang Solfrank.
   * Copyright (C) 1995, 1996 TooLs GmbH.

Modified: head/sys/sys/sched.h
==
--- head/sys/sys/sched.hSat Dec 28 02:11:41 2019(r356141)
+++ head/sys/sys/sched.hSat Dec 28 02:58:30 2019(r356142)
@@ -1,5 +1,5 @@
  /*-
- * SPDX-License-Identifier: BSD-4-Clause
+ * SPDX-License-Identifier: (BSD-4-Clause AND BSD-2-Clause-FreeBSD)
   *
   * Copyright (c) 1996, 1997
   *  HD Associates, Inc.  All rights reserved.


This situation should not of occured, and leads to an ambigous license state.

It actually happens a lot (I mean two or more licenses in the same
file): SPDX explicitly uses AND (not OR) for cases like this.


What code is under license 2 clause and what under 4 clause?

Anyone redistributing the file has to respect both licenses. If you are
lucky enough to have access to version control you may be able to
discern the author and the corresponding license, otherwise you are
trapped with both.

So the 2 clause add is null, so why have it there?

So that eventually, when the project gets to a point where sufficient
part of the code is rewritten they can opt to change the license to the
simpler form. There are ways to relicense projects gradually, and its
nothing new, in fact it is very much in the BSD spirit to gradually
replace more restricted UNIX code.

The only changing we have done to BSD licenses as in thost cases
that the Regents requested/granted the right to change to lesser
clauses.  Until you get HD & Associtates (in this one case) to
grant that right your walking on a grey edge I would rather not
walk on.



As an independent developer I don't have to adopt on my code 
restrictions that other developers have adopted for their code.




The reference to BSD spirit and replacing more restricted UNIX (tm)
code is way off base in this context.  This is not an AT & T
license we are talking about here.  And again you can not just
modify the existing 4 clause licensed file by slapping a 2 clause
license into it, or the project would of done that everyplace
ages ago.


We are talking about restrictions. You probably missed it, but in the 
late 90's the project opted for removing restrictions, even if that 
meant the code could eventually end up in copyleft codebases. FreeBSD 
has been flexible and pragmatic about it but the other BSDs made 
basically the same decision.



What is done here in this file is a mistake, and should be corrected.
Can you point me to other files that actually have multiple BSD
licenses in them?


I have better things to do in my holidays, but there are plenty.

I will note for reference that this is indeed official project policy:

https://www.freebsd.org/internal/software-license.html

" ... We invite and greatly appreciate the contribution of both changes 
and additions under the two-clause BSD license, and encourage the 
adoption of this license by other open source projects."



It may be a long shot but it has happened on other projects as well:
libdialog (in our tree) was rewritten and relicensed from GPL to LGPL.



It looks to me as if this was done by Jeff Robinson as the 2 clause is
attached to his copyright and we should probably just ask him to relax
that back to the files existing 4 clause license, and or go after Greg
Ansley of HD associtates to get them to relax the 4 clause.


No, Jeff (or anyone else, as I said there are many cases in our tree) is
entitled to choose his own license as long as it is compatible with the
pre-existing licensing.

I was specifically sighting this one file, sys/sys/sched.h.

Actually that might be a grey area, no place does the BSD license grant
you rights to modify the terms of the license, and that is in effect
what adding this second license does.

No one is modifying the original license: it is there and applies to the
original code.



You can choose your own license for original work, sure, but obliterating
parts of an existing 

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

2019-12-28 Thread Edward Tomasz Napierala
Author: trasz
Date: Sat Dec 28 13:35:54 2019
New Revision: 356147
URL: https://svnweb.freebsd.org/changeset/base/356147

Log:
  Make linux mount(2) tolerate NULL 'from' argument, and fix flag
  handling.
  
  This should unbreak access04, acct01, chmod06, creat06,
  and fchmod06 LTP tests.
  
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

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

Modified: head/sys/compat/linux/linux_file.c
==
--- head/sys/compat/linux/linux_file.c  Sat Dec 28 12:16:40 2019
(r356146)
+++ head/sys/compat/linux/linux_file.c  Sat Dec 28 13:35:54 2019
(r356147)
@@ -1016,9 +1016,13 @@ linux_mount(struct thread *td, struct linux_mount_args
NULL);
if (error != 0)
goto out;
-   error = copyinstr(args->specialfile, mntfromname, MNAMELEN - 1, NULL);
-   if (error != 0)
-   goto out;
+   if (args->specialfile != NULL) {
+   error = copyinstr(args->specialfile, mntfromname, MNAMELEN - 1, 
NULL);
+   if (error != 0)
+   goto out;
+   } else {
+   mntfromname[0] = '\0';
+   }
error = copyinstr(args->dir, mntonname, MNAMELEN - 1, NULL);
if (error != 0)
goto out;
@@ -1033,20 +1037,18 @@ linux_mount(struct thread *td, struct linux_mount_args
 
fsflags = 0;
 
-   if ((args->rwflag & 0x) == 0xc0ed) {
-   /*
-* Linux SYNC flag is not included; the closest equivalent
-* FreeBSD has is !ASYNC, which is our default.
-*/
-   if (args->rwflag & LINUX_MS_RDONLY)
-   fsflags |= MNT_RDONLY;
-   if (args->rwflag & LINUX_MS_NOSUID)
-   fsflags |= MNT_NOSUID;
-   if (args->rwflag & LINUX_MS_NOEXEC)
-   fsflags |= MNT_NOEXEC;
-   if (args->rwflag & LINUX_MS_REMOUNT)
-   fsflags |= MNT_UPDATE;
-   }
+   /*
+* Linux SYNC flag is not included; the closest equivalent
+* FreeBSD has is !ASYNC, which is our default.
+*/
+   if (args->rwflag & LINUX_MS_RDONLY)
+   fsflags |= MNT_RDONLY;
+   if (args->rwflag & LINUX_MS_NOSUID)
+   fsflags |= MNT_NOSUID;
+   if (args->rwflag & LINUX_MS_NOEXEC)
+   fsflags |= MNT_NOEXEC;
+   if (args->rwflag & LINUX_MS_REMOUNT)
+   fsflags |= MNT_UPDATE;
 
error = kernel_vmount(fsflags,
"fstype", fstypename,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r356146 - in head/tests/sys/net: . routing

2019-12-28 Thread Alexander V. Chernikov
Author: melifaro
Date: Sat Dec 28 12:16:40 2019
New Revision: 356146
URL: https://svnweb.freebsd.org/changeset/base/356146

Log:
  Add userland tests for route table/lltable rtsock operations.
  
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D22860

Added:
  head/tests/sys/net/routing/
  head/tests/sys/net/routing/Makefile   (contents, props changed)
  head/tests/sys/net/routing/rtsock_common.h   (contents, props changed)
  head/tests/sys/net/routing/rtsock_config.h   (contents, props changed)
  head/tests/sys/net/routing/rtsock_print.h   (contents, props changed)
  head/tests/sys/net/routing/test_rtsock_l3.c   (contents, props changed)
  head/tests/sys/net/routing/test_rtsock_lladdr.c   (contents, props changed)
Modified:
  head/tests/sys/net/Makefile

Modified: head/tests/sys/net/Makefile
==
--- head/tests/sys/net/Makefile Sat Dec 28 06:56:21 2019(r356145)
+++ head/tests/sys/net/Makefile Sat Dec 28 12:16:40 2019(r356146)
@@ -10,6 +10,8 @@ ATF_TESTS_SH+=if_clone_test
 ATF_TESTS_SH+= if_tun_test
 ATF_TESTS_SH+= if_vlan
 
+TESTS_SUBDIRS+=routing
+
 # The tests are written to be run in parallel, but doing so leads to random
 # panics.  I think it's because the kernel's list of interfaces isn't properly
 # locked.

Added: head/tests/sys/net/routing/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tests/sys/net/routing/Makefile Sat Dec 28 12:16:40 2019
(r356146)
@@ -0,0 +1,14 @@
+# $FreeBSD$
+
+PACKAGE=   tests
+
+TESTSDIR=   ${TESTSBASE}/sys/net
+
+ATF_TESTS_C += test_rtsock_l3
+ATF_TESTS_C += test_rtsock_lladdr
+
+# Most of the tests operates on a common IPv4/IPv6 prefix,
+# so running them in parallel will lead to weird results.
+TEST_METADATA+=is_exclusive=true
+
+.include 

Added: head/tests/sys/net/routing/rtsock_common.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tests/sys/net/routing/rtsock_common.h  Sat Dec 28 12:16:40 2019
(r356146)
@@ -0,0 +1,766 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2019 Alexander V. Chernikov
+ *
+ * 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$
+ */
+
+#ifndef _NET_ROUTING_RTSOCK_COMMON_H_
+#define _NET_ROUTING_RTSOCK_COMMON_H_
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+
+#include "rtsock_print.h"
+
+void rtsock_update_rtm_len(struct rt_msghdr *rtm);
+void rtsock_validate_message(char *buffer, ssize_t len);
+void rtsock_add_rtm_sa(struct rt_msghdr *rtm, int addr_type, struct sockaddr 
*sa);
+
+static int _rtm_seq = 42;
+
+
+/*
+ * Checks if the interface cloner module is present for @name.
+ */
+static int
+_check_cloner(char *name)
+{
+   struct if_clonereq ifcr;
+   char *cp, *buf;
+   int idx;
+   int s;
+   int found = 0;
+
+   s = socket(AF_LOCAL, SOCK_DGRAM, 0);
+   if (s == -1)
+   err(1, "socket(AF_LOCAL,SOCK_DGRAM)");
+
+   memset(, 0, sizeof(ifcr));
+
+   if (ioctl(s, SIOCIFGCLONERS, ) < 0)
+   err(1, "SIOCIFGCLONERS for count");
+
+   buf = malloc(ifcr.ifcr_total * IFNAMSIZ);
+   if (buf == NULL)
+   err(1, "unable to allocate cloner name buffer");
+
+   

Re: svn commit: r356142 - in head/sys: dev/ofw sys

2019-12-28 Thread Warner Losh
On Fri, Dec 27, 2019 at 10:55 PM Rodney W. Grimes 
wrote:

> > On Fri, Dec 27, 2019 at 10:27 PM Rodney W. Grimes <
> free...@gndrsh.dnsmgr.net>
> > wrote:
> >
> > >
> > > > > You can choose your own license for original work, sure, but
> > > obliterating
> > > > > parts of an existing license by applying a second license which is
> in
> > > > > conflict is probably a poor idea.
> > > >
> > > >
> > > > We don't do that at all: pretty clearly there is no conflict between
> > > > both licenses as you can comply with both.
> > >
> > > The only way to comply with both is to comply with the full 4
> > > clause license.  Hense the 2 clause is pointless in being there
> > > and can never apply until all 4 clause authors agree to change
> > > to 2 clause.
> > >
> >
> >
> > Until such time as Jeff finishes rewriting the files, then we just nerf
> the
> > 4 clause one as no longer relevant since it describes no code in the file
> > anymore...
>
> Slippery slope as that would require a very detailed audit to
> make sure at no time in any way did Jeff or anyone else copy
> or retain any original code.


One we've  done dozens of times in the project's history. People rewrite
things all the time. From the tty layer to things in the vm.


> >
> > We've done exactly the thing Jeff did hundreds if not thousands of times
> > already in the project in code spanning
> > at least the last 25 or so years...
>
> I have to call BS on that claim, the project is just barely past
>

Please watch the tone of your replies. This is not an acceptable tone.


> 25 years old, and we certainly did not do any of this at that
> time, and further the 3 clause came into existance in 1999, and
> the 2 clause was that same time frame, so possibly 20 years.
>

We have several files with 2 clause that date to 1996 (look at many of the
elf_machdep.c files have this date). Both FreeBSD and NetBSD used 2 or 3
clause licenses well in advance of the regent's letter...


> Please show me the 100 to 1000's of files that this occured in.
>

sys/kern alone has many of them, though this sort of thing is hard to grep
for. sys/arm/arm has some. sys/mips/mips has some more. Many with dates
going back at least 15 years. sys/arm/arm/support.S has one that has 3
different sets of clauses, the most recent of which is 2004, the earliest
1997 ( NetBSD, Wasabi and Olivier Houchard).

A grep of the kernel shows ~200 .c, ~20 .s and ~80 .h files that have
multiple licenses, though grep is the wrong tool to know how many are
identical and how many vary. A quick audit  suggests maybe 5-10% of
these are likely to vary.  so not hundreds or thousands, but not zero
either.

I've not looked at userland at all with this quick grep.

>  Not sure why it's coming up now over an annotation that has a
> > specific meaning that's clear and well defined.
>
> No one pendantically legal has been watching commits for 20 years
> is probably why?
>

What about the many legal reviews done by companies that produce FreeBSD
products over the years. Those generally flag things like the beerware
license, but not this detail

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