svn commit: r366744 - head/sys/kern

2020-10-15 Thread Mateusz Guzik
Author: mjg
Date: Fri Oct 16 02:19:33 2020
New Revision: 366744
URL: https://svnweb.freebsd.org/changeset/base/366744

Log:
  cache: flip inverted condition in previous
  
  It happened to not affect correctness in that the fallback code would
  simply neglect to promote the entry.

Modified:
  head/sys/kern/vfs_cache.c

Modified: head/sys/kern/vfs_cache.c
==
--- head/sys/kern/vfs_cache.c   Fri Oct 16 00:56:13 2020(r366743)
+++ head/sys/kern/vfs_cache.c   Fri Oct 16 02:19:33 2020(r366744)
@@ -1624,7 +1624,7 @@ negative_success:
vfs_smr_exit();
goto out_fallback;
}
-   if (neg_hot) {
+   if (!neg_hot) {
vfs_smr_exit();
if (!cache_negative_promote_cond(dvp, cnp, ncp, hash))
goto out_fallback;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366742 - head/sys/kern

2020-10-15 Thread Mateusz Guzik
Author: mjg
Date: Fri Oct 16 00:55:57 2020
New Revision: 366742
URL: https://svnweb.freebsd.org/changeset/base/366742

Log:
  cache: elide vhold/vdrop around promoting negative entry

Modified:
  head/sys/kern/vfs_cache.c

Modified: head/sys/kern/vfs_cache.c
==
--- head/sys/kern/vfs_cache.c   Fri Oct 16 00:55:31 2020(r366741)
+++ head/sys/kern/vfs_cache.c   Fri Oct 16 00:55:57 2020(r366742)
@@ -3394,9 +3394,6 @@ cache_fplookup_negative_promote(struct cache_fpl *fpl,
cnp = fpl->cnp;
dvp = fpl->dvp;
 
-   if (!vhold_smr(dvp))
-   return (cache_fpl_aborted(fpl));
-
nl = NCP2NEGLIST(oncp);
cache_fpl_smr_exit(fpl);
 
@@ -3409,6 +3406,10 @@ cache_fplookup_negative_promote(struct cache_fpl *fpl,
/*
 * Avoid all surprises by only succeeding if we got the same entry and
 * bailing completely otherwise.
+* XXX There are no provisions to keep the vnode around, meaning we may
+* end up promoting a negative entry for a *new* vnode and returning
+* ENOENT on its account. This is the error we want to return anyway
+* and promotion is harmless.
 *
 * In particular at this point there can be a new ncp which matches the
 * search but hashes to a different neglist.
@@ -3451,12 +3452,10 @@ cache_fplookup_negative_promote(struct cache_fpl *fpl,
counter_u64_add(numneghits, 1);
cache_fpl_smr_exit(fpl);
mtx_unlock(>nl_lock);
-   vdrop(dvp);
return (cache_fpl_handled(fpl, ENOENT));
 out_abort:
cache_fpl_smr_exit(fpl);
mtx_unlock(>nl_lock);
-   vdrop(dvp);
return (cache_fpl_aborted(fpl));
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366743 - head/sys/kern

2020-10-15 Thread Mateusz Guzik
Author: mjg
Date: Fri Oct 16 00:56:13 2020
New Revision: 366743
URL: https://svnweb.freebsd.org/changeset/base/366743

Log:
  cache: support negative entry promotion in slowpath smr

Modified:
  head/sys/kern/vfs_cache.c

Modified: head/sys/kern/vfs_cache.c
==
--- head/sys/kern/vfs_cache.c   Fri Oct 16 00:55:57 2020(r366742)
+++ head/sys/kern/vfs_cache.c   Fri Oct 16 00:56:13 2020(r366743)
@@ -806,6 +806,9 @@ cache_negative_init(struct namecache *ncp)
ns->neg_flag = 0;
 }
 
+/*
+ * Move a negative entry to the hot list.
+ */
 static void
 cache_negative_promote(struct namecache *ncp)
 {
@@ -823,6 +826,87 @@ cache_negative_promote(struct namecache *ncp)
}
 }
 
+/*
+ * Move a negative entry to the hot list if it matches the lookup.
+ *
+ * We have to take locks, but they may be contended and in the worst
+ * case we may need to go off CPU. We don't want to spin within the
+ * smr section and we can't block with it. Exiting the section means
+ * the found entry could have been evicted. We are going to look it
+ * up again.
+ */
+static bool
+cache_negative_promote_cond(struct vnode *dvp, struct componentname *cnp,
+struct namecache *oncp, uint32_t hash)
+{
+   struct namecache *ncp;
+   struct neglist *nl;
+   u_char nc_flag;
+
+   nl = NCP2NEGLIST(oncp);
+
+   mtx_lock(>nl_lock);
+   /*
+* For hash iteration.
+*/
+   vfs_smr_enter();
+
+   /*
+* Avoid all surprises by only succeeding if we got the same entry and
+* bailing completely otherwise.
+* XXX There are no provisions to keep the vnode around, meaning we may
+* end up promoting a negative entry for a *new* vnode and returning
+* ENOENT on its account. This is the error we want to return anyway
+* and promotion is harmless.
+*
+* In particular at this point there can be a new ncp which matches the
+* search but hashes to a different neglist.
+*/
+   CK_SLIST_FOREACH(ncp, (NCHHASH(hash)), nc_hash) {
+   if (ncp == oncp)
+   break;
+   }
+
+   /*
+* No match to begin with.
+*/
+   if (__predict_false(ncp == NULL)) {
+   goto out_abort;
+   }
+
+   /*
+* The newly found entry may be something different...
+*/
+   if (!(ncp->nc_dvp == dvp && ncp->nc_nlen == cnp->cn_namelen &&
+   !bcmp(ncp->nc_name, cnp->cn_nameptr, ncp->nc_nlen))) {
+   goto out_abort;
+   }
+
+   /*
+* ... and not even negative.
+*/
+   nc_flag = atomic_load_char(>nc_flag);
+   if ((nc_flag & NCF_NEGATIVE) == 0) {
+   goto out_abort;
+   }
+
+   if (__predict_false(!cache_ncp_canuse(ncp))) {
+   goto out_abort;
+   }
+
+   cache_negative_promote(ncp);
+
+   SDT_PROBE2(vfs, namecache, lookup, hit__negative, dvp, ncp->nc_name);
+   counter_u64_add(numneghits, 1);
+   vfs_smr_exit();
+   mtx_unlock(>nl_lock);
+   return (true);
+out_abort:
+   vfs_smr_exit();
+   mtx_unlock(>nl_lock);
+   return (false);
+}
+
 static void
 cache_negative_hit(struct namecache *ncp)
 {
@@ -1455,7 +1539,7 @@ cache_lookup(struct vnode *dvp, struct vnode **vpp, st
uint32_t hash;
enum vgetstate vs;
int error;
-   bool whiteout;
+   bool whiteout, neg_hot;
u_short nc_flag;
 
MPASS((tsp == NULL && ticksp == NULL) || (tsp != NULL && ticksp != 
NULL));
@@ -1532,21 +1616,23 @@ negative_success:
}
}
 
-   SDT_PROBE2(vfs, namecache, lookup, hit__negative, dvp, ncp->nc_name);
cache_out_ts(ncp, tsp, ticksp);
-   counter_u64_add(numneghits, 1);
whiteout = (ncp->nc_flag & NCF_WHITE);
-   /*
-* TODO: We need to take locks to promote an entry. Code doing it
-* in SMR lookup can be modified to be shared.
-*/
ns = NCP2NEGSTATE(ncp);
-   if ((ns->neg_flag & NEG_HOT) == 0 ||
-   !cache_ncp_canuse(ncp)) {
+   neg_hot = ((ns->neg_flag & NEG_HOT) != 0);
+   if (__predict_false(!cache_ncp_canuse(ncp))) {
vfs_smr_exit();
goto out_fallback;
}
-   vfs_smr_exit();
+   if (neg_hot) {
+   vfs_smr_exit();
+   if (!cache_negative_promote_cond(dvp, cnp, ncp, hash))
+   goto out_fallback;
+   } else {
+   SDT_PROBE2(vfs, namecache, lookup, hit__negative, dvp, 
ncp->nc_name);
+   counter_u64_add(numneghits, 1);
+   vfs_smr_exit();
+   }
if (whiteout)
cnp->cn_flags |= ISWHITEOUT;
return (ENOENT);
@@ -3373,90 +3459,21 @@ cache_fplookup_vnode_supported(struct vnode *vp)
return (vp->v_type != VLNK);
 }
 
-/*
- * Move a negative entry to the hot list.
- *
- * We have 

svn commit: r366741 - head/sys/kern

2020-10-15 Thread Mateusz Guzik
Author: mjg
Date: Fri Oct 16 00:55:31 2020
New Revision: 366741
URL: https://svnweb.freebsd.org/changeset/base/366741

Log:
  cache: dedup code for negative promotion

Modified:
  head/sys/kern/vfs_cache.c

Modified: head/sys/kern/vfs_cache.c
==
--- head/sys/kern/vfs_cache.c   Fri Oct 16 00:55:09 2020(r366740)
+++ head/sys/kern/vfs_cache.c   Fri Oct 16 00:55:31 2020(r366741)
@@ -807,22 +807,34 @@ cache_negative_init(struct namecache *ncp)
 }
 
 static void
-cache_negative_hit(struct namecache *ncp)
+cache_negative_promote(struct namecache *ncp)
 {
struct neglist *nl;
struct negstate *ns;
 
ns = NCP2NEGSTATE(ncp);
-   if ((ns->neg_flag & NEG_HOT) != 0)
-   return;
nl = NCP2NEGLIST(ncp);
-   mtx_lock(>nl_lock);
+   mtx_assert(>nl_lock, MA_OWNED);
if ((ns->neg_flag & NEG_HOT) == 0) {
TAILQ_REMOVE(>nl_list, ncp, nc_dst);
TAILQ_INSERT_TAIL(>nl_hotlist, ncp, nc_dst);
nl->nl_hotnum++;
ns->neg_flag |= NEG_HOT;
}
+}
+
+static void
+cache_negative_hit(struct namecache *ncp)
+{
+   struct neglist *nl;
+   struct negstate *ns;
+
+   ns = NCP2NEGSTATE(ncp);
+   if ((ns->neg_flag & NEG_HOT) != 0)
+   return;
+   nl = NCP2NEGLIST(ncp);
+   mtx_lock(>nl_lock);
+   cache_negative_promote(ncp);
mtx_unlock(>nl_lock);
 }
 
@@ -3376,7 +3388,6 @@ cache_fplookup_negative_promote(struct cache_fpl *fpl,
struct componentname *cnp;
struct namecache *ncp;
struct neglist *nl;
-   struct negstate *ns;
struct vnode *dvp;
u_char nc_flag;
 
@@ -3434,13 +3445,7 @@ cache_fplookup_negative_promote(struct cache_fpl *fpl,
goto out_abort;
}
 
-   ns = NCP2NEGSTATE(ncp);
-   if ((ns->neg_flag & NEG_HOT) == 0) {
-   TAILQ_REMOVE(>nl_list, ncp, nc_dst);
-   TAILQ_INSERT_TAIL(>nl_hotlist, ncp, nc_dst);
-   nl->nl_hotnum++;
-   ns->neg_flag |= NEG_HOT;
-   }
+   cache_negative_promote(ncp);
 
SDT_PROBE2(vfs, namecache, lookup, hit__negative, dvp, ncp->nc_name);
counter_u64_add(numneghits, 1);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366740 - head/sys/kern

2020-10-15 Thread Mateusz Guzik
Author: mjg
Date: Fri Oct 16 00:55:09 2020
New Revision: 366740
URL: https://svnweb.freebsd.org/changeset/base/366740

Log:
  cache: neglist -> nl; negstate -> ns
  
  No functional changes.

Modified:
  head/sys/kern/vfs_cache.c

Modified: head/sys/kern/vfs_cache.c
==
--- head/sys/kern/vfs_cache.c   Fri Oct 16 00:01:01 2020(r366739)
+++ head/sys/kern/vfs_cache.c   Fri Oct 16 00:55:09 2020(r366740)
@@ -799,85 +799,85 @@ SYSCTL_PROC(_debug_hashstat, OID_AUTO, nchash, CTLTYPE
 static void
 cache_negative_init(struct namecache *ncp)
 {
-   struct negstate *negstate;
+   struct negstate *ns;
 
ncp->nc_flag |= NCF_NEGATIVE;
-   negstate = NCP2NEGSTATE(ncp);
-   negstate->neg_flag = 0;
+   ns = NCP2NEGSTATE(ncp);
+   ns->neg_flag = 0;
 }
 
 static void
 cache_negative_hit(struct namecache *ncp)
 {
-   struct neglist *neglist;
-   struct negstate *negstate;
+   struct neglist *nl;
+   struct negstate *ns;
 
-   negstate = NCP2NEGSTATE(ncp);
-   if ((negstate->neg_flag & NEG_HOT) != 0)
+   ns = NCP2NEGSTATE(ncp);
+   if ((ns->neg_flag & NEG_HOT) != 0)
return;
-   neglist = NCP2NEGLIST(ncp);
-   mtx_lock(>nl_lock);
-   if ((negstate->neg_flag & NEG_HOT) == 0) {
-   TAILQ_REMOVE(>nl_list, ncp, nc_dst);
-   TAILQ_INSERT_TAIL(>nl_hotlist, ncp, nc_dst);
-   neglist->nl_hotnum++;
-   negstate->neg_flag |= NEG_HOT;
+   nl = NCP2NEGLIST(ncp);
+   mtx_lock(>nl_lock);
+   if ((ns->neg_flag & NEG_HOT) == 0) {
+   TAILQ_REMOVE(>nl_list, ncp, nc_dst);
+   TAILQ_INSERT_TAIL(>nl_hotlist, ncp, nc_dst);
+   nl->nl_hotnum++;
+   ns->neg_flag |= NEG_HOT;
}
-   mtx_unlock(>nl_lock);
+   mtx_unlock(>nl_lock);
 }
 
 static void
 cache_negative_insert(struct namecache *ncp)
 {
-   struct neglist *neglist;
+   struct neglist *nl;
 
MPASS(ncp->nc_flag & NCF_NEGATIVE);
cache_assert_bucket_locked(ncp);
-   neglist = NCP2NEGLIST(ncp);
-   mtx_lock(>nl_lock);
-   TAILQ_INSERT_TAIL(>nl_list, ncp, nc_dst);
-   mtx_unlock(>nl_lock);
+   nl = NCP2NEGLIST(ncp);
+   mtx_lock(>nl_lock);
+   TAILQ_INSERT_TAIL(>nl_list, ncp, nc_dst);
+   mtx_unlock(>nl_lock);
atomic_add_long(, 1);
 }
 
 static void
 cache_negative_remove(struct namecache *ncp)
 {
-   struct neglist *neglist;
-   struct negstate *negstate;
+   struct neglist *nl;
+   struct negstate *ns;
 
cache_assert_bucket_locked(ncp);
-   neglist = NCP2NEGLIST(ncp);
-   negstate = NCP2NEGSTATE(ncp);
-   mtx_lock(>nl_lock);
-   if ((negstate->neg_flag & NEG_HOT) != 0) {
-   TAILQ_REMOVE(>nl_hotlist, ncp, nc_dst);
-   neglist->nl_hotnum--;
+   nl = NCP2NEGLIST(ncp);
+   ns = NCP2NEGSTATE(ncp);
+   mtx_lock(>nl_lock);
+   if ((ns->neg_flag & NEG_HOT) != 0) {
+   TAILQ_REMOVE(>nl_hotlist, ncp, nc_dst);
+   nl->nl_hotnum--;
} else {
-   TAILQ_REMOVE(>nl_list, ncp, nc_dst);
+   TAILQ_REMOVE(>nl_list, ncp, nc_dst);
}
-   mtx_unlock(>nl_lock);
+   mtx_unlock(>nl_lock);
atomic_subtract_long(, 1);
 }
 
 static struct neglist *
 cache_negative_shrink_select(void)
 {
-   struct neglist *neglist;
+   struct neglist *nl;
static u_int cycle;
u_int i;
 
cycle++;
for (i = 0; i < numneglists; i++) {
-   neglist = [(cycle + i) % numneglists];
-   if (TAILQ_FIRST(>nl_list) == NULL &&
-   TAILQ_FIRST(>nl_hotlist) == NULL)
+   nl = [(cycle + i) % numneglists];
+   if (TAILQ_FIRST(>nl_list) == NULL &&
+   TAILQ_FIRST(>nl_hotlist) == NULL)
continue;
-   mtx_lock(>nl_lock);
-   if (TAILQ_FIRST(>nl_list) != NULL ||
-   TAILQ_FIRST(>nl_hotlist) != NULL)
-   return (neglist);
-   mtx_unlock(>nl_lock);
+   mtx_lock(>nl_lock);
+   if (TAILQ_FIRST(>nl_list) != NULL ||
+   TAILQ_FIRST(>nl_hotlist) != NULL)
+   return (nl);
+   mtx_unlock(>nl_lock);
}
 
return (NULL);
@@ -887,8 +887,8 @@ static void
 cache_negative_zap_one(void)
 {
struct namecache *ncp, *ncp2;
-   struct neglist *neglist;
-   struct negstate *negstate;
+   struct neglist *nl;
+   struct negstate *ns;
struct mtx *dvlp;
struct mtx *blp;
 
@@ -898,26 +898,26 @@ cache_negative_zap_one(void)
return;
}
 
-   neglist = cache_negative_shrink_select();
+   nl = cache_negative_shrink_select();
mtx_unlock(_shrink_lock);
-   if (neglist == NULL) {
+   if (nl == NULL) 

svn commit: r366738 - in head/release: amd64 arm64

2020-10-15 Thread Glen Barber
Author: gjb
Date: Thu Oct 15 23:05:13 2020
New Revision: 366738
URL: https://svnweb.freebsd.org/changeset/base/366738

Log:
  Bump the ISO EFI partition size from 1024 to 2048, following r366732.
  
  Suggested by: imp
  Sponsored by: Rubicon Communications, LLC (netgate.com)

Modified:
  head/release/amd64/mkisoimages.sh
  head/release/arm64/mkisoimages.sh

Modified: head/release/amd64/mkisoimages.sh
==
--- head/release/amd64/mkisoimages.sh   Thu Oct 15 20:21:15 2020
(r366737)
+++ head/release/amd64/mkisoimages.sh   Thu Oct 15 23:05:13 2020
(r366738)
@@ -48,7 +48,7 @@ if [ "$1" = "-b" ]; then
# Make EFI system partition.
espfilename=$(mktemp /tmp/efiboot.XX)
# ESP file size in KB.
-   espsize="1024"
+   espsize="2048"
make_esp_file ${espfilename} ${espsize} ${BASEBITSDIR}/boot/loader.efi
bootable="$bootable -o bootimage=i386;${espfilename} -o no-emul-boot -o 
platformid=efi"
 

Modified: head/release/arm64/mkisoimages.sh
==
--- head/release/arm64/mkisoimages.sh   Thu Oct 15 20:21:15 2020
(r366737)
+++ head/release/arm64/mkisoimages.sh   Thu Oct 15 23:05:13 2020
(r366738)
@@ -42,7 +42,7 @@ if [ "$1" = "-b" ]; then
# Make an EFI system partition.
espfilename=$(mktemp /tmp/efiboot.XX)
# ESP file size in KB.
-   espsize="1024"
+   espsize="2048"
make_esp_file ${espfilename} ${espsize} ${BASEBITSDIR}/boot/loader.efi
 
bootable="-o bootimage=efi;${espfilename} -o no-emul-boot -o 
platformid=efi"
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366737 - in head/sys: amd64/amd64 arm/arm arm64/arm64 riscv/riscv

2020-10-15 Thread Mitchell Horne
Author: mhorne
Date: Thu Oct 15 20:21:15 2020
New Revision: 366737
URL: https://svnweb.freebsd.org/changeset/base/366737

Log:
  Simplify preload_dump() condition
  
  Hiding this feature behind RB_VERBOSE is gratuitous. The tunable is enough
  to limit its use to only those who explicitly request it.
  
  Suggested by: kevans

Modified:
  head/sys/amd64/amd64/machdep.c
  head/sys/arm/arm/machdep.c
  head/sys/arm64/arm64/machdep.c
  head/sys/riscv/riscv/machdep.c

Modified: head/sys/amd64/amd64/machdep.c
==
--- head/sys/amd64/amd64/machdep.c  Thu Oct 15 18:03:14 2020
(r366736)
+++ head/sys/amd64/amd64/machdep.c  Thu Oct 15 20:21:15 2020
(r366737)
@@ -1859,8 +1859,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree)
 * output is required. If it's grossly incorrect the kernel will never
 * make it this far.
 */
-   if ((boothowto & RB_VERBOSE) &&
-   getenv_is_true("debug.dump_modinfo_at_boot"))
+   if (getenv_is_true("debug.dump_modinfo_at_boot"))
preload_dump();
 
 #ifdef DEV_ISA

Modified: head/sys/arm/arm/machdep.c
==
--- head/sys/arm/arm/machdep.c  Thu Oct 15 18:03:14 2020(r366736)
+++ head/sys/arm/arm/machdep.c  Thu Oct 15 20:21:15 2020(r366737)
@@ -1032,8 +1032,7 @@ initarm(struct arm_boot_params *abp)
 * output is required. If it's grossly incorrect the kernel will never
 * make it this far.
 */
-   if ((boothowto & RB_VERBOSE) &&
-   getenv_is_true("debug.dump_modinfo_at_boot"))
+   if (getenv_is_true("debug.dump_modinfo_at_boot"))
preload_dump();
 
env = kern_getenv("kernelname");

Modified: head/sys/arm64/arm64/machdep.c
==
--- head/sys/arm64/arm64/machdep.c  Thu Oct 15 18:03:14 2020
(r366736)
+++ head/sys/arm64/arm64/machdep.c  Thu Oct 15 20:21:15 2020
(r366737)
@@ -1247,8 +1247,7 @@ initarm(struct arm64_bootparams *abp)
 * output is required. If it's grossly incorrect the kernel will never
 * make it this far.
 */
-   if ((boothowto & RB_VERBOSE) &&
-   getenv_is_true("debug.dump_modinfo_at_boot"))
+   if (getenv_is_true("debug.dump_modinfo_at_boot"))
preload_dump();
 
init_proc0(abp->kern_stack);

Modified: head/sys/riscv/riscv/machdep.c
==
--- head/sys/riscv/riscv/machdep.c  Thu Oct 15 18:03:14 2020
(r366736)
+++ head/sys/riscv/riscv/machdep.c  Thu Oct 15 20:21:15 2020
(r366737)
@@ -954,8 +954,7 @@ initriscv(struct riscv_bootparams *rvbp)
 * output is required. If it's grossly incorrect the kernel will never
 * make it this far.
 */
-   if ((boothowto & RB_VERBOSE) &&
-   getenv_is_true("debug.dump_modinfo_at_boot"))
+   if (getenv_is_true("debug.dump_modinfo_at_boot"))
preload_dump();
 
init_proc0(rvbp->kern_stack);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r366732 - in head/release: amd64 arm64

2020-10-15 Thread Warner Losh
And on a related note, I can make it so we can build w/o ZSTD in the CD
boot loader because it's not needed there. I'd rather not, but if the 800k
limit is a real thing in relevant places, we have that as an option.

Warner

On Thu, Oct 15, 2020 at 1:34 PM Warner Losh  wrote:

> I'd recommend bumping this to 2MB or larger.
>
> This most likely is from the zstd landing which pushed arm64's size over
> the 1MB limit in memory, so it's only a matter of time before the file
> grows past 1MB in size.
>
> Warner
>
> On Thu, Oct 15, 2020 at 11:13 AM Glen Barber  wrote:
>
>> Author: gjb
>> Date: Thu Oct 15 17:12:58 2020
>> New Revision: 366732
>> URL: https://svnweb.freebsd.org/changeset/base/366732
>>
>> Log:
>>   Increase the amd64 ISO ESP file size from 800KB to 1024KB.
>>
>>   At some poing over the last week, the bootx64.efi file has grown
>>   past the 800KB threshold, resulting in being unable to copy it to
>>   the EFI/BOOT directory.
>>
>># stat -f %z efiboot.znWo7m
>>819200
>># stat -f %z stand-test.PIEugN/EFI/BOOT/bootx64.efi
>>842752
>>
>>   The comment in the script that creates the ISOs suggests that 800KB
>>   is the maximum allowed for the boot code, however I was able to
>>   boot an ISO with a 1024KB boot partition.  Additionally, I verified
>>   against an ISO from OtherOS, where the boot EFI partition is 2.4MB.
>>
>>   Sponsored by: Rubicon Communications, LLC (netgate.com)
>>
>> Modified:
>>   head/release/amd64/mkisoimages.sh
>>   head/release/arm64/mkisoimages.sh
>>
>> Modified: head/release/amd64/mkisoimages.sh
>>
>> ==
>> --- head/release/amd64/mkisoimages.sh   Thu Oct 15 17:05:21 2020
>> (r366731)
>> +++ head/release/amd64/mkisoimages.sh   Thu Oct 15 17:12:58 2020
>> (r366732)
>> @@ -46,10 +46,10 @@ if [ "$1" = "-b" ]; then
>> bootable="-o bootimage=i386;$BASEBITSDIR/boot/cdboot -o
>> no-emul-boot"
>>
>> # Make EFI system partition.
>> -   # The ISO file is a special case, in that it only has a maximum of
>> -   # 800 KB available for the boot code. So make an 800 KB ESP
>> espfilename=$(mktemp /tmp/efiboot.XX)
>> -   make_esp_file ${espfilename} 800 ${BASEBITSDIR}/boot/loader.efi
>> +   # ESP file size in KB.
>> +   espsize="1024"
>> +   make_esp_file ${espfilename} ${espsize}
>> ${BASEBITSDIR}/boot/loader.efi
>> bootable="$bootable -o bootimage=i386;${espfilename} -o
>> no-emul-boot -o platformid=efi"
>>
>> shift
>>
>> Modified: head/release/arm64/mkisoimages.sh
>>
>> ==
>> --- head/release/arm64/mkisoimages.sh   Thu Oct 15 17:05:21 2020
>> (r366731)
>> +++ head/release/arm64/mkisoimages.sh   Thu Oct 15 17:12:58 2020
>> (r366732)
>> @@ -40,10 +40,10 @@ if [ "$1" = "-b" ]; then
>> BASEBITSDIR="$4"
>>
>> # Make an EFI system partition.
>> -   # The ISO file is a special case, in that it only has a maximum of
>> -   # 800 KB available for the boot code. So make an 800 KB ESP
>> espfilename=$(mktemp /tmp/efiboot.XX)
>> -   make_esp_file ${espfilename} 800 ${BASEBITSDIR}/boot/loader.efi
>> +   # ESP file size in KB.
>> +   espsize="1024"
>> +   make_esp_file ${espfilename} ${espsize}
>> ${BASEBITSDIR}/boot/loader.efi
>>
>> bootable="-o bootimage=efi;${espfilename} -o no-emul-boot -o
>> platformid=efi"
>>
>>
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r366732 - in head/release: amd64 arm64

2020-10-15 Thread Warner Losh
I'd recommend bumping this to 2MB or larger.

This most likely is from the zstd landing which pushed arm64's size over
the 1MB limit in memory, so it's only a matter of time before the file
grows past 1MB in size.

Warner

On Thu, Oct 15, 2020 at 11:13 AM Glen Barber  wrote:

> Author: gjb
> Date: Thu Oct 15 17:12:58 2020
> New Revision: 366732
> URL: https://svnweb.freebsd.org/changeset/base/366732
>
> Log:
>   Increase the amd64 ISO ESP file size from 800KB to 1024KB.
>
>   At some poing over the last week, the bootx64.efi file has grown
>   past the 800KB threshold, resulting in being unable to copy it to
>   the EFI/BOOT directory.
>
># stat -f %z efiboot.znWo7m
>819200
># stat -f %z stand-test.PIEugN/EFI/BOOT/bootx64.efi
>842752
>
>   The comment in the script that creates the ISOs suggests that 800KB
>   is the maximum allowed for the boot code, however I was able to
>   boot an ISO with a 1024KB boot partition.  Additionally, I verified
>   against an ISO from OtherOS, where the boot EFI partition is 2.4MB.
>
>   Sponsored by: Rubicon Communications, LLC (netgate.com)
>
> Modified:
>   head/release/amd64/mkisoimages.sh
>   head/release/arm64/mkisoimages.sh
>
> Modified: head/release/amd64/mkisoimages.sh
>
> ==
> --- head/release/amd64/mkisoimages.sh   Thu Oct 15 17:05:21 2020
> (r366731)
> +++ head/release/amd64/mkisoimages.sh   Thu Oct 15 17:12:58 2020
> (r366732)
> @@ -46,10 +46,10 @@ if [ "$1" = "-b" ]; then
> bootable="-o bootimage=i386;$BASEBITSDIR/boot/cdboot -o
> no-emul-boot"
>
> # Make EFI system partition.
> -   # The ISO file is a special case, in that it only has a maximum of
> -   # 800 KB available for the boot code. So make an 800 KB ESP
> espfilename=$(mktemp /tmp/efiboot.XX)
> -   make_esp_file ${espfilename} 800 ${BASEBITSDIR}/boot/loader.efi
> +   # ESP file size in KB.
> +   espsize="1024"
> +   make_esp_file ${espfilename} ${espsize}
> ${BASEBITSDIR}/boot/loader.efi
> bootable="$bootable -o bootimage=i386;${espfilename} -o
> no-emul-boot -o platformid=efi"
>
> shift
>
> Modified: head/release/arm64/mkisoimages.sh
>
> ==
> --- head/release/arm64/mkisoimages.sh   Thu Oct 15 17:05:21 2020
> (r366731)
> +++ head/release/arm64/mkisoimages.sh   Thu Oct 15 17:12:58 2020
> (r366732)
> @@ -40,10 +40,10 @@ if [ "$1" = "-b" ]; then
> BASEBITSDIR="$4"
>
> # Make an EFI system partition.
> -   # The ISO file is a special case, in that it only has a maximum of
> -   # 800 KB available for the boot code. So make an 800 KB ESP
> espfilename=$(mktemp /tmp/efiboot.XX)
> -   make_esp_file ${espfilename} 800 ${BASEBITSDIR}/boot/loader.efi
> +   # ESP file size in KB.
> +   espsize="1024"
> +   make_esp_file ${espfilename} ${espsize}
> ${BASEBITSDIR}/boot/loader.efi
>
> bootable="-o bootimage=efi;${espfilename} -o no-emul-boot -o
> platformid=efi"
>
>
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366736 - head/usr.sbin/kldxref

2020-10-15 Thread Jessica Clarke
Author: jrtc27
Date: Thu Oct 15 18:03:14 2020
New Revision: 366736
URL: https://svnweb.freebsd.org/changeset/base/366736

Log:
  kldxref: Avoid buffer overflows in parse_pnp_list
  
  We convert a string like "W32:vendor/device" into "I:vendor;I:device",
  where the output is longer than the input, but only allocate space equal
  to the length of the input, leading to a buffer overflow.
  
  Instead use open_memstream so we get a safe dynamically-grown buffer.
  
  Found by: CHERI
  Reviewed by:  imp, jhb (mentor)
  Approved by:  imp, jhb (mentor)
  Obtained from:CheriBSD
  Differential Revision:https://reviews.freebsd.org/D26637

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

Modified: head/usr.sbin/kldxref/kldxref.c
==
--- head/usr.sbin/kldxref/kldxref.c Thu Oct 15 17:44:17 2020
(r366735)
+++ head/usr.sbin/kldxref/kldxref.c Thu Oct 15 18:03:14 2020
(r366736)
@@ -235,14 +235,17 @@ parse_pnp_list(const char *desc, char **new_desc, pnp_
const char *walker, *ep;
const char *colon, *semi;
struct pnp_elt *elt;
-   char *nd;
char type[8], key[32];
int off;
+   size_t new_desc_size;
+   FILE *fp;
 
walker = desc;
ep = desc + strlen(desc);
off = 0;
-   nd = *new_desc = malloc(strlen(desc) + 1);
+   fp = open_memstream(new_desc, _desc_size);
+   if (fp == NULL)
+   err(1, "Could not open new memory stream");
if (verbose > 1)
printf("Converting %s into a list\n", desc);
while (walker < ep) {
@@ -336,42 +339,44 @@ parse_pnp_list(const char *desc, char **new_desc, pnp_
off = elt->pe_offset + sizeof(void *);
}
if (elt->pe_kind & TYPE_PAIRED) {
-   char *word, *ctx;
+   char *word, *ctx, newtype;
 
for (word = strtok_r(key, "/", );
 word; word = strtok_r(NULL, "/", )) {
-   sprintf(nd, "%c:%s;", elt->pe_kind & 
TYPE_FLAGGED ? 'J' : 'I',
-   word);
-   nd += strlen(nd);
+   newtype = elt->pe_kind & TYPE_FLAGGED ? 'J' : 
'I';
+   fprintf(fp, "%c:%s;", newtype, word);
}
-   
}
else {
+   char newtype;
+
if (elt->pe_kind & TYPE_FLAGGED)
-   *nd++ = 'J';
+   newtype = 'J';
else if (elt->pe_kind & TYPE_GE)
-   *nd++ = 'G';
+   newtype = 'G';
else if (elt->pe_kind & TYPE_LE)
-   *nd++ = 'L';
+   newtype = 'L';
else if (elt->pe_kind & TYPE_MASK)
-   *nd++ = 'M';
+   newtype = 'M';
else if (elt->pe_kind & TYPE_INT)
-   *nd++ = 'I';
+   newtype = 'I';
else if (elt->pe_kind == TYPE_D)
-   *nd++ = 'D';
+   newtype = 'D';
else if (elt->pe_kind == TYPE_Z || elt->pe_kind == 
TYPE_E)
-   *nd++ = 'Z';
+   newtype = 'Z';
else if (elt->pe_kind == TYPE_T)
-   *nd++ = 'T';
+   newtype = 'T';
else
errx(1, "Impossible type %x\n", elt->pe_kind);
-   *nd++ = ':';
-   strcpy(nd, key);
-   nd += strlen(nd);
-   *nd++ = ';';
+   fprintf(fp, "%c:%s;", newtype, key);
}
}
-   *nd++ = '\0';
+   if (ferror(fp) != 0) {
+   fclose(fp);
+   errx(1, "Exhausted space converting description %s", desc);
+   }
+   if (fclose(fp) != 0)
+   errx(1, "Failed to close memory stream");
return (0);
 err:
errx(1, "Parse error of description string %s", desc);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366735 - head/sys/kern

2020-10-15 Thread Mateusz Guzik
Author: mjg
Date: Thu Oct 15 17:44:17 2020
New Revision: 366735
URL: https://svnweb.freebsd.org/changeset/base/366735

Log:
  cache: split hotlist between existing negative lists
  
  This simplifies the code while allowing for concurrent negative eviction
  down the road.
  
  Cache misses increased slightly due to higher rate of evictions allowed by
  the change.
  
  The current algorithm remains too aggressive.

Modified:
  head/sys/kern/vfs_cache.c

Modified: head/sys/kern/vfs_cache.c
==
--- head/sys/kern/vfs_cache.c   Thu Oct 15 17:42:22 2020(r366734)
+++ head/sys/kern/vfs_cache.c   Thu Oct 15 17:44:17 2020(r366735)
@@ -311,11 +311,11 @@ static struct mtx __exclusive_cache_line  ncneg_shrink_
 struct neglist {
struct mtx  nl_lock;
TAILQ_HEAD(, namecache) nl_list;
+   TAILQ_HEAD(, namecache) nl_hotlist;
+   u_long  nl_hotnum;
 } __aligned(CACHE_LINE_SIZE);
 
 static struct neglist neglists[numneglists];
-static struct neglist ncneg_hot;
-static u_long numhotneg;
 
 static inline struct neglist *
 NCP2NEGLIST(struct namecache *ncp)
@@ -471,7 +471,6 @@ static long zap_and_exit_bucket_fail2; STATNODE_ULONG(
 static long cache_lock_vnodes_cel_3_failures;
 STATNODE_ULONG(cache_lock_vnodes_cel_3_failures,
 "Number of times 3-way vnode locking failed");
-STATNODE_ULONG(numhotneg, "Number of hot negative entries");
 STATNODE_COUNTER(numneg_evicted,
 "Number of negative entries evicted when adding a new entry");
 STATNODE_COUNTER(shrinking_skipped,
@@ -682,6 +681,21 @@ SYSCTL_PROC(_vfs_cache, OID_AUTO, nchstats, CTLTYPE_OP
 CTLFLAG_MPSAFE, 0, 0, sysctl_nchstats, "LU",
 "VFS cache effectiveness statistics");
 
+static int
+sysctl_hotnum(SYSCTL_HANDLER_ARGS)
+{
+   int i, out;
+
+   out = 0;
+   for (i = 0; i < numneglists; i++)
+   out += neglists[i].nl_hotnum;
+
+   return (SYSCTL_OUT(req, , sizeof(out)));
+}
+SYSCTL_PROC(_vfs_cache, OID_AUTO, hotnum, CTLTYPE_INT | CTLFLAG_RD |
+CTLFLAG_MPSAFE, 0, 0, sysctl_hotnum, "I",
+"Number of hot negative entries");
+
 #ifdef DIAGNOSTIC
 /*
  * Grab an atomic snapshot of the name cache hash chain lengths
@@ -802,16 +816,14 @@ cache_negative_hit(struct namecache *ncp)
if ((negstate->neg_flag & NEG_HOT) != 0)
return;
neglist = NCP2NEGLIST(ncp);
-   mtx_lock(_hot.nl_lock);
mtx_lock(>nl_lock);
if ((negstate->neg_flag & NEG_HOT) == 0) {
-   numhotneg++;
TAILQ_REMOVE(>nl_list, ncp, nc_dst);
-   TAILQ_INSERT_TAIL(_hot.nl_list, ncp, nc_dst);
+   TAILQ_INSERT_TAIL(>nl_hotlist, ncp, nc_dst);
+   neglist->nl_hotnum++;
negstate->neg_flag |= NEG_HOT;
}
mtx_unlock(>nl_lock);
-   mtx_unlock(_hot.nl_lock);
 }
 
 static void
@@ -833,72 +845,42 @@ cache_negative_remove(struct namecache *ncp)
 {
struct neglist *neglist;
struct negstate *negstate;
-   bool hot_locked = false;
-   bool list_locked = false;
 
cache_assert_bucket_locked(ncp);
neglist = NCP2NEGLIST(ncp);
negstate = NCP2NEGSTATE(ncp);
+   mtx_lock(>nl_lock);
if ((negstate->neg_flag & NEG_HOT) != 0) {
-   hot_locked = true;
-   mtx_lock(_hot.nl_lock);
-   if ((negstate->neg_flag & NEG_HOT) == 0) {
-   list_locked = true;
-   mtx_lock(>nl_lock);
-   }
+   TAILQ_REMOVE(>nl_hotlist, ncp, nc_dst);
+   neglist->nl_hotnum--;
} else {
-   list_locked = true;
-   mtx_lock(>nl_lock);
-   /*
-* We may be racing against promotion in lockless lookup.
-*/
-   if ((negstate->neg_flag & NEG_HOT) != 0) {
-   mtx_unlock(>nl_lock);
-   hot_locked = true;
-   mtx_lock(_hot.nl_lock);
-   mtx_lock(>nl_lock);
-   }
-   }
-   if ((negstate->neg_flag & NEG_HOT) != 0) {
-   mtx_assert(_hot.nl_lock, MA_OWNED);
-   TAILQ_REMOVE(_hot.nl_list, ncp, nc_dst);
-   numhotneg--;
-   } else {
-   mtx_assert(>nl_lock, MA_OWNED);
TAILQ_REMOVE(>nl_list, ncp, nc_dst);
}
-   if (list_locked)
-   mtx_unlock(>nl_lock);
-   if (hot_locked)
-   mtx_unlock(_hot.nl_lock);
+   mtx_unlock(>nl_lock);
atomic_subtract_long(, 1);
 }
 
-static void
-cache_negative_shrink_select(struct namecache **ncpp,
-struct neglist **neglistpp)
+static struct neglist *
+cache_negative_shrink_select(void)
 {
struct neglist *neglist;
-   struct namecache *ncp;
static u_int cycle;
u_int i;
 
-   *ncpp = ncp = NULL;
-
+   cycle++;
for (i = 

svn commit: r366734 - head/sys/kern

2020-10-15 Thread Mateusz Guzik
Author: mjg
Date: Thu Oct 15 17:42:22 2020
New Revision: 366734
URL: https://svnweb.freebsd.org/changeset/base/366734

Log:
  cache: make neglist an array given the static size

Modified:
  head/sys/kern/vfs_cache.c

Modified: head/sys/kern/vfs_cache.c
==
--- head/sys/kern/vfs_cache.c   Thu Oct 15 17:40:02 2020(r366733)
+++ head/sys/kern/vfs_cache.c   Thu Oct 15 17:42:22 2020(r366734)
@@ -305,17 +305,18 @@ SYSCTL_BOOL(_vfs, OID_AUTO, cache_fast_revlookup, CTLF
 
 static struct mtx __exclusive_cache_line   ncneg_shrink_lock;
 
+#define ncneghash  3
+#definenumneglists (ncneghash + 1)
+
 struct neglist {
struct mtx  nl_lock;
TAILQ_HEAD(, namecache) nl_list;
 } __aligned(CACHE_LINE_SIZE);
 
-static struct neglist __read_mostly*neglists;
+static struct neglist neglists[numneglists];
 static struct neglist ncneg_hot;
 static u_long numhotneg;
 
-#define ncneghash  3
-#definenumneglists (ncneghash + 1)
 static inline struct neglist *
 NCP2NEGLIST(struct namecache *ncp)
 {
@@ -2091,8 +2092,6 @@ nchinit(void *dummy __unused)
for (i = 0; i < numvnodelocks; i++)
mtx_init([i], "ncvn", NULL, MTX_DUPOK | MTX_RECURSE);
 
-   neglists = malloc(sizeof(*neglists) * numneglists, M_VFSCACHE,
-   M_WAITOK | M_ZERO);
for (i = 0; i < numneglists; i++) {
mtx_init([i].nl_lock, "ncnegl", NULL, MTX_DEF);
TAILQ_INIT([i].nl_list);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366733 - head/sys/dev/sound/pci/hda

2020-10-15 Thread Alexander Motin
Author: mav
Date: Thu Oct 15 17:40:02 2020
New Revision: 366733
URL: https://svnweb.freebsd.org/changeset/base/366733

Log:
  Drop unsolicited responses to the still attaching CODECs.
  
  It is reported to fix kernel panics when early unsolicited responses
  delivered to the CODEC device not having driver attached yet.
  
  PR:   250248
  Reported by:  Rajeev Pillai 
  Reviewed by:  avg
  MFC after:2 weeks

Modified:
  head/sys/dev/sound/pci/hda/hdac.c

Modified: head/sys/dev/sound/pci/hda/hdac.c
==
--- head/sys/dev/sound/pci/hda/hdac.c   Thu Oct 15 17:12:58 2020
(r366732)
+++ head/sys/dev/sound/pci/hda/hdac.c   Thu Oct 15 17:40:02 2020
(r366733)
@@ -990,7 +990,8 @@ hdac_unsolq_flush(struct hdac_softc *sc)
sc->unsolq_rp %= HDAC_UNSOLQ_MAX;
cad = sc->unsolq[sc->unsolq_rp++];
sc->unsolq_rp %= HDAC_UNSOLQ_MAX;
-   if ((child = sc->codecs[cad].dev) != NULL)
+   if ((child = sc->codecs[cad].dev) != NULL &&
+   device_is_attached(child))
HDAC_UNSOL_INTR(child, resp);
ret++;
}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366732 - in head/release: amd64 arm64

2020-10-15 Thread Glen Barber
Author: gjb
Date: Thu Oct 15 17:12:58 2020
New Revision: 366732
URL: https://svnweb.freebsd.org/changeset/base/366732

Log:
  Increase the amd64 ISO ESP file size from 800KB to 1024KB.
  
  At some poing over the last week, the bootx64.efi file has grown
  past the 800KB threshold, resulting in being unable to copy it to
  the EFI/BOOT directory.
  
   # stat -f %z efiboot.znWo7m
   819200
   # stat -f %z stand-test.PIEugN/EFI/BOOT/bootx64.efi
   842752
  
  The comment in the script that creates the ISOs suggests that 800KB
  is the maximum allowed for the boot code, however I was able to
  boot an ISO with a 1024KB boot partition.  Additionally, I verified
  against an ISO from OtherOS, where the boot EFI partition is 2.4MB.
  
  Sponsored by: Rubicon Communications, LLC (netgate.com)

Modified:
  head/release/amd64/mkisoimages.sh
  head/release/arm64/mkisoimages.sh

Modified: head/release/amd64/mkisoimages.sh
==
--- head/release/amd64/mkisoimages.sh   Thu Oct 15 17:05:21 2020
(r366731)
+++ head/release/amd64/mkisoimages.sh   Thu Oct 15 17:12:58 2020
(r366732)
@@ -46,10 +46,10 @@ if [ "$1" = "-b" ]; then
bootable="-o bootimage=i386;$BASEBITSDIR/boot/cdboot -o no-emul-boot"
 
# Make EFI system partition.
-   # The ISO file is a special case, in that it only has a maximum of
-   # 800 KB available for the boot code. So make an 800 KB ESP
espfilename=$(mktemp /tmp/efiboot.XX)
-   make_esp_file ${espfilename} 800 ${BASEBITSDIR}/boot/loader.efi
+   # ESP file size in KB.
+   espsize="1024"
+   make_esp_file ${espfilename} ${espsize} ${BASEBITSDIR}/boot/loader.efi
bootable="$bootable -o bootimage=i386;${espfilename} -o no-emul-boot -o 
platformid=efi"
 
shift

Modified: head/release/arm64/mkisoimages.sh
==
--- head/release/arm64/mkisoimages.sh   Thu Oct 15 17:05:21 2020
(r366731)
+++ head/release/arm64/mkisoimages.sh   Thu Oct 15 17:12:58 2020
(r366732)
@@ -40,10 +40,10 @@ if [ "$1" = "-b" ]; then
BASEBITSDIR="$4"
 
# Make an EFI system partition.
-   # The ISO file is a special case, in that it only has a maximum of
-   # 800 KB available for the boot code. So make an 800 KB ESP
espfilename=$(mktemp /tmp/efiboot.XX)
-   make_esp_file ${espfilename} 800 ${BASEBITSDIR}/boot/loader.efi
+   # ESP file size in KB.
+   espsize="1024"
+   make_esp_file ${espfilename} ${espsize} ${BASEBITSDIR}/boot/loader.efi
 
bootable="-o bootimage=efi;${espfilename} -o no-emul-boot -o 
platformid=efi"
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366731 - head/sys/kern

2020-10-15 Thread Brooks Davis
Author: brooks
Date: Thu Oct 15 17:05:21 2020
New Revision: 366731
URL: https://svnweb.freebsd.org/changeset/base/366731

Log:
  physio: Don't store user addresses in bio_data
  
  Only assign the address from the iovec to bio_data if it is a kernel
  address.  This was the single place where bio_data stored (however
  briefly) a userspace pointer.
  
  Reviewed by:  imp, markj
  Obtained from:CheriBSD
  MFC after:1 week
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D26783

Modified:
  head/sys/kern/kern_physio.c

Modified: head/sys/kern/kern_physio.c
==
--- head/sys/kern/kern_physio.c Thu Oct 15 15:36:08 2020(r366730)
+++ head/sys/kern/kern_physio.c Thu Oct 15 17:05:21 2020(r366731)
@@ -45,7 +45,7 @@ physio(struct cdev *dev, struct uio *uio, int ioflag)
struct buf *pbuf;
struct bio *bp;
struct vm_page **pages;
-   caddr_t sa;
+   char *base, *sa;
u_int iolen, poff;
int error, i, npages, maxpages;
vm_prot_t prot;
@@ -140,7 +140,7 @@ physio(struct cdev *dev, struct uio *uio, int ioflag)
curthread->td_ru.ru_oublock++;
}
bp->bio_offset = uio->uio_offset;
-   bp->bio_data = uio->uio_iov[i].iov_base;
+   base = uio->uio_iov[i].iov_base;
bp->bio_length = uio->uio_iov[i].iov_len;
if (bp->bio_length > dev->si_iosize_max)
bp->bio_length = dev->si_iosize_max;
@@ -153,13 +153,13 @@ physio(struct cdev *dev, struct uio *uio, int ioflag)
 * larger than MAXPHYS - PAGE_SIZE must be
 * page aligned or it will be fragmented.
 */
-   poff = (vm_offset_t)bp->bio_data & PAGE_MASK;
+   poff = (vm_offset_t)base & PAGE_MASK;
if (pbuf && bp->bio_length + poff > pbuf->b_kvasize) {
if (dev->si_flags & SI_NOSPLIT) {
uprintf("%s: request ptr %p is not "
"on a page boundary; cannot split "
"request\n", devtoname(dev),
-   bp->bio_data);
+   base);
error = EFBIG;
goto doerror;
}
@@ -174,7 +174,7 @@ physio(struct cdev *dev, struct uio *uio, int ioflag)
if (pages) {
if ((npages = vm_fault_quick_hold_pages(
>p_vmspace->vm_map,
-   (vm_offset_t)bp->bio_data, bp->bio_length,
+   (vm_offset_t)base, bp->bio_length,
prot, pages, maxpages)) < 0) {
error = EFAULT;
goto doerror;
@@ -190,7 +190,8 @@ physio(struct cdev *dev, struct uio *uio, int ioflag)
bp->bio_data = unmapped_buf;
bp->bio_flags |= BIO_UNMAPPED;
}
-   }
+   } else
+   bp->bio_data = base;
 
csw->d_strategy(bp);
if (uio->uio_rw == UIO_READ)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366730 - head/sbin/nvmecontrol

2020-10-15 Thread Alexander Motin
Author: mav
Date: Thu Oct 15 15:36:08 2020
New Revision: 366730
URL: https://svnweb.freebsd.org/changeset/base/366730

Log:
  Fix nvmecontrol logpage -i parameter.
  
  MFC after:3 days

Modified:
  head/sbin/nvmecontrol/logpage.c

Modified: head/sbin/nvmecontrol/logpage.c
==
--- head/sbin/nvmecontrol/logpage.c Thu Oct 15 15:07:25 2020
(r366729)
+++ head/sbin/nvmecontrol/logpage.c Thu Oct 15 15:36:08 2020
(r366730)
@@ -84,7 +84,7 @@ static const struct opts logpage_opts[] = {
"Page to dump"),
OPT("lsp", 'f', arg_uint8, opt, lsp,
"Log Specific Field"),
-   OPT("lsi", 'i', arg_uint16, opt, lsp,
+   OPT("lsi", 'i', arg_uint16, opt, lsi,
"Log Specific Identifier"),
OPT("rae", 'r', arg_none, opt, rae,
"Retain Asynchronous Event"),
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366728 - head/sbin/pfctl/tests

2020-10-15 Thread Adrian Chadd
Author: adrian
Date: Thu Oct 15 14:56:51 2020
New Revision: 366728
URL: https://svnweb.freebsd.org/changeset/base/366728

Log:
  [pfctl_tests] Add missing void to empty function declaration
  
  Our gcc-6.4 flags require non-empty function declarations.
  Fix this to match the rest of the codebase.
  
  Tested:
  
  * compiled on gcc-6.4 for amd64
  
  Reviewed by:  imp
  Differential Revision:https://reviews.freebsd.org/D26795

Modified:
  head/sbin/pfctl/tests/pfctl_test.c

Modified: head/sbin/pfctl/tests/pfctl_test.c
==
--- head/sbin/pfctl/tests/pfctl_test.c  Thu Oct 15 14:55:07 2020
(r366727)
+++ head/sbin/pfctl/tests/pfctl_test.c  Thu Oct 15 14:56:51 2020
(r366728)
@@ -68,7 +68,7 @@ __FBSDID("$FreeBSD$");
  */
 
 static bool
-check_pf_module_available()
+check_pf_module_available(void)
 {
int modid;
struct module_stat stat;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366727 - head/contrib/netbsd-tests/lib/libc/sys

2020-10-15 Thread Adrian Chadd
Author: adrian
Date: Thu Oct 15 14:55:07 2020
New Revision: 366727
URL: https://svnweb.freebsd.org/changeset/base/366727

Log:
  [tests] Fix itimer test warning-errors on gcc-6.4
  
  This fixes a "suggested parens" compile warning-into-error
  that shows up on gcc-6.4.
  
  Reviewed by:  ngie
  Differential Revision:https://reviews.freebsd.org/D26789

Modified:
  head/contrib/netbsd-tests/lib/libc/sys/t_getitimer.c

Modified: head/contrib/netbsd-tests/lib/libc/sys/t_getitimer.c
==
--- head/contrib/netbsd-tests/lib/libc/sys/t_getitimer.cThu Oct 15 
14:37:51 2020(r366726)
+++ head/contrib/netbsd-tests/lib/libc/sys/t_getitimer.cThu Oct 15 
14:55:07 2020(r366727)
@@ -195,8 +195,8 @@ ATF_TC_BODY(setitimer_old, tc)
ATF_REQUIRE(setitimer(ITIMER_REAL, , ) == 0);
 
 #ifdef __FreeBSD__
-   ATF_REQUIRE_MSG(ot.it_value.tv_sec < 4 ||
-   ot.it_value.tv_sec == 4 && ot.it_value.tv_usec <= 3,
+   ATF_REQUIRE_MSG((ot.it_value.tv_sec < 4) ||
+   (ot.it_value.tv_sec == 4 && ot.it_value.tv_usec <= 3),
"setitimer(2) returned invalid it_value: %jd %jd",
(intmax_t)ot.it_value.tv_sec, (intmax_t)ot.it_value.tv_usec);
 #else
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r366725 - head/lib/geom/eli

2020-10-15 Thread Gordon Bergling
Hi Mateusz,

On Thu, Oct 15, 2020 at 02:17:45PM +, Mateusz Piotrowski wrote:
> Author: 0mp (doc,ports committer)
> Date: Thu Oct 15 14:17:45 2020
> New Revision: 366725
> URL: https://svnweb.freebsd.org/changeset/base/366725
> 
> Log:
>   Fix formatting of SYNOPSIS
>   
>   There was an unnecessary newline being added before Nm.
>   
>   MFC after:  3 days
> 
> Modified:
>   head/lib/geom/eli/geli.8
> 
> Modified: head/lib/geom/eli/geli.8
> ==
> --- head/lib/geom/eli/geli.8  Thu Oct 15 13:47:52 2020(r366724)
> +++ head/lib/geom/eli/geli.8  Thu Oct 15 14:17:45 2020(r366725)
> @@ -24,7 +24,7 @@
>  .\"
>  .\" $FreeBSD$
>  .\"
> -.Dd July 22, 2020
> +.Dd October 15, 2020
>  .Dt GELI 8
>  .Os
>  .Sh NAME
> @@ -45,8 +45,7 @@ to your
>  geom_eli_load="YES"
>  .Ed
>  .Pp
> -Usage of the
> -.Nm
> +.No Usage of the Nm
>  utility:
>  .Pp
>  .Nm

The formatting of the SYNOPSIS was correct before this change. It's a common 
practice
in man pages to use

The
.Nm
utility
...

Your change is looking somewhat strange, since ".No Usage of the Nm" reads like 
the
man page would renders "Nm", since it is not used as macro.

A .Dd bump is also not necessary since no user visible changes were made to the 
man page.

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


svn commit: r366726 - head/sys/conf

2020-10-15 Thread Ed Maste
Author: emaste
Date: Thu Oct 15 14:37:51 2020
New Revision: 366726
URL: https://svnweb.freebsd.org/changeset/base/366726

Log:
  move vmware pv drivers to sys/conf/files
  
  VMware now has arm64 support; move these to MI files in advance of
  building them on arm64.
  
  PR:   250308
  Reported by:  Vincent Milum Jr
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/conf/files
  head/sys/conf/files.amd64
  head/sys/conf/files.i386

Modified: head/sys/conf/files
==
--- head/sys/conf/files Thu Oct 15 14:17:45 2020(r366725)
+++ head/sys/conf/files Thu Oct 15 14:37:51 2020(r366726)
@@ -3455,6 +3455,18 @@ dev/virtio/random/virtio_random.coptional
virtio_rand
 dev/virtio/console/virtio_console.coptionalvirtio_console
 dev/vkbd/vkbd.coptional vkbd
 dev/vmgenc/vmgenc_acpi.c   optional acpi
+dev/vmware/vmxnet3/if_vmx.coptional vmx
+dev/vmware/vmci/vmci.c optional vmci
+dev/vmware/vmci/vmci_datagram.coptional vmci
+dev/vmware/vmci/vmci_doorbell.coptional vmci
+dev/vmware/vmci/vmci_driver.c  optional vmci
+dev/vmware/vmci/vmci_event.c   optional vmci
+dev/vmware/vmci/vmci_hashtable.c   optional vmci
+dev/vmware/vmci/vmci_kernel_if.c   optional vmci
+dev/vmware/vmci/vmci_qpair.c   optional vmci
+dev/vmware/vmci/vmci_queue_pair.c  optional vmci
+dev/vmware/vmci/vmci_resource.coptional vmci
+dev/vmware/pvscsi/pvscsi.c optional pvscsi
 dev/vr/if_vr.c optional vr pci
 dev/vt/colors/vt_termcolors.c  optional vt
 dev/vt/font/vt_font_default.c  optional vt

Modified: head/sys/conf/files.amd64
==
--- head/sys/conf/files.amd64   Thu Oct 15 14:17:45 2020(r366725)
+++ head/sys/conf/files.amd64   Thu Oct 15 14:37:51 2020(r366726)
@@ -378,18 +378,6 @@ dev/tpm/tpm_acpi.c optionaltpm acpi
 dev/tpm/tpm_isa.c  optionaltpm isa
 dev/uart/uart_cpu_x86.coptionaluart
 dev/viawd/viawd.c  optionalviawd
-dev/vmware/vmxnet3/if_vmx.coptionalvmx
-dev/vmware/vmci/vmci.c optionalvmci
-dev/vmware/vmci/vmci_datagram.coptionalvmci
-dev/vmware/vmci/vmci_doorbell.coptionalvmci
-dev/vmware/vmci/vmci_driver.c  optionalvmci
-dev/vmware/vmci/vmci_event.c   optionalvmci
-dev/vmware/vmci/vmci_hashtable.c   optionalvmci
-dev/vmware/vmci/vmci_kernel_if.c   optionalvmci
-dev/vmware/vmci/vmci_qpair.c   optionalvmci
-dev/vmware/vmci/vmci_queue_pair.c  optionalvmci
-dev/vmware/vmci/vmci_resource.coptionalvmci
-dev/vmware/pvscsi/pvscsi.c optionalpvscsi
 dev/vmd/vmd.c  optionalvmd
 dev/vmd/vmd_bus.c  optionalvmd_bus
 dev/wbwd/wbwd.coptionalwbwd

Modified: head/sys/conf/files.i386
==
--- head/sys/conf/files.i386Thu Oct 15 14:17:45 2020(r366725)
+++ head/sys/conf/files.i386Thu Oct 15 14:37:51 2020(r366726)
@@ -126,18 +126,6 @@ dev/tpm/tpm_acpi.c optional tpm acpi
 dev/tpm/tpm_isa.c  optional tpm isa
 dev/uart/uart_cpu_x86.coptional uart
 dev/viawd/viawd.c  optional viawd
-dev/vmware/vmxnet3/if_vmx.coptional vmx
-dev/vmware/vmci/vmci.c optionalvmci
-dev/vmware/vmci/vmci_datagram.coptionalvmci
-dev/vmware/vmci/vmci_doorbell.coptionalvmci
-dev/vmware/vmci/vmci_driver.c  optionalvmci
-dev/vmware/vmci/vmci_event.c   optionalvmci
-dev/vmware/vmci/vmci_hashtable.c   optionalvmci
-dev/vmware/vmci/vmci_kernel_if.c   optionalvmci
-dev/vmware/vmci/vmci_qpair.c   optionalvmci
-dev/vmware/vmci/vmci_queue_pair.c  optionalvmci
-dev/vmware/vmci/vmci_resource.coptionalvmci
-dev/vmware/pvscsi/pvscsi.c optionalpvscsi
 dev/acpi_support/acpi_wmi_if.m standard
 dev/wbwd/wbwd.coptional wbwd
 i386/acpica/acpi_machdep.c optional acpi
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366725 - head/lib/geom/eli

2020-10-15 Thread Mateusz Piotrowski
Author: 0mp (doc,ports committer)
Date: Thu Oct 15 14:17:45 2020
New Revision: 366725
URL: https://svnweb.freebsd.org/changeset/base/366725

Log:
  Fix formatting of SYNOPSIS
  
  There was an unnecessary newline being added before Nm.
  
  MFC after:3 days

Modified:
  head/lib/geom/eli/geli.8

Modified: head/lib/geom/eli/geli.8
==
--- head/lib/geom/eli/geli.8Thu Oct 15 13:47:52 2020(r366724)
+++ head/lib/geom/eli/geli.8Thu Oct 15 14:17:45 2020(r366725)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 22, 2020
+.Dd October 15, 2020
 .Dt GELI 8
 .Os
 .Sh NAME
@@ -45,8 +45,7 @@ to your
 geom_eli_load="YES"
 .Ed
 .Pp
-Usage of the
-.Nm
+.No Usage of the Nm
 utility:
 .Pp
 .Nm
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366724 - head/sys/dev/iommu

2020-10-15 Thread Ruslan Bukin
Author: br
Date: Thu Oct 15 13:47:52 2020
New Revision: 366724
URL: https://svnweb.freebsd.org/changeset/base/366724

Log:
  Split-out Guest Address Space (GAS) macroses to a separate header.
  
  Sponsored by: Innovate DSbD

Added:
  head/sys/dev/iommu/iommu_gas.h   (contents, props changed)
Modified:
  head/sys/dev/iommu/busdma_iommu.h
  head/sys/dev/iommu/iommu.h
  head/sys/dev/iommu/iommu_gas.c

Modified: head/sys/dev/iommu/busdma_iommu.h
==
--- head/sys/dev/iommu/busdma_iommu.h   Thu Oct 15 13:43:43 2020
(r366723)
+++ head/sys/dev/iommu/busdma_iommu.h   Thu Oct 15 13:47:52 2020
(r366724)
@@ -35,6 +35,7 @@
 #define __X86_IOMMU_BUSDMA_DMAR_H
 
 #include 
+#include 
 
 struct bus_dma_tag_iommu {
struct bus_dma_tag_common common;

Modified: head/sys/dev/iommu/iommu.h
==
--- head/sys/dev/iommu/iommu.h  Thu Oct 15 13:43:43 2020(r366723)
+++ head/sys/dev/iommu/iommu.h  Thu Oct 15 13:47:52 2020(r366724)
@@ -65,18 +65,6 @@ struct iommu_map_entry {
struct iommu_qi_genseq gseq;
 };
 
-#defineIOMMU_MAP_ENTRY_PLACE   0x0001  /* Fake entry */
-#defineIOMMU_MAP_ENTRY_RMRR0x0002  /* Permanent, not linked by
-  dmamap_link */
-#defineIOMMU_MAP_ENTRY_MAP 0x0004  /* Busdma created, linked by
-  dmamap_link */
-#defineIOMMU_MAP_ENTRY_UNMAPPED0x0010  /* No backing pages */
-#defineIOMMU_MAP_ENTRY_QI_NF   0x0020  /* qi task, do not free entry */
-#defineIOMMU_MAP_ENTRY_READ0x1000  /* Read permitted */
-#defineIOMMU_MAP_ENTRY_WRITE   0x2000  /* Write permitted */
-#defineIOMMU_MAP_ENTRY_SNOOP   0x4000  /* Snoop */
-#defineIOMMU_MAP_ENTRY_TM  0x8000  /* Transient */
-
 struct iommu_unit {
struct mtx lock;
int unit;
@@ -148,17 +136,6 @@ struct iommu_ctx {
   page table */
 #defineIOMMU_DOMAIN_RMRR   0x0020  /* Domain contains RMRR 
entry,
   cannot be turned off */
-
-/* Map flags */
-#defineIOMMU_MF_CANWAIT0x0001
-#defineIOMMU_MF_CANSPLIT   0x0002
-#defineIOMMU_MF_RMRR   0x0004
-
-#defineIOMMU_PGF_WAITOK0x0001
-#defineIOMMU_PGF_ZERO  0x0002
-#defineIOMMU_PGF_ALLOC 0x0004
-#defineIOMMU_PGF_NOALLOC   0x0008
-#defineIOMMU_PGF_OBJL  0x0010
 
 #defineIOMMU_LOCK(unit)mtx_lock(&(unit)->lock)
 #defineIOMMU_UNLOCK(unit)  mtx_unlock(&(unit)->lock)

Modified: head/sys/dev/iommu/iommu_gas.c
==
--- head/sys/dev/iommu/iommu_gas.c  Thu Oct 15 13:43:43 2020
(r366723)
+++ head/sys/dev/iommu/iommu_gas.c  Thu Oct 15 13:47:52 2020
(r366724)
@@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 

Added: head/sys/dev/iommu/iommu_gas.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/iommu/iommu_gas.h  Thu Oct 15 13:47:52 2020
(r366724)
@@ -0,0 +1,60 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2013 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Konstantin Belousov 
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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 

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

2020-10-15 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Thu Oct 15 13:43:43 2020
New Revision: 366723
URL: https://svnweb.freebsd.org/changeset/base/366723

Log:
  Provide a slightly more-tolerant set of thermal parameters for PowerMac
  motherboard temperatures. In particular, the U4 northbridge die is very
  hard to cool or heat effectively with fans and is not responsive to load.
  It generally sits around 64C, where it seems happy, so (like Linux) just
  declare that to be its target temperature.
  
  This makes the PowerMac G5 much less loud, with no change in the
  temperatures of any system components.
  
  MFC after:2 weeks

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

Modified: head/sys/dev/iicbus/max6690.c
==
--- head/sys/dev/iicbus/max6690.c   Thu Oct 15 12:48:30 2020
(r366722)
+++ head/sys/dev/iicbus/max6690.c   Thu Oct 15 13:43:43 2020
(r366723)
@@ -213,8 +213,17 @@ max6690_fill_sensor_prop(device_t dev)
for (j = 0; j < i; j++) {
sc->sc_sensors[j].dev = dev;
 
-   sc->sc_sensors[j].therm.target_temp = 400 + ZERO_C_TO_K;
-   sc->sc_sensors[j].therm.max_temp = 800 + ZERO_C_TO_K;
+   /*
+* Target value for "KODIAK DIODE" (= northbridge die) should
+* be 64C (value from Linux). It operates fine at that
+* temperature and has limited responsivity to the fan aimed at
+* it, so no point in trying to cool it to 40C.
+*/
+   if (strcmp(sc->sc_sensors[j].therm.name, "KODIAK DIODE") == 0)
+   sc->sc_sensors[j].therm.target_temp = 640 + ZERO_C_TO_K;
+   else
+   sc->sc_sensors[j].therm.target_temp = 400 + ZERO_C_TO_K;
+   sc->sc_sensors[j].therm.max_temp = 850 + ZERO_C_TO_K;
 
sc->sc_sensors[j].therm.read =
(int (*)(struct pmac_therm *))(max6690_sensor_read);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366722 - head/sys/compat/linprocfs

2020-10-15 Thread Edward Tomasz Napierala
Author: trasz
Date: Thu Oct 15 12:48:30 2020
New Revision: 366722
URL: https://svnweb.freebsd.org/changeset/base/366722

Log:
  With some popular multiplayer games (such as Counter-Strike: Global
  Offensive) the Linux Steam client likes to occasionally scan the game
  process memory, presumably as part anti-cheat measures. Turns out
  the client also expects each inode entry to be followed by a space
  character, otherwise the parsing code crashes.
  
  PR:   248216
  Submitted by: Alex S 
  MFC after:2 weeks

Modified:
  head/sys/compat/linprocfs/linprocfs.c

Modified: head/sys/compat/linprocfs/linprocfs.c
==
--- head/sys/compat/linprocfs/linprocfs.c   Thu Oct 15 11:44:28 2020
(r366721)
+++ head/sys/compat/linprocfs/linprocfs.c   Thu Oct 15 12:48:30 2020
(r366722)
@@ -1249,7 +1249,7 @@ linprocfs_doprocmaps(PFS_FILL_ARGS)
0,
0,
(u_long)ino,
-   *name ? " " : "",
+   *name ? " " : " ",
name
);
if (freename)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366721 - head/sys/dev/hyperv/netvsc

2020-10-15 Thread Wei Hu
Author: whu
Date: Thu Oct 15 11:44:28 2020
New Revision: 366721
URL: https://svnweb.freebsd.org/changeset/base/366721

Log:
  Hyper-V: hn: Relinquish cpu in HN_LOCK to avoid deadlock
  
  The try lock loop in HN_LOCK put the thread spinning on cpu if the lock
  is not available. It is possible to cause deadlock if the thread holding
  the lock is sleeping. Relinquish the cpu to work around this problem even
  it doesn't completely solve the issue. The priority inversion could cause
  the livelock no matter how less likely it could happen. A more complete
  solution may be needed in the future.
  
  Reported by:  Microsoft, Netapp
  MFC after:2 weeks
  Sponsored by: Microsoft

Modified:
  head/sys/dev/hyperv/netvsc/if_hn.c

Modified: head/sys/dev/hyperv/netvsc/if_hn.c
==
--- head/sys/dev/hyperv/netvsc/if_hn.c  Thu Oct 15 05:57:20 2020
(r366720)
+++ head/sys/dev/hyperv/netvsc/if_hn.c  Thu Oct 15 11:44:28 2020
(r366721)
@@ -71,8 +71,10 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -165,8 +167,11 @@ __FBSDID("$FreeBSD$");
 #define HN_LOCK_ASSERT(sc) sx_assert(&(sc)->hn_lock, SA_XLOCKED)
 #define HN_LOCK(sc)\
 do {   \
-   while (sx_try_xlock(&(sc)->hn_lock) == 0)   \
+   while (sx_try_xlock(&(sc)->hn_lock) == 0) { \
+   /* Relinquish cpu to avoid deadlock */  \
+   sched_relinquish(curthread);\
DELAY(1000);\
+   }   \
 } while (0)
 #define HN_UNLOCK(sc)  sx_xunlock(&(sc)->hn_lock)
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r366697 - head/usr.bin/xinstall

2020-10-15 Thread Alexander Richardson
On Thu, 15 Oct 2020 at 06:59, Enji Cooper  wrote:
>
>
> > On Oct 14, 2020, at 5:28 AM, Alex Richardson  
> > wrote:
> >
> > Author: arichardson
> > Date: Wed Oct 14 12:28:41 2020
> > New Revision: 366697
> > URL: https://svnweb.freebsd.org/changeset/base/366697
> >
> > Log:
> >  install(1): Avoid unncessary fstatfs() calls and use mmap() based on size
> >
> >  According to git blame the trymmap() function was added in 1996 to skip
> >  mmap() calls for NFS file systems. However, nowadays mmap() should be
> >  perfectly safe even on NFS. Importantly, onl ufs and cd9660 file systems
> >  were whitelisted so we don't use mmap() on ZFS. It also prevents the use
> >  of mmap() when bootstrapping from macOS/Linux since on those systems the
> >  trymmap() function was always returning zero due to the missing MFSNAMELEN
> >  define.
> >
> >  This change keeps the trymmap() function but changes it to check whether
> >  using mmap() can reduce the number of system calls that are required.
> >  Using mmap() only reduces the number of system calls if we need multiple 
> > read()
> >  syscalls, i.e. if the file size is > MAXBSIZE. However, mmap() is more 
> > expensive
> >  than read() so this sets the threshold at 4 fewer syscalls. Additionally, 
> > for
> >  larger file size mmap() can significantly increase the number of page 
> > faults,
> >  so avoid it in that case.
> >
> >  It's unclear whether using mmap() is ever faster than a read with an 
> > appropriate
> >  buffer size, but this change at least removes two unnecessary system calls
> >  for every file that is installed.
> >
> >  Reviewed By: markj
> >  Differential Revision: https://reviews.freebsd.org/D26041
>
> * Has this change been tested out with source filesystems other than 
> UFS/ZFS? Not all filesystems support mmap(2).

I've used ext4 and afps, but it doesn't matter since there's a fallback.

> * trymmap(..) seems to be less about computing whether or not the 
> filesystem should use mmap(2) after this change, but how it should use 
> mmap(2). Seems like a misnamed function call now.
There was always fallback code in case mmap fails:
https://github.com/freebsd/freebsd/blob/8349de39d23fc152c3782ee3b9eeab3df4610944/usr.bin/xinstall/xinstall.c#L1253
and 
https://github.com/freebsd/freebsd/blob/8349de39d23fc152c3782ee3b9eeab3df4610944/usr.bin/xinstall/xinstall.c#L1253
so it is really "should I try to use mmap()".

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