svn commit: r344198 - in head/sys: conf dev/ata

2019-02-15 Thread Andriy Voskoboinyk
Author: avos
Date: Sat Feb 16 01:48:38 2019
New Revision: 344198
URL: https://svnweb.freebsd.org/changeset/base/344198

Log:
  GC ATA_REQUEST_TIMEOUT option remnants
  
  It was removed from code in r249083 and from sys/conf/options in r249213.
  
  PR:   222170
  MFC after:3 days

Modified:
  head/sys/conf/NOTES
  head/sys/dev/ata/ata-all.h

Modified: head/sys/conf/NOTES
==
--- head/sys/conf/NOTES Sat Feb 16 01:19:14 2019(r344197)
+++ head/sys/conf/NOTES Sat Feb 16 01:48:38 2019(r344198)
@@ -1760,14 +1760,6 @@ hint.ata.1.port="0x170"
 hint.ata.1.irq="15"
 
 #
-# The following options are valid on the ATA driver:
-#
-# ATA_REQUEST_TIMEOUT: the number of seconds to wait for an ATA request
-#  before timing out.
-
-#options   ATA_REQUEST_TIMEOUT=10
-
-#
 # Standard floppy disk controllers and floppy tapes, supports
 # the Y-E DATA External FDD (PC Card)
 #

Modified: head/sys/dev/ata/ata-all.h
==
--- head/sys/dev/ata/ata-all.h  Sat Feb 16 01:19:14 2019(r344197)
+++ head/sys/dev/ata/ata-all.h  Sat Feb 16 01:48:38 2019(r344198)
@@ -203,10 +203,6 @@
 #define ATA_OP_FINISHED 1
 #define ATA_MAX_28BIT_LBA   268435455UL
 
-#ifndefATA_REQUEST_TIMEOUT
-#defineATA_REQUEST_TIMEOUT 10
-#endif
-
 /* structure used for composite atomic operations */
 #define MAX_COMPOSITES  32  /* u_int32_t bits */
 struct ata_composite {
___
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: r344197 - stable/12/sys/dev/iwn

2019-02-15 Thread Andriy Voskoboinyk
Author: avos
Date: Sat Feb 16 01:19:14 2019
New Revision: 344197
URL: https://svnweb.freebsd.org/changeset/base/344197

Log:
  MFC r343094:
  iwn(4): (partially) rewrite A-MPDU Tx path
  
  The change fixes ifnet counters and improves Tx stability when A-MPDU
  is used.
  
  MFC r343292:
  iwn(4): drop i_seq field initialization for A-MPDU frames
  
  It is done by net80211 since r319460.
  
  PR:   192641, 210211
  Reviewed by:  adrian, dhw
  Differential Revision:https://reviews.freebsd.org/D10728

Modified:
  stable/12/sys/dev/iwn/if_iwn.c
  stable/12/sys/dev/iwn/if_iwn_debug.h
  stable/12/sys/dev/iwn/if_iwnreg.h
  stable/12/sys/dev/iwn/if_iwnvar.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/iwn/if_iwn.c
==
--- stable/12/sys/dev/iwn/if_iwn.c  Sat Feb 16 01:05:22 2019
(r344196)
+++ stable/12/sys/dev/iwn/if_iwn.c  Sat Feb 16 01:19:14 2019
(r344197)
@@ -168,6 +168,7 @@ static int  iwn_alloc_tx_ring(struct iwn_softc *, struc
int);
 static voidiwn_reset_tx_ring(struct iwn_softc *, struct iwn_tx_ring *);
 static voidiwn_free_tx_ring(struct iwn_softc *, struct iwn_tx_ring *);
+static voidiwn_check_tx_ring(struct iwn_softc *, int);
 static voidiwn5000_ict_reset(struct iwn_softc *);
 static int iwn_read_eeprom(struct iwn_softc *,
uint8_t macaddr[IEEE80211_ADDR_LEN]);
@@ -199,6 +200,8 @@ static void iwn_calib_timeout(void *);
 static voidiwn_rx_phy(struct iwn_softc *, struct iwn_rx_desc *);
 static voidiwn_rx_done(struct iwn_softc *, struct iwn_rx_desc *,
struct iwn_rx_data *);
+static voidiwn_agg_tx_complete(struct iwn_softc *, struct iwn_tx_ring *,
+   int, int, int);
 static voidiwn_rx_compressed_ba(struct iwn_softc *, struct iwn_rx_desc *);
 static voidiwn5000_rx_calib_results(struct iwn_softc *,
struct iwn_rx_desc *);
@@ -207,10 +210,13 @@ static void   iwn4965_tx_done(struct iwn_softc *, 
struct
struct iwn_rx_data *);
 static voidiwn5000_tx_done(struct iwn_softc *, struct iwn_rx_desc *,
struct iwn_rx_data *);
+static voidiwn_adj_ampdu_ptr(struct iwn_softc *, struct iwn_tx_ring *);
 static voidiwn_tx_done(struct iwn_softc *, struct iwn_rx_desc *, int, int,
uint8_t);
-static voidiwn_ampdu_tx_done(struct iwn_softc *, int, int, int, int, int,
-   void *);
+static int iwn_ampdu_check_bitmap(uint64_t, int, int);
+static int iwn_ampdu_index_check(struct iwn_softc *, struct iwn_tx_ring *,
+   uint64_t, int, int);
+static voidiwn_ampdu_tx_done(struct iwn_softc *, int, int, int, void *);
 static voidiwn_cmd_done(struct iwn_softc *, struct iwn_rx_desc *);
 static voidiwn_notif_intr(struct iwn_softc *);
 static voidiwn_wakeup_intr(struct iwn_softc *);
@@ -2069,6 +2075,8 @@ iwn_reset_tx_ring(struct iwn_softc *sc, struct iwn_tx_
ieee80211_free_node(data->ni);
data->ni = NULL;
}
+   data->remapped = 0;
+   data->long_retries = 0;
}
/* Clear TX descriptors. */
memset(ring->desc, 0, ring->desc_dma.size);
@@ -2108,6 +2116,42 @@ iwn_free_tx_ring(struct iwn_softc *sc, struct iwn_tx_r
 }
 
 static void
+iwn_check_tx_ring(struct iwn_softc *sc, int qid)
+{
+   struct iwn_tx_ring *ring = >txq[qid];
+
+   KASSERT(ring->queued >= 0, ("%s: ring->queued (%d) for queue %d < 0!",
+   __func__, ring->queued, qid));
+
+   if (qid >= sc->firstaggqueue) {
+   struct iwn_ops *ops = >ops;
+   struct ieee80211_tx_ampdu *tap = sc->qid2tap[qid];
+
+   if (ring->queued == 0 && !IEEE80211_AMPDU_RUNNING(tap)) {
+   uint16_t ssn = tap->txa_start & 0xfff;
+   uint8_t tid = tap->txa_tid;
+   int *res = tap->txa_private;
+
+   iwn_nic_lock(sc);
+   ops->ampdu_tx_stop(sc, qid, tid, ssn);
+   iwn_nic_unlock(sc);
+
+   sc->qid2tap[qid] = NULL;
+   free(res, M_DEVBUF);
+   }
+   }
+
+   if (ring->queued < IWN_TX_RING_LOMARK) {
+   sc->qfullmsk &= ~(1 << qid);
+
+   if (ring->queued == 0)
+   sc->sc_tx_timer = 0;
+   else
+   sc->sc_tx_timer = 5;
+   }
+}
+
+static void
 iwn5000_ict_reset(struct iwn_softc *sc)
 {
/* Disable interrupts. */
@@ -3163,104 +3207,129 @@ iwn_rx_done(struct iwn_softc *sc, struct iwn_rx_desc *
 
 }
 
-/* Process an incoming Compressed BlockAck. */
 static void
-iwn_rx_compressed_ba(struct iwn_softc *sc, struct iwn_rx_desc *desc)
+iwn_agg_tx_complete(struct iwn_softc *sc, struct 

svn commit: r344196 - in stable: 10/sbin/ifconfig 11/sbin/ifconfig 12/sbin/ifconfig

2019-02-15 Thread Andriy Voskoboinyk
Author: avos
Date: Sat Feb 16 01:05:22 2019
New Revision: 344196
URL: https://svnweb.freebsd.org/changeset/base/344196

Log:
  MFC r343980:
  ifconfig(8): display 802.11n rates correctly for 'roam:rate' parameter

Modified:
  stable/10/sbin/ifconfig/ifieee80211.c
Directory Properties:
  stable/10/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/sbin/ifconfig/ifieee80211.c
  stable/12/sbin/ifconfig/ifieee80211.c
Directory Properties:
  stable/11/   (props changed)
  stable/12/   (props changed)

Modified: stable/10/sbin/ifconfig/ifieee80211.c
==
--- stable/10/sbin/ifconfig/ifieee80211.c   Sat Feb 16 00:40:03 2019
(r344195)
+++ stable/10/sbin/ifconfig/ifieee80211.c   Sat Feb 16 01:05:22 2019
(r344196)
@@ -4557,7 +4557,9 @@ end:
LINE_CHECK("roam:rssi %u.5", rp->rssi/2);
else
LINE_CHECK("roam:rssi %u", rp->rssi/2);
-   LINE_CHECK("roam:rate %u", rp->rate/2);
+   LINE_CHECK("roam:rate %s%u",
+   (rp->rate & IEEE80211_RATE_MCS) ? "MCS " : "",
+   get_rate_value(rp->rate));
} else {
LINE_BREAK();
list_roam(s);
___
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: r344196 - in stable: 10/sbin/ifconfig 11/sbin/ifconfig 12/sbin/ifconfig

2019-02-15 Thread Andriy Voskoboinyk
Author: avos
Date: Sat Feb 16 01:05:22 2019
New Revision: 344196
URL: https://svnweb.freebsd.org/changeset/base/344196

Log:
  MFC r343980:
  ifconfig(8): display 802.11n rates correctly for 'roam:rate' parameter

Modified:
  stable/11/sbin/ifconfig/ifieee80211.c
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/10/sbin/ifconfig/ifieee80211.c
  stable/12/sbin/ifconfig/ifieee80211.c
Directory Properties:
  stable/10/   (props changed)
  stable/12/   (props changed)

Modified: stable/11/sbin/ifconfig/ifieee80211.c
==
--- stable/11/sbin/ifconfig/ifieee80211.c   Sat Feb 16 00:40:03 2019
(r344195)
+++ stable/11/sbin/ifconfig/ifieee80211.c   Sat Feb 16 01:05:22 2019
(r344196)
@@ -4699,7 +4699,9 @@ end:
LINE_CHECK("roam:rssi %u.5", rp->rssi/2);
else
LINE_CHECK("roam:rssi %u", rp->rssi/2);
-   LINE_CHECK("roam:rate %u", rp->rate/2);
+   LINE_CHECK("roam:rate %s%u",
+   (rp->rate & IEEE80211_RATE_MCS) ? "MCS " : "",
+   get_rate_value(rp->rate));
} else {
LINE_BREAK();
list_roam(s);
___
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: r344196 - in stable: 10/sbin/ifconfig 11/sbin/ifconfig 12/sbin/ifconfig

2019-02-15 Thread Andriy Voskoboinyk
Author: avos
Date: Sat Feb 16 01:05:22 2019
New Revision: 344196
URL: https://svnweb.freebsd.org/changeset/base/344196

Log:
  MFC r343980:
  ifconfig(8): display 802.11n rates correctly for 'roam:rate' parameter

Modified:
  stable/12/sbin/ifconfig/ifieee80211.c
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/10/sbin/ifconfig/ifieee80211.c
  stable/11/sbin/ifconfig/ifieee80211.c
Directory Properties:
  stable/10/   (props changed)
  stable/11/   (props changed)

Modified: stable/12/sbin/ifconfig/ifieee80211.c
==
--- stable/12/sbin/ifconfig/ifieee80211.c   Sat Feb 16 00:40:03 2019
(r344195)
+++ stable/12/sbin/ifconfig/ifieee80211.c   Sat Feb 16 01:05:22 2019
(r344196)
@@ -5080,7 +5080,9 @@ end:
LINE_CHECK("roam:rssi %u.5", rp->rssi/2);
else
LINE_CHECK("roam:rssi %u", rp->rssi/2);
-   LINE_CHECK("roam:rate %u", rp->rate/2);
+   LINE_CHECK("roam:rate %s%u",
+   (rp->rate & IEEE80211_RATE_MCS) ? "MCS " : "",
+   get_rate_value(rp->rate));
} else {
LINE_BREAK();
list_roam(s);
___
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: r344195 - stable/11/usr.sbin/jail

2019-02-15 Thread Eugene Grosbein
Author: eugen
Date: Sat Feb 16 00:40:03 2019
New Revision: 344195
URL: https://svnweb.freebsd.org/changeset/base/344195

Log:
  MFC r343112: jail(8): stop crashing with SIGSEGV inside run_command()
  function while processing not entirely correct jail.conf(5) file
  having something like "ip4.addr = 127.0.0.1;" and no "ip4 = ...;"
  so extrap variable stays NULL.
  
  Reported by:marck

Modified:
  stable/11/usr.sbin/jail/command.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/jail/command.c
==
--- stable/11/usr.sbin/jail/command.c   Sat Feb 16 00:38:25 2019
(r344194)
+++ stable/11/usr.sbin/jail/command.c   Sat Feb 16 00:40:03 2019
(r344195)
@@ -374,7 +374,7 @@ run_command(struct cfjail *j)
argc = 4;
}
 
-   if (!down) {
+   if (!down && extrap != NULL) {
for (cs = strtok(extrap, " "); cs;
 cs = strtok(NULL, " ")) {
size_t len = strlen(cs) + 1;
___
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: r344193 - in stable: 10/usr.bin/newkey 11/usr.bin/newkey 12/usr.bin/newkey

2019-02-15 Thread Andriy Voskoboinyk
Author: avos
Date: Sat Feb 16 00:37:08 2019
New Revision: 344193
URL: https://svnweb.freebsd.org/changeset/base/344193

Log:
  MFC r343909:
  newkey(8): fix 'tmpname' memory leak (always) and input file descriptor leak
  when output file cannot be opened
  
  PR:   201732
  Reported by:  David Binderman 

Modified:
  stable/12/usr.bin/newkey/update.c
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/10/usr.bin/newkey/update.c
  stable/11/usr.bin/newkey/update.c
Directory Properties:
  stable/10/   (props changed)
  stable/11/   (props changed)

Modified: stable/12/usr.bin/newkey/update.c
==
--- stable/12/usr.bin/newkey/update.c   Sat Feb 16 00:15:54 2019
(r344192)
+++ stable/12/usr.bin/newkey/update.c   Sat Feb 16 00:37:08 2019
(r344193)
@@ -266,11 +266,14 @@ localupdate(char *name, char *filename, u_int op, u_in
sprintf(tmpname, "%s.tmp", filename);
rf = fopen(filename, "r");
if (rf == NULL) {
-   return (ERR_READ);
+   err = ERR_READ;
+   goto cleanup;
}
wf = fopen(tmpname, "w");
if (wf == NULL) {
-   return (ERR_WRITE);
+   fclose(rf);
+   err = ERR_WRITE;
+   goto cleanup;
}
err = -1;
while (fgets(line, sizeof (line), rf)) {
@@ -310,13 +313,18 @@ localupdate(char *name, char *filename, u_int op, u_in
fclose(rf);
if (err == 0) {
if (rename(tmpname, filename) < 0) {
-   return (ERR_DBASE);
+   err = ERR_DBASE;
+   goto cleanup;
}
} else {
if (unlink(tmpname) < 0) {
-   return (ERR_DBASE);
+   err = ERR_DBASE;
+   goto cleanup;
}
}
+
+cleanup:
+   free(tmpname);
return (err);
 }
 
___
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: r344193 - in stable: 10/usr.bin/newkey 11/usr.bin/newkey 12/usr.bin/newkey

2019-02-15 Thread Andriy Voskoboinyk
Author: avos
Date: Sat Feb 16 00:37:08 2019
New Revision: 344193
URL: https://svnweb.freebsd.org/changeset/base/344193

Log:
  MFC r343909:
  newkey(8): fix 'tmpname' memory leak (always) and input file descriptor leak
  when output file cannot be opened
  
  PR:   201732
  Reported by:  David Binderman 

Modified:
  stable/10/usr.bin/newkey/update.c
Directory Properties:
  stable/10/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/usr.bin/newkey/update.c
  stable/12/usr.bin/newkey/update.c
Directory Properties:
  stable/11/   (props changed)
  stable/12/   (props changed)

Modified: stable/10/usr.bin/newkey/update.c
==
--- stable/10/usr.bin/newkey/update.c   Sat Feb 16 00:15:54 2019
(r344192)
+++ stable/10/usr.bin/newkey/update.c   Sat Feb 16 00:37:08 2019
(r344193)
@@ -266,11 +266,14 @@ localupdate(char *name, char *filename, u_int op, u_in
sprintf(tmpname, "%s.tmp", filename);
rf = fopen(filename, "r");
if (rf == NULL) {
-   return (ERR_READ);
+   err = ERR_READ;
+   goto cleanup;
}
wf = fopen(tmpname, "w");
if (wf == NULL) {
-   return (ERR_WRITE);
+   fclose(rf);
+   err = ERR_WRITE;
+   goto cleanup;
}
err = -1;
while (fgets(line, sizeof (line), rf)) {
@@ -310,13 +313,18 @@ localupdate(char *name, char *filename, u_int op, u_in
fclose(rf);
if (err == 0) {
if (rename(tmpname, filename) < 0) {
-   return (ERR_DBASE);
+   err = ERR_DBASE;
+   goto cleanup;
}
} else {
if (unlink(tmpname) < 0) {
-   return (ERR_DBASE);
+   err = ERR_DBASE;
+   goto cleanup;
}
}
+
+cleanup:
+   free(tmpname);
return (err);
 }
 
___
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: r344194 - stable/12/usr.sbin/jail

2019-02-15 Thread Eugene Grosbein
Author: eugen
Date: Sat Feb 16 00:38:25 2019
New Revision: 344194
URL: https://svnweb.freebsd.org/changeset/base/344194

Log:
  MFC r343112: jail(8): stop crashing with SIGSEGV inside run_command()
  function while processing not entirely correct jail.conf(5) file
  having something like "ip4.addr = 127.0.0.1;" and no "ip4 = ...;"
  so extrap variable stays NULL.
  
  Reported by:marck

Modified:
  stable/12/usr.sbin/jail/command.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.sbin/jail/command.c
==
--- stable/12/usr.sbin/jail/command.c   Sat Feb 16 00:37:08 2019
(r344193)
+++ stable/12/usr.sbin/jail/command.c   Sat Feb 16 00:38:25 2019
(r344194)
@@ -374,7 +374,7 @@ run_command(struct cfjail *j)
argc = 4;
}
 
-   if (!down) {
+   if (!down && extrap != NULL) {
for (cs = strtok(extrap, " "); cs;
 cs = strtok(NULL, " ")) {
size_t len = strlen(cs) + 1;
___
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: r344193 - in stable: 10/usr.bin/newkey 11/usr.bin/newkey 12/usr.bin/newkey

2019-02-15 Thread Andriy Voskoboinyk
Author: avos
Date: Sat Feb 16 00:37:08 2019
New Revision: 344193
URL: https://svnweb.freebsd.org/changeset/base/344193

Log:
  MFC r343909:
  newkey(8): fix 'tmpname' memory leak (always) and input file descriptor leak
  when output file cannot be opened
  
  PR:   201732
  Reported by:  David Binderman 

Modified:
  stable/11/usr.bin/newkey/update.c
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/10/usr.bin/newkey/update.c
  stable/12/usr.bin/newkey/update.c
Directory Properties:
  stable/10/   (props changed)
  stable/12/   (props changed)

Modified: stable/11/usr.bin/newkey/update.c
==
--- stable/11/usr.bin/newkey/update.c   Sat Feb 16 00:15:54 2019
(r344192)
+++ stable/11/usr.bin/newkey/update.c   Sat Feb 16 00:37:08 2019
(r344193)
@@ -266,11 +266,14 @@ localupdate(char *name, char *filename, u_int op, u_in
sprintf(tmpname, "%s.tmp", filename);
rf = fopen(filename, "r");
if (rf == NULL) {
-   return (ERR_READ);
+   err = ERR_READ;
+   goto cleanup;
}
wf = fopen(tmpname, "w");
if (wf == NULL) {
-   return (ERR_WRITE);
+   fclose(rf);
+   err = ERR_WRITE;
+   goto cleanup;
}
err = -1;
while (fgets(line, sizeof (line), rf)) {
@@ -310,13 +313,18 @@ localupdate(char *name, char *filename, u_int op, u_in
fclose(rf);
if (err == 0) {
if (rename(tmpname, filename) < 0) {
-   return (ERR_DBASE);
+   err = ERR_DBASE;
+   goto cleanup;
}
} else {
if (unlink(tmpname) < 0) {
-   return (ERR_DBASE);
+   err = ERR_DBASE;
+   goto cleanup;
}
}
+
+cleanup:
+   free(tmpname);
return (err);
 }
 
___
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: r344192 - in head: libexec/rc/rc.d usr.sbin/nfsd

2019-02-15 Thread Sean Eric Fagan
Author: sef
Date: Sat Feb 16 00:15:54 2019
New Revision: 344192
URL: https://svnweb.freebsd.org/changeset/base/344192

Log:
  Add support for a virtual hostname to nfsd
  
  Specifically, this allows (via "-V vhostname") telling nfsd what principal
  to use, instead of the hostname.  This is used at iXsystems for fail-over in
  HA systems.
  
  Reviewed by:  macklem
  Sponsored by: iXsystems Inc.
  Differential Revision:https://reviews.freebsd.org/D19191

Modified:
  head/libexec/rc/rc.d/nfsd
  head/usr.sbin/nfsd/nfsd.8
  head/usr.sbin/nfsd/nfsd.c

Modified: head/libexec/rc/rc.d/nfsd
==
--- head/libexec/rc/rc.d/nfsd   Sat Feb 16 00:15:02 2019(r344191)
+++ head/libexec/rc/rc.d/nfsd   Sat Feb 16 00:15:54 2019(r344192)
@@ -13,6 +13,7 @@ name="nfsd"
 desc="Remote NFS server"
 rcvar="nfs_server_enable"
 command="/usr/sbin/${name}"
+nfs_server_vhost=""
 
 load_rc_config $name
 start_precmd="nfsd_precmd"
@@ -20,6 +21,7 @@ sig_stop="USR1"
 
 nfsd_precmd()
 {
+   local   _vhost
rc_flags="${nfs_server_flags}"
 
# Load the modules now, so that the vfs.nfsd sysctl
@@ -46,6 +48,9 @@ nfsd_precmd()
 
force_depend rpcbind || return 1
force_depend mountd || return 1
+   if [ -n "${nfs_server_vhost}" ]; then
+   command_args="-V \"${nfs_server_vhost}\""
+   fi
 }
 
 run_rc_command "$1"

Modified: head/usr.sbin/nfsd/nfsd.8
==
--- head/usr.sbin/nfsd/nfsd.8   Sat Feb 16 00:15:02 2019(r344191)
+++ head/usr.sbin/nfsd/nfsd.8   Sat Feb 16 00:15:54 2019(r344192)
@@ -28,7 +28,7 @@
 .\"@(#)nfsd.8  8.4 (Berkeley) 3/29/95
 .\" $FreeBSD$
 .\"
-.Dd August 5, 2018
+.Dd February 14, 2019
 .Dt NFSD 8
 .Os
 .Sh NAME
@@ -43,6 +43,7 @@ server
 .Op Fl h Ar bindip
 .Op Fl p Ar pnfs_setup
 .Op Fl m Ar mirror_level
+.Op Fl V Ar virtual_hostname
 .Op Fl Fl maxthreads Ar max_threads
 .Op Fl Fl minthreads Ar min_threads
 .Sh DESCRIPTION
@@ -78,6 +79,9 @@ Unregister the
 service with
 .Xr rpcbind 8
 without creating any servers.
+.It Fl V Ar virtual_hostname
+Specifies a hostname to be used as a principal name, instead of
+the default hostname.
 .It Fl n Ar threads
 Specifies how many servers to create.  This option is equivalent to specifying
 .Fl Fl maxthreads

Modified: head/usr.sbin/nfsd/nfsd.c
==
--- head/usr.sbin/nfsd/nfsd.c   Sat Feb 16 00:15:02 2019(r344191)
+++ head/usr.sbin/nfsd/nfsd.c   Sat Feb 16 00:15:54 2019(r344192)
@@ -122,7 +122,7 @@ static void nonfs(int);
 static voidreapchild(int);
 static int setbindhost(struct addrinfo **ia, const char *bindhost,
struct addrinfo hints);
-static voidstart_server(int, struct nfsd_nfsd_args *);
+static voidstart_server(int, struct nfsd_nfsd_args *, const char *vhost);
 static voidunregistration(void);
 static voidusage(void);
 static voidopen_stable(int *, int *);
@@ -176,6 +176,7 @@ main(int argc, char **argv)
char **bindhost = NULL;
pid_t pid;
struct nfsd_nfsd_args nfsdargs;
+   const char *vhostname = NULL;
 
nfsdargs.mirrorcnt = 1;
nfsdargs.addr = NULL;
@@ -183,16 +184,24 @@ main(int argc, char **argv)
nfsdcnt = DEFNFSDCNT;
unregister = reregister = tcpflag = maxsock = 0;
bindanyflag = udpflag = connect_type_cnt = bindhostc = 0;
-   getopt_shortopts = "ah:n:rdtuep:m:";
+   getopt_shortopts = "ah:n:rdtuep:m:V:";
getopt_usage =
"usage:\n"
"  nfsd [-ardtue] [-h bindip]\n"
"   [-n numservers] [--minthreads #] [--maxthreads #]\n"
-   "   [-p/--pnfs dsserver0:/dsserver0-mounted-on-dir,...,"
-   "dsserverN:/dsserverN-mounted-on-dir] [-m mirrorlevel]\n";
+   "   [-p/--pnfs dsserver0:/dsserver0-mounted-on-dir,...,\n"
+   "   [-V virtual_hostname]\n"
+   "   dsserverN:/dsserverN-mounted-on-dir] [-m mirrorlevel]\n";
while ((ch = getopt_long(argc, argv, getopt_shortopts, longopts,
)) != -1)
switch (ch) {
+   case 'V':
+   if (strlen(optarg) <= MAXHOSTNAMELEN)
+   vhostname = optarg;
+   else
+   warnx("Virtual host name (%s) is too long",
+   optarg);
+   break;
case 'a':
bindanyflag = 1;
break;
@@ -473,7 +482,7 @@ main(int argc, char **argv)
} else {
(void)signal(SIGUSR1, child_cleanup);
setproctitle("server");
-   start_server(0, );
+   start_server(0, , vhostname);
 

svn commit: r344191 - head/sbin/nvmecontrol

2019-02-15 Thread Warner Losh
Author: imp
Date: Sat Feb 16 00:15:02 2019
New Revision: 344191
URL: https://svnweb.freebsd.org/changeset/base/344191

Log:
  Remove write-only s_flag.

Modified:
  head/sbin/nvmecontrol/firmware.c

Modified: head/sbin/nvmecontrol/firmware.c
==
--- head/sbin/nvmecontrol/firmware.cFri Feb 15 23:46:34 2019
(r344190)
+++ head/sbin/nvmecontrol/firmware.cSat Feb 16 00:15:02 2019
(r344191)
@@ -177,7 +177,7 @@ static void
 firmware(const struct nvme_function *nf, int argc, char *argv[])
 {
int fd = -1, slot = 0;
-   int a_flag, s_flag, f_flag;
+   int a_flag, f_flag;
int activate_action, reboot_required;
int opt;
char*p, *image = NULL;
@@ -188,7 +188,7 @@ firmware(const struct nvme_function *nf, int argc, cha
uint8_t fw_slot1_ro, fw_num_slots;
struct nvme_controller_data cdata;
 
-   a_flag = s_flag = f_flag = false;
+   a_flag = f_flag = false;
 
while ((opt = getopt(argc, argv, "af:s:")) != -1) {
switch (opt) {
@@ -214,7 +214,6 @@ firmware(const struct nvme_function *nf, int argc, cha
"7.\n", optarg);
usage(nf);
}
-   s_flag = true;
break;
case 'f':
image = optarg;
___
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: r344190 - head/lib/libc/sys

2019-02-15 Thread Gleb Smirnoff
Author: glebius
Date: Fri Feb 15 23:46:34 2019
New Revision: 344190
URL: https://svnweb.freebsd.org/changeset/base/344190

Log:
  Imaginary cat jumped my keyboard!

Modified:
  head/lib/libc/sys/sendfile.2

Modified: head/lib/libc/sys/sendfile.2
==
--- head/lib/libc/sys/sendfile.2Fri Feb 15 23:41:54 2019
(r344189)
+++ head/lib/libc/sys/sendfile.2Fri Feb 15 23:46:34 2019
(r344190)
@@ -48,7 +48,6 @@ The
 system call
 sends a regular file or shared memory object specified by descriptor
 .Fa fd
-h
 out a stream socket specified by descriptor
 .Fa s .
 .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: r344189 - head/share/mk

2019-02-15 Thread Conrad Meyer
Author: cem
Date: Fri Feb 15 23:41:54 2019
New Revision: 344189
URL: https://svnweb.freebsd.org/changeset/base/344189

Log:
  Fixup bsd.prog.mk after r344182
  
  Reported by:  tinderbox
  Sponsored by: Dell EMC Isilon

Modified:
  head/share/mk/bsd.prog.mk

Modified: head/share/mk/bsd.prog.mk
==
--- head/share/mk/bsd.prog.mk   Fri Feb 15 23:36:22 2019(r344188)
+++ head/share/mk/bsd.prog.mk   Fri Feb 15 23:41:54 2019(r344189)
@@ -73,7 +73,7 @@ TAGS+=package=${PACKAGE:Uruntime}
 TAG_ARGS=  -T ${TAGS:[*]:S/ /,/g}
 .endif
 
-.if defined(NO_SHARED) && (${NO_SHARED:tl} != "no"
+.if defined(NO_SHARED) && ${NO_SHARED:tl} != "no"
 LDFLAGS+= -static
 .endif
 
___
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: r344188 - in head: lib/libc/sys sys/vm

2019-02-15 Thread Gleb Smirnoff
Author: glebius
Date: Fri Feb 15 23:36:22 2019
New Revision: 344188
URL: https://svnweb.freebsd.org/changeset/base/344188

Log:
  For 32-bit machines  rollback the default number of vnode pager pbufs
  back to the lever before r343030.  For 64-bit machines reduce it slightly,
  too.  Together with r343030 I bumped the limit up to the value we use at
  Netflix to serve 100 Gbit/s of sendfile traffic, and it probably isn't a
  good default.
  
  Provide a loader tunable to change vnode pager pbufs count. Document it.

Modified:
  head/lib/libc/sys/sendfile.2
  head/sys/vm/vnode_pager.c

Modified: head/lib/libc/sys/sendfile.2
==
--- head/lib/libc/sys/sendfile.2Fri Feb 15 22:55:13 2019
(r344187)
+++ head/lib/libc/sys/sendfile.2Fri Feb 15 23:36:22 2019
(r344188)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 25, 2019
+.Dd February 15, 2019
 .Dt SENDFILE 2
 .Os
 .Sh NAME
@@ -48,6 +48,7 @@ The
 system call
 sends a regular file or shared memory object specified by descriptor
 .Fa fd
+h
 out a stream socket specified by descriptor
 .Fa s .
 .Pp
@@ -224,6 +225,19 @@ implementation of
 .Fn sendfile
 is "zero-copy", meaning that it has been optimized so that copying of the file 
data is avoided.
 .Sh TUNING
+.Ss physical paging buffers
+.Fn sendfile
+uses vnode pager to read file pages into memory.
+The pager uses a pool of physical buffers to run its I/O operations.
+When system runs out of pbufs, sendfile will block and report state
+.Dq Li zonelimit .
+Size of the pool can be tuned with
+.Va vm.vnode_pbufs
+.Xr loader.conf 5
+tunable and can be checked with
+.Xr sysctl 8
+OID of the same name at runtime.
+.Ss sendfile(2) buffers
 On some architectures, this system call internally uses a special
 .Fn sendfile
 buffer
@@ -279,9 +293,11 @@ buffers usage respectively.
 These values may also be viewed through
 .Nm netstat Fl m .
 .Pp
-If a value of zero is reported for
-.Va kern.ipc.nsfbufs ,
-your architecture does not need to use
+If
+.Xr sysctl 8
+OID
+.Va kern.ipc.nsfbufs
+doesn't exist, your architecture does not need to use
 .Fn sendfile
 buffers because their task can be efficiently performed
 by the generic virtual memory structures.
@@ -363,11 +379,13 @@ does not support
 The socket peer has closed the connection.
 .El
 .Sh SEE ALSO
+.Xr loader.conf 5 ,
 .Xr netstat 1 ,
 .Xr open 2 ,
 .Xr send 2 ,
 .Xr socket 2 ,
 .Xr writev 2 ,
+.Xr sysctl 8 ,
 .Xr tuning 7
 .Rs
 .%A K. Elmeleegy

Modified: head/sys/vm/vnode_pager.c
==
--- head/sys/vm/vnode_pager.c   Fri Feb 15 22:55:13 2019(r344187)
+++ head/sys/vm/vnode_pager.c   Fri Feb 15 23:36:22 2019(r344188)
@@ -115,13 +115,23 @@ SYSCTL_PROC(_debug, OID_AUTO, vnode_domainset, CTLTYPE
 _domainset, 0, sysctl_handle_domainset, "A",
 "Default vnode NUMA policy");
 
+static int nvnpbufs;
+SYSCTL_INT(_vm, OID_AUTO, vnode_pbufs, CTLFLAG_RDTUN | CTLFLAG_NOFETCH,
+, 0, "number of physical buffers allocated for vnode pager");
+
 static uma_zone_t vnode_pbuf_zone;
 
 static void
 vnode_pager_init(void *dummy)
 {
 
-   vnode_pbuf_zone = pbuf_zsecond_create("vnpbuf", nswbuf * 8);
+#ifdef __LP64__
+   nvnpbufs = nswbuf * 2;
+#else
+   nvnpbufs = nswbuf / 2;
+#endif
+   TUNABLE_INT_FETCH("vm.vnode_pbufs", );
+   vnode_pbuf_zone = pbuf_zsecond_create("vnpbuf", nvnpbufs);
 }
 SYSINIT(vnode_pager, SI_SUB_CPU, SI_ORDER_ANY, vnode_pager_init, 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"


Re: svn commit: r344182 - head/share/mk

2019-02-15 Thread Conrad Meyer
This one seems to have inadvertently removed a trailing parenthesis,
introducing a syntax error:

On Fri, Feb 15, 2019 at 2:49 PM Ed Maste  wrote:
> New Revision: 344182
> ...
> ==
> --- head/share/mk/bsd.prog.mk   Fri Feb 15 22:30:09 2019(r344181)
> +++ head/share/mk/bsd.prog.mk   Fri Feb 15 22:48:50 2019(r344182)
> ...
> @@ -74,7 +73,7 @@ TAGS+=package=${PACKAGE:Uruntime}
>  TAG_ARGS=  -T ${TAGS:[*]:S/ /,/g}
>  .endif
>
> -.if defined(NO_SHARED) && (${NO_SHARED} != "no" && ${NO_SHARED} != "NO")
> +.if defined(NO_SHARED) && (${NO_SHARED:tl} != "no"

^^

>  LDFLAGS+= -static
>  .endif

Best,
Conrad
___
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: r344162 - head/sys/net

2019-02-15 Thread Bruce Evans

On Fri, 15 Feb 2019, Stephen Hurd wrote:


Log:
 iflib: Improve return values of interrupt handlers.

 iflib was returning FILTER_HANDLED, in cases where FILTER_STRAY was more
 correct. This potentially caused issues with shared legacy interrupts.

 Driver filters returning FILTER_STRAY are now properly handled.


INTR_FILTER was a mistake that was backed out in r334170.  Except it
added hundreds if not thousands of FILTER_XXX returns from drivers,
some apparently wrong so thee return values can't be checked much,
and this wasn't backed out.

There were a lot of uses under INTR_FILTER.  Now the only uses seem
to be:

- a few in a KASSERT() in kern_intr.c
- 1 in kern_intr.c for wrappers like in pccard and pccbb
- 1 in subr_intr.c under INTR_SOLO.

I intentionally left out return values from interrupt handlers when I
unpessimized the interrupt system in ~1992 in 386BSD.  They were rarely
useful then since i386 interrupts were mostly unshareable due to being
edge-triggered.  Edge triggering requires every driver to check all
interrupt sources for devices that it handles, since the interrupt won't
repeat unless it is fully handled.  This also makes sharing difficult.
Sharing for PCI level-triggered interrupts was more common a few years
later.  INTR_FILTER was committed much later.  I think it was committed
just in time to rarely be useful, since MSI was fairly old then.

It is only a minor optimization for shared interrupts to return from
all interrupt handlers when one handler claims FILTER_HANDLED.  This
pessimizes all the non-shared interrupts (more in 1992 than now since
CPUs are relatively much faster than i/o).

Bruce
___
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: r343030 - in head/sys: cam conf dev/md dev/nvme fs/fuse fs/nfsclient fs/smbfs kern sys ufs/ffs vm

2019-02-15 Thread Gleb Smirnoff
  Enji,

On Thu, Feb 14, 2019 at 05:12:21PM -0800, Enji Cooper wrote:
E> > On Wed, Feb 13, 2019 at 07:24:50PM -0600, Justin Hibbits wrote:
E> > J> This seems to break 32-bit platforms, or at least 32-bit book-e
E> > J> powerpc, which has a limited KVA space (~500MB).  It preallocates I've
E> > J> seen over 2500 pbufs, at 128kB each, eating up over 300MB KVA,
E> > J> leaving very little left for the rest of runtime.
E> > J> 
E> > J> I spent a couple hours earlier today debugging with Mark Johnston, and
E> > J> his consensus is that the vnode_pbuf_zone is too big on 32-bit
E> > J> platforms.  Unfortunately I know very little about this area, so can't
E> > J> provide much extra insight, but can readily reproduce the issues I see
E> > J> triggered by this change, so am willing to help where I can.
E> > 
E> > Ok, let's roll back to old default on 32-bit platforms and somewhat
E> > reduce the default on 64-bits.
E> > 
E> > Can you please confirm that the patch attached works for you?
E> 
E> Quick question: why was the value reduced by a factor of 4 on 64-bit 
platforms?

Fair question. Replying to you and Bruce.

This pool of pbufs is used for sendfile(2) and default value of nswbuf / 2
wasn't enough for modern several Gbit/s speeds. At Netflix we run with
nswbuf * 8, since we run up to 100 Gbit/s of sendfile traffic.

Together with new pbuf allocator I bumped the value up to what we use.
Apparently that was overkill for 32-bit machines, so for them I fully
switched it back to old value. Nobody is expected to use these machine
as high performance web servers.

Also, I decided to reduce the default for 64-bit machines as well. Not
everybody runs 100 Gbit/s, but I'd like to see default FreeBSD (no
tunables in loader.conf) to be able to run 10 Gbit/s and more. So
I've chosen a middle ground between old value of nswbuf / 2 and the
value we use at Netflix.

P.S. Ideally, this needs to be autotuned. The problem is that now we need
to pre-allocate pbufs.

-- 
Gleb Smirnoff
___
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: r344187 - head/sys/fs/fuse

2019-02-15 Thread Conrad Meyer
Author: cem
Date: Fri Feb 15 22:55:13 2019
New Revision: 344187
URL: https://svnweb.freebsd.org/changeset/base/344187

Log:
  FUSE: Refresh cached file size when it changes (lookup)
  
  The cached fvdat->filesize is indepedent of the (mostly unused)
  cached_attrs, and we failed to update it when a cached (but perhaps
  inactive) vnode was found during VOP_LOOKUP to have a different size than
  cached.
  
  As noted in the code comment, this can occur in distributed filesystems or
  with other kinds of irregular file behavior (anything is possible in FUSE).
  
  We do something similar in fuse_vnop_getattr already.
  
  PR:   230258 (as reported in description; other issues explored in
comments are not all resolved)
  Reported by:  MooseFS FreeBSD Team 
  Submitted by: Jakub Kruszona-Zawadzki  (earlier version)

Modified:
  head/sys/fs/fuse/fuse_vnops.c

Modified: head/sys/fs/fuse/fuse_vnops.c
==
--- head/sys/fs/fuse/fuse_vnops.c   Fri Feb 15 22:52:49 2019
(r344186)
+++ head/sys/fs/fuse/fuse_vnops.c   Fri Feb 15 22:55:13 2019
(r344187)
@@ -949,12 +949,45 @@ calldaemon:
vref(dvp);
*vpp = dvp;
} else {
+   struct fuse_vnode_data *fvdat;
+
err = fuse_vnode_get(vnode_mount(dvp), feo, nid, dvp,
, cnp, IFTOVT(fattr->mode));
if (err) {
goto out;
}
fuse_vnode_setparent(vp, dvp);
+
+   /*
+* In the case where we are looking up a FUSE node
+* represented by an existing cached vnode, and the
+* true size reported by FUSE_LOOKUP doesn't match
+* the vnode's cached size, fix the vnode cache to
+* match the real object size.
+*
+* This can occur via FUSE distributed filesystems,
+* irregular files, etc.
+*/
+   fvdat = VTOFUD(vp);
+   if (vnode_isreg(vp) &&
+   fattr->size != fvdat->filesize) {
+   /*
+* The FN_SIZECHANGE flag reflects a dirty
+* append.  If userspace lets us know our cache
+* is invalid, that write was lost.  (Dirty
+* writes that do not cause append are also
+* lost, but we don't detect them here.)
+*
+* XXX: Maybe disable WB caching on this mount.
+*/
+   if (fvdat->flag & FN_SIZECHANGE)
+   printf("%s: WB cache incoherent on "
+   "%s!\n", __func__,
+   
vnode_mount(vp)->mnt_stat.f_mntonname);
+
+   (void)fuse_vnode_setsize(vp, cred, fattr->size);
+   fvdat->flag &= ~FN_SIZECHANGE;
+   }
*vpp = vp;
}
 
___
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: r344186 - head/sys/fs/fuse

2019-02-15 Thread Conrad Meyer
Author: cem
Date: Fri Feb 15 22:52:49 2019
New Revision: 344186
URL: https://svnweb.freebsd.org/changeset/base/344186

Log:
  FUSE: The FUSE design expects writethrough caching
  
  At least prior to 7.23 (which adds FUSE_WRITEBACK_CACHE), the FUSE protocol
  specifies only clean data to be cached.
  
  Prior to this change, we implement and default to writeback caching.  This
  is ok enough for local only filesystems without hardlinks, but violates the
  general design contract with FUSE and breaks distributed filesystems or
  concurrent access to hardlinks of the same inode.
  
  In this change, add cache mode as an extension of cache enable/disable.  The
  new modes are UC (was: cache disabled), WT (default), and WB (was: cache
  enabled).
  
  For now, WT caching is implemented as write-around, which meets the goal of
  only caching clean data.  WT can be better than WA for workloads that
  frequently read data that was recently written, but WA is trivial to
  implement.  Note that this has no effect on O_WRONLY-opened files, which
  were already coerced to write-around.
  
  Refs:
* https://sourceforge.net/p/fuse/mailman/message/8902254/
* https://github.com/vgough/encfs/issues/315
  
  PR:   230258 (inspired by)

Modified:
  head/sys/fs/fuse/fuse_io.c
  head/sys/fs/fuse/fuse_ipc.h
  head/sys/fs/fuse/fuse_node.c

Modified: head/sys/fs/fuse/fuse_io.c
==
--- head/sys/fs/fuse/fuse_io.c  Fri Feb 15 22:51:09 2019(r344185)
+++ head/sys/fs/fuse/fuse_io.c  Fri Feb 15 22:52:49 2019(r344186)
@@ -155,7 +155,13 @@ fuse_io_dispatch(struct vnode *vp, struct uio *uio, in
}
break;
case UIO_WRITE:
-   if (directio) {
+   /*
+* Kludge: simulate write-through caching via write-around
+* caching.  Same effect, as far as never caching dirty data,
+* but slightly pessimal in that newly written data is not
+* cached.
+*/
+   if (directio || fuse_data_cache_mode == FUSE_CACHE_WT) {
FS_DEBUG("direct write of vnode %ju via file handle 
%ju\n",
(uintmax_t)VTOILLU(vp), (uintmax_t)fufh->fh_id);
err = fuse_write_directbackend(vp, uio, cred, fufh, 
ioflag);
@@ -363,7 +369,7 @@ fuse_write_directbackend(struct vnode *vp, struct uio 
uio->uio_resid += diff;
uio->uio_offset -= diff;
if (uio->uio_offset > fvdat->filesize &&
-   fuse_data_cache_enable) {
+   fuse_data_cache_mode != FUSE_CACHE_UC) {
fuse_vnode_setsize(vp, cred, uio->uio_offset);
fvdat->flag &= ~FN_SIZECHANGE;
}

Modified: head/sys/fs/fuse/fuse_ipc.h
==
--- head/sys/fs/fuse/fuse_ipc.h Fri Feb 15 22:51:09 2019(r344185)
+++ head/sys/fs/fuse/fuse_ipc.h Fri Feb 15 22:52:49 2019(r344186)
@@ -214,7 +214,13 @@ struct fuse_data {
 #define FSESS_NO_MMAP 0x0800 /* disable mmap */
 #define FSESS_BROKENIO0x1000 /* fix broken io */
 
-extern int fuse_data_cache_enable;
+enum fuse_data_cache_mode {
+   FUSE_CACHE_UC,
+   FUSE_CACHE_WT,
+   FUSE_CACHE_WB,
+};
+
+extern int fuse_data_cache_mode;
 extern int fuse_data_cache_invalidate;
 extern int fuse_mmap_enable;
 extern int fuse_sync_resize;
@@ -248,7 +254,7 @@ fsess_opt_datacache(struct mount *mp)
 {
 struct fuse_data *data = fuse_get_mpdata(mp);
 
-return (fuse_data_cache_enable ||
+return (fuse_data_cache_mode != FUSE_CACHE_UC &&
 (data->dataflags & FSESS_NO_DATACACHE) == 0);
 }
 
@@ -257,7 +263,7 @@ fsess_opt_mmap(struct mount *mp)
 {
 struct fuse_data *data = fuse_get_mpdata(mp);
 
-if (!(fuse_mmap_enable && fuse_data_cache_enable))
+if (!fuse_mmap_enable || fuse_data_cache_mode == FUSE_CACHE_UC)
 return 0;
 return ((data->dataflags & (FSESS_NO_DATACACHE | FSESS_NO_MMAP)) == 0);
 }

Modified: head/sys/fs/fuse/fuse_node.c
==
--- head/sys/fs/fuse/fuse_node.cFri Feb 15 22:51:09 2019
(r344185)
+++ head/sys/fs/fuse/fuse_node.cFri Feb 15 22:52:49 2019
(r344186)
@@ -94,16 +94,19 @@ __FBSDID("$FreeBSD$");
 
 MALLOC_DEFINE(M_FUSEVN, "fuse_vnode", "fuse vnode private data");
 
+static int sysctl_fuse_cache_mode(SYSCTL_HANDLER_ARGS);
+
 static int fuse_node_count = 0;
 
 SYSCTL_INT(_vfs_fuse, OID_AUTO, node_count, CTLFLAG_RD,
 _node_count, 0, "Count of FUSE vnodes");
 
-intfuse_data_cache_enable = 1;
+intfuse_data_cache_mode = FUSE_CACHE_WT;
 
-SYSCTL_INT(_vfs_fuse, OID_AUTO, data_cache_enable, CTLFLAG_RW,
-_data_cache_enable, 0,
-"enable caching of FUSE file data 

svn commit: r344185 - head/sys/fs/fuse

2019-02-15 Thread Conrad Meyer
Author: cem
Date: Fri Feb 15 22:51:09 2019
New Revision: 344185
URL: https://svnweb.freebsd.org/changeset/base/344185

Log:
  FUSE: Only "dirty" cached file size when data is dirty
  
  Most users of fuse_vnode_setsize() set the cached fvdat->filesize and update
  the buf cache bounds as a result of either a read from the underlying FUSE
  filesystem, or as part of a write-through type operation (like truncate =>
  VOP_SETATTR).  In these cases, do not set the FN_SIZECHANGE flag, which
  indicates that an inode's data is dirty (in particular, that the local buf
  cache and fvdat->filesize have dirty extended data).
  
  PR:   230258 (related)

Modified:
  head/sys/fs/fuse/fuse_io.c
  head/sys/fs/fuse/fuse_node.c
  head/sys/fs/fuse/fuse_vnops.c

Modified: head/sys/fs/fuse/fuse_io.c
==
--- head/sys/fs/fuse/fuse_io.c  Fri Feb 15 22:50:31 2019(r344184)
+++ head/sys/fs/fuse/fuse_io.c  Fri Feb 15 22:51:09 2019(r344185)
@@ -362,8 +362,11 @@ fuse_write_directbackend(struct vnode *vp, struct uio 
}
uio->uio_resid += diff;
uio->uio_offset -= diff;
-   if (uio->uio_offset > fvdat->filesize)
+   if (uio->uio_offset > fvdat->filesize &&
+   fuse_data_cache_enable) {
fuse_vnode_setsize(vp, cred, uio->uio_offset);
+   fvdat->flag &= ~FN_SIZECHANGE;
+   }
}
 
fdisp_destroy();

Modified: head/sys/fs/fuse/fuse_node.c
==
--- head/sys/fs/fuse/fuse_node.cFri Feb 15 22:50:31 2019
(r344184)
+++ head/sys/fs/fuse/fuse_node.cFri Feb 15 22:51:09 2019
(r344185)
@@ -375,6 +375,7 @@ fuse_vnode_refreshsize(struct vnode *vp, struct ucred 
struct vattr va;
 
if ((fvdat->flag & FN_SIZECHANGE) != 0 ||
+   fuse_data_cache_enable == 0 ||
(fuse_refresh_size == 0 && fvdat->filesize != 0))
return;
 

Modified: head/sys/fs/fuse/fuse_vnops.c
==
--- head/sys/fs/fuse/fuse_vnops.c   Fri Feb 15 22:50:31 2019
(r344184)
+++ head/sys/fs/fuse/fuse_vnops.c   Fri Feb 15 22:51:09 2019
(r344185)
@@ -538,6 +538,7 @@ fuse_vnop_getattr(struct vop_getattr_args *ap)
 
if (fvdat->filesize != new_filesize) {
fuse_vnode_setsize(vp, cred, new_filesize);
+   fvdat->flag &= ~FN_SIZECHANGE;
}
}
debug_printf("fuse_getattr e: returning 0\n");
@@ -1637,9 +1638,9 @@ fuse_vnop_setattr(struct vop_setattr_args *ap)
err = EAGAIN;
}
}
-   if (!err && !sizechanged) {
+   if (err == 0)
cache_attrs(vp, (struct fuse_attr_out *)fdi.answ, NULL);
-   }
+
 out:
fdisp_destroy();
if (!err && sizechanged) {
___
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: r344184 - head/sys/fs/fuse

2019-02-15 Thread Conrad Meyer
Author: cem
Date: Fri Feb 15 22:50:31 2019
New Revision: 344184
URL: https://svnweb.freebsd.org/changeset/base/344184

Log:
  FUSE: Respect userspace FS "do-not-cache" of path components
  
  The FUSE protocol demands that kernel implementations cache user filesystem
  path components (lookup/cnp data) for a maximum period of time in the range
  of [0, ULONG_MAX] seconds.  In practice, typical requests are for 0, 1, or
  10 seconds; or "a long time" to represent indefinite caching.
  
  Historically, FreeBSD FUSE has ignored this client directive entirely.  This
  works fine for local-only filesystems, but causes consistency issues with
  multi-writer network filesystems.
  
  For now, respect 0 second cache TTLs and do not cache such metadata.
  Non-zero metadata caching TTLs in the range [0.1, ULONG_MAX] seconds
  are still cached indefinitely, because it is unclear how a userspace
  filesystem could do anything sensible with those semantics even if
  implemented.
  
  Pass fuse_entry_out to fuse_vnode_get when available and only cache lookup
  if the user filesystem did not set a zero second TTL.
  
  PR:   230258 (inspired by; does not fix)

Modified:
  head/sys/fs/fuse/fuse_internal.c
  head/sys/fs/fuse/fuse_node.c
  head/sys/fs/fuse/fuse_node.h
  head/sys/fs/fuse/fuse_vfsops.c
  head/sys/fs/fuse/fuse_vnops.c

Modified: head/sys/fs/fuse/fuse_internal.c
==
--- head/sys/fs/fuse/fuse_internal.cFri Feb 15 22:49:15 2019
(r344183)
+++ head/sys/fs/fuse/fuse_internal.cFri Feb 15 22:50:31 2019
(r344184)
@@ -471,7 +471,7 @@ fuse_internal_newentry_core(struct vnode *dvp,
if ((err = fuse_internal_checkentry(feo, vtyp))) {
return err;
}
-   err = fuse_vnode_get(mp, feo->nodeid, dvp, vpp, cnp, vtyp);
+   err = fuse_vnode_get(mp, feo, feo->nodeid, dvp, vpp, cnp, vtyp);
if (err) {
fuse_internal_forget_send(mp, cnp->cn_thread, cnp->cn_cred,
feo->nodeid, 1);

Modified: head/sys/fs/fuse/fuse_node.c
==
--- head/sys/fs/fuse/fuse_node.cFri Feb 15 22:49:15 2019
(r344183)
+++ head/sys/fs/fuse/fuse_node.cFri Feb 15 22:50:31 2019
(r344184)
@@ -241,6 +241,7 @@ fuse_vnode_alloc(struct mount *mp,
 
 int
 fuse_vnode_get(struct mount *mp,
+struct fuse_entry_out *feo,
 uint64_t nodeid,
 struct vnode *dvp,
 struct vnode **vpp,
@@ -261,7 +262,9 @@ fuse_vnode_get(struct mount *mp,
MPASS(!(cnp->cn_namelen == 1 && cnp->cn_nameptr[0] == '.'));
fuse_vnode_setparent(*vpp, dvp);
}
-   if (dvp != NULL && cnp != NULL && (cnp->cn_flags & MAKEENTRY) != 0) {
+   if (dvp != NULL && cnp != NULL && (cnp->cn_flags & MAKEENTRY) != 0 &&
+   feo != NULL &&
+   (feo->entry_valid != 0 || feo->entry_valid_nsec != 0)) {
ASSERT_VOP_LOCKED(*vpp, "fuse_vnode_get");
ASSERT_VOP_LOCKED(dvp, "fuse_vnode_get");
cache_enter(dvp, *vpp, cnp);

Modified: head/sys/fs/fuse/fuse_node.h
==
--- head/sys/fs/fuse/fuse_node.hFri Feb 15 22:49:15 2019
(r344183)
+++ head/sys/fs/fuse/fuse_node.hFri Feb 15 22:50:31 2019
(r344184)
@@ -117,6 +117,7 @@ fuse_vnode_setparent(struct vnode *vp, struct vnode *d
 void fuse_vnode_destroy(struct vnode *vp);
 
 int fuse_vnode_get(struct mount *mp,
+   struct fuse_entry_out *feo,
uint64_t  nodeid,
struct vnode *dvp,
struct vnode**vpp,

Modified: head/sys/fs/fuse/fuse_vfsops.c
==
--- head/sys/fs/fuse/fuse_vfsops.c  Fri Feb 15 22:49:15 2019
(r344183)
+++ head/sys/fs/fuse/fuse_vfsops.c  Fri Feb 15 22:50:31 2019
(r344184)
@@ -444,7 +444,8 @@ fuse_vfsop_root(struct mount *mp, int lkflags, struct 
if (err == 0)
*vpp = data->vroot;
} else {
-   err = fuse_vnode_get(mp, FUSE_ROOT_ID, NULL, vpp, NULL, VDIR);
+   err = fuse_vnode_get(mp, NULL, FUSE_ROOT_ID, NULL, vpp, NULL,
+   VDIR);
if (err == 0) {
FUSE_LOCK();
MPASS(data->vroot == NULL || data->vroot == *vpp);

Modified: head/sys/fs/fuse/fuse_vnops.c
==
--- head/sys/fs/fuse/fuse_vnops.c   Fri Feb 15 22:49:15 2019
(r344183)
+++ head/sys/fs/fuse/fuse_vnops.c   Fri Feb 15 22:50:31 2019
(r344184)
@@ -384,7 +384,7 @@ fuse_vnop_create(struct vop_create_args *ap)
if ((err = fuse_internal_checkentry(feo, VREG))) 

svn commit: r344183 - head/sys/fs/fuse

2019-02-15 Thread Conrad Meyer
Author: cem
Date: Fri Feb 15 22:49:15 2019
New Revision: 344183
URL: https://svnweb.freebsd.org/changeset/base/344183

Log:
  FUSE: Respect userspace FS "do-not-cache" of file attributes
  
  The FUSE protocol demands that kernel implementations cache user filesystem
  file attributes (vattr data) for a maximum period of time in the range of
  [0, ULONG_MAX] seconds.  In practice, typical requests are for 0, 1, or 10
  seconds; or "a long time" to represent indefinite caching.
  
  Historically, FreeBSD FUSE has ignored this client directive entirely.  This
  works fine for local-only filesystems, but causes consistency issues with
  multi-writer network filesystems.
  
  For now, respect 0 second cache TTLs and do not cache such metadata.
  Non-zero metadata caching TTLs in the range [0.1, ULONG_MAX] seconds
  are still cached indefinitely, because it is unclear how a userspace
  filesystem could do anything sensible with those semantics even if
  implemented.
  
  In the future, as an optimization, we should implement notify_inval_entry,
  etc, which provide userspace filesystems a way of evicting the kernel cache.
  
  One potentially bogus access to invalid cached attribute data was left in
  fuse_io_strategy.  It is restricted behind the undocumented and non-default
  "vfs.fuse.fix_broken_io" sysctl or "brokenio" mount option; maybe these are
  deadcode and can be eliminated?
  
  Some minor APIs changed to facilitate this:
  
  1. Attribute cache validity is tracked in FUSE inodes ("fuse_vnode_data").
  
  2. cache_attrs() respects the provided TTL and only caches in the FUSE
  inode if TTL > 0.  It also grows an "out" argument, which, if non-NULL,
  stores the translated fuse_attr (even if not suitable for caching).
  
  3. FUSE VTOVA(vp) returns NULL if the vnode's cache is invalid, to help
  avoid programming mistakes.
  
  4. A VOP_LINK check for potential nlink overflow prior to invoking the FUSE
  link op was weakened (only performed when we have a valid attr cache).  The
  check is racy in a multi-writer network filesystem anyway -- classic TOCTOU.
  We have to trust any userspace filesystem that rejects local caching to
  account for it correctly.
  
  PR:   230258 (inspired by; does not fix)

Modified:
  head/sys/fs/fuse/fuse_internal.c
  head/sys/fs/fuse/fuse_internal.h
  head/sys/fs/fuse/fuse_io.c
  head/sys/fs/fuse/fuse_node.c
  head/sys/fs/fuse/fuse_node.h
  head/sys/fs/fuse/fuse_vnops.c

Modified: head/sys/fs/fuse/fuse_internal.c
==
--- head/sys/fs/fuse/fuse_internal.cFri Feb 15 22:48:50 2019
(r344182)
+++ head/sys/fs/fuse/fuse_internal.cFri Feb 15 22:49:15 2019
(r344183)
@@ -373,7 +373,6 @@ fuse_internal_readdir_processdata(struct uio *uio,
 
 /* remove */
 
-#define INVALIDATE_CACHED_VATTRS_UPON_UNLINK 1
 int
 fuse_internal_remove(struct vnode *dvp,
 struct vnode *vp,
@@ -381,16 +380,12 @@ fuse_internal_remove(struct vnode *dvp,
 enum fuse_opcode op)
 {
struct fuse_dispatcher fdi;
+   struct fuse_vnode_data *fvdat;
+   int err;
 
-   struct vattr *vap = VTOVA(vp);
+   err = 0;
+   fvdat = VTOFUD(vp);
 
-#if INVALIDATE_CACHED_VATTRS_UPON_UNLINK
-   int need_invalidate = 0;
-   uint64_t target_nlink = 0;
-
-#endif
-   int err = 0;
-
debug_printf("dvp=%p, cnp=%p, op=%d\n", vp, cnp, op);
 
fdisp_init(, cnp->cn_namelen + 1);
@@ -399,13 +394,6 @@ fuse_internal_remove(struct vnode *dvp,
memcpy(fdi.indata, cnp->cn_nameptr, cnp->cn_namelen);
((char *)fdi.indata)[cnp->cn_namelen] = '\0';
 
-#if INVALIDATE_CACHED_VATTRS_UPON_UNLINK
-   if (vap->va_nlink > 1) {
-   need_invalidate = 1;
-   target_nlink = vap->va_nlink;
-   }
-#endif
-
err = fdisp_wait_answ();
fdisp_destroy();
return err;
@@ -489,7 +477,7 @@ fuse_internal_newentry_core(struct vnode *dvp,
feo->nodeid, 1);
return err;
}
-   cache_attrs(*vpp, feo);
+   cache_attrs(*vpp, feo, NULL);
 
return err;
 }
@@ -563,6 +551,7 @@ fuse_internal_vnode_disappear(struct vnode *vp)
 
ASSERT_VOP_ELOCKED(vp, "fuse_internal_vnode_disappear");
fvdat->flag |= FN_REVOKED;
+   fvdat->valid_attr_cache = false;
cache_purge(vp);
 }
 

Modified: head/sys/fs/fuse/fuse_internal.h
==
--- head/sys/fs/fuse/fuse_internal.hFri Feb 15 22:48:50 2019
(r344182)
+++ head/sys/fs/fuse/fuse_internal.hFri Feb 15 22:49:15 2019
(r344183)
@@ -200,15 +200,47 @@ fuse_internal_access(struct vnode *vp,
 
 /* attributes */
 
+/*
+ * Cache FUSE attributes 'fat', with nominal expiration
+ * 'attr_valid'.'attr_valid_nsec', in attr cache associated with vnode 'vp'.
+ * Optionally, if argument 'vap' is not NULL, store a copy of the converted
+ * attributes 

svn commit: r344182 - head/share/mk

2019-02-15 Thread Ed Maste
Author: emaste
Date: Fri Feb 15 22:48:50 2019
New Revision: 344182
URL: https://svnweb.freebsd.org/changeset/base/344182

Log:
  Use make's :tl instead of checking "no" and "NO"
  
  Suggested by: kevans
  Reviewed by:  kevans

Modified:
  head/share/mk/bsd.prog.mk
  head/share/mk/src.libnames.mk

Modified: head/share/mk/bsd.prog.mk
==
--- head/share/mk/bsd.prog.mk   Fri Feb 15 22:30:09 2019(r344181)
+++ head/share/mk/bsd.prog.mk   Fri Feb 15 22:48:50 2019(r344182)
@@ -38,8 +38,7 @@ MK_DEBUG_FILES=   no
 .if ${MK_BIND_NOW} != "no"
 LDFLAGS+= -Wl,-znow
 .endif
-.if ${MK_PIE} != "no" && \
-(!defined(NO_SHARED) || ${NO_SHARED} == "no" || ${NO_SHARED} == "NO")
+.if ${MK_PIE} != "no" && (!defined(NO_SHARED) || ${NO_SHARED:tl} == "no")
 CFLAGS+= -fPIE
 CXXFLAGS+= -fPIE
 LDFLAGS+= -pie
@@ -48,7 +47,7 @@ LDFLAGS+= -pie
 CFLAGS+= -mretpoline
 CXXFLAGS+= -mretpoline
 # retpolineplt is broken with static linking (PR 26)
-.if !defined(NO_SHARED) || ${NO_SHARED} == "no" || ${NO_SHARED} == "NO"
+.if !defined(NO_SHARED) || ${NO_SHARED:tl} == "no"
 LDFLAGS+= -Wl,-zretpolineplt
 .endif
 .endif
@@ -74,7 +73,7 @@ TAGS+=package=${PACKAGE:Uruntime}
 TAG_ARGS=  -T ${TAGS:[*]:S/ /,/g}
 .endif
 
-.if defined(NO_SHARED) && (${NO_SHARED} != "no" && ${NO_SHARED} != "NO")
+.if defined(NO_SHARED) && (${NO_SHARED:tl} != "no"
 LDFLAGS+= -static
 .endif
 

Modified: head/share/mk/src.libnames.mk
==
--- head/share/mk/src.libnames.mk   Fri Feb 15 22:30:09 2019
(r344181)
+++ head/share/mk/src.libnames.mk   Fri Feb 15 22:48:50 2019
(r344182)
@@ -386,7 +386,7 @@ LDADD_${_l}?=   ${LDADD_${_l}_L} -l${_l}
 .endif
 # Add in all dependencies for static linkage.
 .if defined(_DP_${_l}) && (${_INTERNALLIBS:M${_l}} || \
-(defined(NO_SHARED) && (${NO_SHARED} != "no" && ${NO_SHARED} != "NO")))
+(defined(NO_SHARED) && ${NO_SHARED:tl} != "no"))
 .for _d in ${_DP_${_l}}
 DPADD_${_l}+=  ${DPADD_${_d}}
 LDADD_${_l}+=  ${LDADD_${_d}}
___
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: r344181 - head/share/mk

2019-02-15 Thread Ed Maste
Author: emaste
Date: Fri Feb 15 22:30:09 2019
New Revision: 344181
URL: https://svnweb.freebsd.org/changeset/base/344181

Log:
  Fix Makefile conditional after r344179

Modified:
  head/share/mk/bsd.prog.mk

Modified: head/share/mk/bsd.prog.mk
==
--- head/share/mk/bsd.prog.mk   Fri Feb 15 22:28:34 2019(r344180)
+++ head/share/mk/bsd.prog.mk   Fri Feb 15 22:30:09 2019(r344181)
@@ -39,7 +39,7 @@ MK_DEBUG_FILES=   no
 LDFLAGS+= -Wl,-znow
 .endif
 .if ${MK_PIE} != "no" && \
-!defined(NO_SHARED) || ${NO_SHARED} == "no" || ${NO_SHARED} == "NO"
+(!defined(NO_SHARED) || ${NO_SHARED} == "no" || ${NO_SHARED} == "NO")
 CFLAGS+= -fPIE
 CXXFLAGS+= -fPIE
 LDFLAGS+= -pie
___
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: r344179 - in head: kerberos5/tools/asn1_compile kerberos5/tools/slc lib/clang libexec/rtld-elf share/mk stand/i386 tools/build/options usr.bin/clang usr.bin/svn

2019-02-15 Thread Ed Maste
On Fri, 15 Feb 2019 at 17:22, Ed Maste  wrote:
>
> Author: emaste
> Date: Fri Feb 15 22:22:38 2019
> New Revision: 344179
> URL: https://svnweb.freebsd.org/changeset/base/344179
>
> Log:
>   Add WITH_PIE knob to build Position Independent Executables

A last-minute cleanup/refactoring introduced a Makefile error in this
change - fix coming shortly.
___
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: r344180 - head/share/man/man5

2019-02-15 Thread Ed Maste
Author: emaste
Date: Fri Feb 15 22:28:34 2019
New Revision: 344180
URL: https://svnweb.freebsd.org/changeset/base/344180

Log:
  Regen src.conf.5 after r344179

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

Modified: head/share/man/man5/src.conf.5
==
--- head/share/man/man5/src.conf.5  Fri Feb 15 22:22:38 2019
(r344179)
+++ head/share/man/man5/src.conf.5  Fri Feb 15 22:28:34 2019
(r344180)
@@ -1,6 +1,6 @@
 .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman.
 .\" $FreeBSD$
-.Dd January 31, 2019
+.Dd February 15, 2019
 .Dt SRC.CONF 5
 .Os
 .Sh NAME
@@ -406,7 +406,8 @@ Set to build the Clang C/C++ compiler during the boots
 This is a default setting on
 amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64 and i386/i386.
 .It Va WITH_CLANG_EXTRAS
-Set to build additional clang and llvm tools, such as bugpoint.
+Set to build additional clang and llvm tools, such as bugpoint and
+clang-format.
 .It Va WITHOUT_CLANG_FULL
 Set to avoid building the ARCMigrate, Rewriter and StaticAnalyzer components of
 the Clang C/C++ compiler.
@@ -1542,6 +1543,9 @@ When set, it enforces these options:
 .It
 .Va WITHOUT_AUTHPF
 .El
+.It Va WITH_PIE
+Build dynamically linked binaries as
+Position-Independent Executable (PIE).
 .It Va WITHOUT_PKGBOOTSTRAP
 Set to not build
 .Xr pkg 7
___
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: r344179 - in head: kerberos5/tools/asn1_compile kerberos5/tools/slc lib/clang libexec/rtld-elf share/mk stand/i386 tools/build/options usr.bin/clang usr.bin/svn

2019-02-15 Thread Ed Maste
Author: emaste
Date: Fri Feb 15 22:22:38 2019
New Revision: 344179
URL: https://svnweb.freebsd.org/changeset/base/344179

Log:
  Add WITH_PIE knob to build Position Independent Executables
  
  Building binaries as PIE allows the executable itself to be loaded at a
  random address when ASLR is enabled (not just its shared libraries).
  
  With this change PIE objects have a .pieo extension and INTERNALLIB
  libraries libXXX_pie.a.
  
  MK_PIE is disabled for some kerberos5 tools, Clang, and Subversion, as
  they explicitly reference .a libraries in their Makefiles.  These can
  be addressed on an individual basis later.  MK_PIE is also disabled for
  rtld-elf because it is already position-independent using bespoke
  Makefile rules.
  
  Currently only dynamically linked binaries will be built as PIE.
  
  Discussed with:   dim
  Reviewed by:  kib
  MFC after:1 month
  Relnotes: Yes
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D18423

Added:
  head/tools/build/options/WITHOUT_PIE   (contents, props changed)
  head/tools/build/options/WITH_PIE   (contents, props changed)
Modified:
  head/kerberos5/tools/asn1_compile/Makefile
  head/kerberos5/tools/slc/Makefile
  head/lib/clang/Makefile.inc
  head/libexec/rtld-elf/Makefile
  head/share/mk/bsd.lib.mk
  head/share/mk/bsd.opts.mk
  head/share/mk/bsd.prog.mk
  head/share/mk/src.libnames.mk
  head/stand/i386/Makefile.inc
  head/usr.bin/clang/Makefile.inc
  head/usr.bin/svn/Makefile.inc

Modified: head/kerberos5/tools/asn1_compile/Makefile
==
--- head/kerberos5/tools/asn1_compile/Makefile  Fri Feb 15 21:50:45 2019
(r344178)
+++ head/kerberos5/tools/asn1_compile/Makefile  Fri Feb 15 22:22:38 2019
(r344179)
@@ -6,6 +6,7 @@ LIBROKEN_A= ${.OBJDIR:H:H}/lib/libroken/libroken.a
 LIBADD=vers
 LDADD= ${LIBROKEN_A}
 DPADD= ${LIBROKEN_A}
+MK_PIE:=   no
 
 SRCS=  \
asn1parse.y \

Modified: head/kerberos5/tools/slc/Makefile
==
--- head/kerberos5/tools/slc/Makefile   Fri Feb 15 21:50:45 2019
(r344178)
+++ head/kerberos5/tools/slc/Makefile   Fri Feb 15 22:22:38 2019
(r344179)
@@ -6,6 +6,7 @@ LIBADD= vers
 LDADD=  ${LIBROKEN_A}
 DPADD=  ${LIBROKEN_A}
 MAN=
+MK_PIE:=   no
 
 SRCS=  roken.h \
slc-gram.y \

Modified: head/lib/clang/Makefile.inc
==
--- head/lib/clang/Makefile.inc Fri Feb 15 21:50:45 2019(r344178)
+++ head/lib/clang/Makefile.inc Fri Feb 15 22:22:38 2019(r344179)
@@ -2,6 +2,8 @@
 
 .include 
 
+MK_PIE:=   no  # Explicit libXXX.a references
+
 .if ${COMPILER_TYPE} == "clang"
 DEBUG_FILES_CFLAGS= -gline-tables-only
 .else

Modified: head/libexec/rtld-elf/Makefile
==
--- head/libexec/rtld-elf/Makefile  Fri Feb 15 21:50:45 2019
(r344178)
+++ head/libexec/rtld-elf/Makefile  Fri Feb 15 22:22:38 2019
(r344179)
@@ -7,6 +7,7 @@
 .include 
 PACKAGE=   clibs
 MK_BIND_NOW=   no
+MK_PIE=no # Always position independent using local rules
 MK_SSP=no
 
 CONFS= libmap.conf

Modified: head/share/mk/bsd.lib.mk
==
--- head/share/mk/bsd.lib.mkFri Feb 15 21:50:45 2019(r344178)
+++ head/share/mk/bsd.lib.mkFri Feb 15 22:22:38 2019(r344179)
@@ -91,13 +91,16 @@ CTFFLAGS+= -g
 # prefer .s to a .c, add .po, remove stuff not used in the BSD libraries
 # .pico used for PIC object files
 # .nossppico used for NOSSP PIC object files
-.SUFFIXES: .out .o .bc .ll .po .pico .nossppico .S .asm .s .c .cc .cpp .cxx .C 
.f .y .l .ln
+# .pieo used for PIE object files
+.SUFFIXES: .out .o .bc .ll .po .pico .nossppico .pieo .S .asm .s .c .cc .cpp 
.cxx .C .f .y .l .ln
 
 .if !defined(PICFLAG)
 .if ${MACHINE_CPUARCH} == "sparc64"
 PICFLAG=-fPIC
+PIEFLAG=-fPIE
 .else
 PICFLAG=-fpic
+PIEFLAG=-fpie
 .endif
 .endif
 
@@ -115,6 +118,10 @@ PO_FLAG=-pg
${CC} ${PICFLAG} -DPIC ${SHARED_CFLAGS:C/^-fstack-protector.*$//} 
${CFLAGS:C/^-fstack-protector.*$//} -c ${.IMPSRC} -o ${.TARGET}
${CTFCONVERT_CMD}
 
+.c.pieo:
+   ${CC} ${PIEFLAG} -DPIC ${SHARED_CFLAGS} ${CFLAGS} -c ${.IMPSRC} -o 
${.TARGET}
+   ${CTFCONVERT_CMD}
+
 .cc.po .C.po .cpp.po .cxx.po:
${CXX} ${PO_FLAG} ${STATIC_CXXFLAGS} ${PO_CXXFLAGS} -c ${.IMPSRC} -o 
${.TARGET}
 
@@ -124,6 +131,9 @@ PO_FLAG=-pg
 .cc.nossppico .C.nossppico .cpp.nossppico .cxx.nossppico:
${CXX} ${PICFLAG} -DPIC ${SHARED_CXXFLAGS:C/^-fstack-protector.*$//} 
${CXXFLAGS:C/^-fstack-protector.*$//} -c ${.IMPSRC} -o ${.TARGET}
 
+.cc.pieo .C.pieo .cpp.pieo .cxx.pieo:
+   ${CXX} ${PIEFLAG} ${SHARED_CXXFLAGS} ${CXXFLAGS} -c ${.IMPSRC} 

svn commit: r344176 - stable/12/sys/dev/sound/pci/hda

2019-02-15 Thread Vladimir Kondratyev
Author: wulf
Date: Fri Feb 15 20:52:32 2019
New Revision: 344176
URL: https://svnweb.freebsd.org/changeset/base/344176

Log:
  MFC r343327:
  
  Add quirk to enable mic and headphones redirection on HP Spectre laptops.
  
  Tested on HP Spectre 13 AF006UR.

Modified:
  stable/12/sys/dev/sound/pci/hda/hdaa_patches.c
  stable/12/sys/dev/sound/pci/hda/hdac.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/sound/pci/hda/hdaa_patches.c
==
--- stable/12/sys/dev/sound/pci/hda/hdaa_patches.c  Fri Feb 15 20:49:32 
2019(r344175)
+++ stable/12/sys/dev/sound/pci/hda/hdaa_patches.c  Fri Feb 15 20:52:32 
2019(r344176)
@@ -410,6 +410,18 @@ hdac_pin_patch(struct hdaa_widget *w)
patch = "as=1 seq=15";
break;
}
+   } else if (id == HDA_CODEC_ALC295 && subid == HP_AF006UR_SUBVENDOR) {
+   switch (nid) {
+   case 18:
+   patch = "as=2";
+   break;
+   case 25:
+   patch = "as=2 seq=15";
+   break;
+   case 33:
+   patch = "as=1 seq=15";
+   break;
+   }
} else if (id == HDA_CODEC_ALC298 && subid == DELL_XPS9560_SUBVENDOR) {
switch (nid) {
case 24:

Modified: stable/12/sys/dev/sound/pci/hda/hdac.h
==
--- stable/12/sys/dev/sound/pci/hda/hdac.h  Fri Feb 15 20:49:32 2019
(r344175)
+++ stable/12/sys/dev/sound/pci/hda/hdac.h  Fri Feb 15 20:52:32 2019
(r344176)
@@ -188,6 +188,7 @@
 #define HP_DV5000_SUBVENDORHDA_MODEL_CONSTRUCT(HP, 0x30a5)
 #define HP_DC7700S_SUBVENDOR   HDA_MODEL_CONSTRUCT(HP, 0x2801)
 #define HP_DC7700_SUBVENDORHDA_MODEL_CONSTRUCT(HP, 0x2802)
+#define HP_AF006UR_SUBVENDOR   HDA_MODEL_CONSTRUCT(HP, 0x83a2)
 #define HP_ALL_SUBVENDOR   HDA_MODEL_CONSTRUCT(HP, 0x)
 /* What is wrong with XN 2563 anyway? (Got the picture ?) */
 #define HP_NX6325_SUBVENDORX   0x103c30b0
___
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: r344171 - vendor/compiler-rt/compiler-rt-release_80-r354130

2019-02-15 Thread Dimitry Andric
Author: dim
Date: Fri Feb 15 20:49:15 2019
New Revision: 344171
URL: https://svnweb.freebsd.org/changeset/base/344171

Log:
  Tag compiler-rt release_80 branch r354130.

Added:
  vendor/compiler-rt/compiler-rt-release_80-r354130/
 - copied from r344170, vendor/compiler-rt/dist-release_80/
___
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: r344174 - vendor/lld/lld-release_80-r354130

2019-02-15 Thread Dimitry Andric
Author: dim
Date: Fri Feb 15 20:49:29 2019
New Revision: 344174
URL: https://svnweb.freebsd.org/changeset/base/344174

Log:
  Tag lld release_80 branch r354130.

Added:
  vendor/lld/lld-release_80-r354130/
 - copied from r344173, vendor/lld/dist-release_80/
___
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: r344169 - vendor/clang/clang-release_80-r354130

2019-02-15 Thread Dimitry Andric
Author: dim
Date: Fri Feb 15 20:49:08 2019
New Revision: 344169
URL: https://svnweb.freebsd.org/changeset/base/344169

Log:
  Tag clang release_80 branch r354130.

Added:
  vendor/clang/clang-release_80-r354130/
 - copied from r344168, vendor/clang/dist-release_80/
___
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: r344172 - vendor/libc++/libc++-release_80-r354130

2019-02-15 Thread Dimitry Andric
Author: dim
Date: Fri Feb 15 20:49:19 2019
New Revision: 344172
URL: https://svnweb.freebsd.org/changeset/base/344172

Log:
  Tag libc++ release_80 branch r354130.

Added:
  vendor/libc++/libc++-release_80-r354130/
 - copied from r344171, vendor/libc++/dist-release_80/
___
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: r344173 - in vendor/lld/dist-release_80: COFF ELF docs test/COFF test/ELF test/wasm test/wasm/lto wasm

2019-02-15 Thread Dimitry Andric
Author: dim
Date: Fri Feb 15 20:49:22 2019
New Revision: 344173
URL: https://svnweb.freebsd.org/changeset/base/344173

Log:
  Vendor import of lld release_80 branch r354130:
  https://llvm.org/svn/llvm-project/lld/branches/release_80@354130

Added:
  vendor/lld/dist-release_80/test/wasm/import-module.ll
  vendor/lld/dist-release_80/test/wasm/import-names.ll
  vendor/lld/dist-release_80/test/wasm/lto/relocatable-undefined.ll
Modified:
  vendor/lld/dist-release_80/COFF/PDB.cpp
  vendor/lld/dist-release_80/ELF/Driver.cpp
  vendor/lld/dist-release_80/ELF/ScriptParser.cpp
  vendor/lld/dist-release_80/docs/ReleaseNotes.rst
  vendor/lld/dist-release_80/docs/index.rst
  vendor/lld/dist-release_80/docs/missingkeyfunction.rst
  vendor/lld/dist-release_80/test/COFF/pdb-relative-source-lines.test
  vendor/lld/dist-release_80/test/ELF/emulation-mips.s
  vendor/lld/dist-release_80/test/ELF/emulation-ppc.s
  vendor/lld/dist-release_80/test/wasm/data-layout.ll
  vendor/lld/dist-release_80/test/wasm/init-fini.ll
  vendor/lld/dist-release_80/test/wasm/locals-duplicate.test
  vendor/lld/dist-release_80/test/wasm/weak-alias.ll
  vendor/lld/dist-release_80/wasm/Driver.cpp
  vendor/lld/dist-release_80/wasm/InputChunks.cpp
  vendor/lld/dist-release_80/wasm/InputFiles.cpp
  vendor/lld/dist-release_80/wasm/LTO.cpp
  vendor/lld/dist-release_80/wasm/LTO.h
  vendor/lld/dist-release_80/wasm/MarkLive.cpp
  vendor/lld/dist-release_80/wasm/SymbolTable.cpp
  vendor/lld/dist-release_80/wasm/SymbolTable.h
  vendor/lld/dist-release_80/wasm/Symbols.h
  vendor/lld/dist-release_80/wasm/Writer.cpp
  vendor/lld/dist-release_80/wasm/Writer.h

Modified: vendor/lld/dist-release_80/COFF/PDB.cpp
==
--- vendor/lld/dist-release_80/COFF/PDB.cpp Fri Feb 15 20:49:19 2019
(r344172)
+++ vendor/lld/dist-release_80/COFF/PDB.cpp Fri Feb 15 20:49:22 2019
(r344173)
@@ -288,18 +288,24 @@ static void pdbMakeAbsolute(SmallVectorImpl 
   // It's not absolute in any path syntax.  Relative paths necessarily refer to
   // the local file system, so we can make it native without ending up with a
   // nonsensical path.
-  sys::path::native(FileName);
   if (Config->PDBSourcePath.empty()) {
+sys::path::native(FileName);
 sys::fs::make_absolute(FileName);
 return;
   }
-  // Only apply native and dot removal to the relative file path.  We want to
-  // leave the path the user specified untouched since we assume they specified
-  // it for a reason.
-  sys::path::remove_dots(FileName, /*remove_dot_dots=*/true);
 
+  // Try to guess whether /PDBSOURCEPATH is a unix path or a windows path.
+  // Since PDB's are more of a Windows thing, we make this conservative and 
only
+  // decide that it's a unix path if we're fairly certain.  Specifically, if
+  // it starts with a forward slash.
   SmallString<128> AbsoluteFileName = Config->PDBSourcePath;
-  sys::path::append(AbsoluteFileName, FileName);
+  sys::path::Style GuessedStyle = AbsoluteFileName.startswith("/")
+  ? sys::path::Style::posix
+  : sys::path::Style::windows;
+  sys::path::append(AbsoluteFileName, GuessedStyle, FileName);
+  sys::path::native(AbsoluteFileName, GuessedStyle);
+  sys::path::remove_dots(AbsoluteFileName, true, GuessedStyle);
+
   FileName = std::move(AbsoluteFileName);
 }
 

Modified: vendor/lld/dist-release_80/ELF/Driver.cpp
==
--- vendor/lld/dist-release_80/ELF/Driver.cpp   Fri Feb 15 20:49:19 2019
(r344172)
+++ vendor/lld/dist-release_80/ELF/Driver.cpp   Fri Feb 15 20:49:22 2019
(r344173)
@@ -130,7 +130,7 @@ static std::tuple parseEmu
   .Cases("elf32btsmip", "elf32btsmipn32", {ELF32BEKind, EM_MIPS})
   .Cases("elf32ltsmip", "elf32ltsmipn32", {ELF32LEKind, EM_MIPS})
   .Case("elf32lriscv", {ELF32LEKind, EM_RISCV})
-  .Case("elf32ppc", {ELF32BEKind, EM_PPC})
+  .Cases("elf32ppc", "elf32ppclinux", {ELF32BEKind, EM_PPC})
   .Case("elf64btsmip", {ELF64BEKind, EM_MIPS})
   .Case("elf64ltsmip", {ELF64LEKind, EM_MIPS})
   .Case("elf64lriscv", {ELF64LEKind, EM_RISCV})

Modified: vendor/lld/dist-release_80/ELF/ScriptParser.cpp
==
--- vendor/lld/dist-release_80/ELF/ScriptParser.cpp Fri Feb 15 20:49:19 
2019(r344172)
+++ vendor/lld/dist-release_80/ELF/ScriptParser.cpp Fri Feb 15 20:49:22 
2019(r344173)
@@ -392,10 +392,11 @@ static std::pair parseBfdName(Strin
   .Case("elf32-x86-64", {ELF32LEKind, EM_X86_64})
   .Case("elf64-aarch64", {ELF64LEKind, EM_AARCH64})
   .Case("elf64-littleaarch64", {ELF64LEKind, EM_AARCH64})
+  .Case("elf32-powerpc", {ELF32BEKind, EM_PPC})
   .Case("elf64-powerpc", {ELF64BEKind, EM_PPC64})
   .Case("elf64-powerpcle", 

svn commit: r344167 - vendor/llvm/llvm-release_80-r354130

2019-02-15 Thread Dimitry Andric
Author: dim
Date: Fri Feb 15 20:48:59 2019
New Revision: 344167
URL: https://svnweb.freebsd.org/changeset/base/344167

Log:
  Tag llvm release_80 branch r354130.

Added:
  vendor/llvm/llvm-release_80-r354130/
 - copied from r344166, vendor/llvm/dist-release_80/
___
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: r344175 - vendor/lldb/lldb-release_80-r354130

2019-02-15 Thread Dimitry Andric
Author: dim
Date: Fri Feb 15 20:49:32 2019
New Revision: 344175
URL: https://svnweb.freebsd.org/changeset/base/344175

Log:
  Tag lldb release_80 branch r354130.

Added:
  vendor/lldb/lldb-release_80-r354130/
 - copied from r344174, vendor/lldb/dist-release_80/
___
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: r344168 - in vendor/clang/dist-release_80: docs include/clang/Basic include/clang/Driver include/clang/Parse include/clang/Sema lib/Basic/Targets lib/CodeGen lib/Driver/ToolChains lib/F...

2019-02-15 Thread Dimitry Andric
Author: dim
Date: Fri Feb 15 20:49:05 2019
New Revision: 344168
URL: https://svnweb.freebsd.org/changeset/base/344168

Log:
  Vendor import of clang release_80 branch r354130:
  https://llvm.org/svn/llvm-project/cfe/branches/release_80@354130

Added:
  vendor/clang/dist-release_80/test/Analysis/PR40625.cpp
  vendor/clang/dist-release_80/test/CodeGen/wasm-import-module.c
  vendor/clang/dist-release_80/test/CodeGen/wasm-import-name.c
Modified:
  vendor/clang/dist-release_80/docs/AttributeReference.rst
  vendor/clang/dist-release_80/docs/ClangCommandLineReference.rst
  vendor/clang/dist-release_80/include/clang/Basic/Attr.td
  vendor/clang/dist-release_80/include/clang/Basic/AttrDocs.td
  vendor/clang/dist-release_80/include/clang/Basic/BuiltinsAArch64.def
  vendor/clang/dist-release_80/include/clang/Basic/DiagnosticSemaKinds.td
  vendor/clang/dist-release_80/include/clang/Basic/OpenCLOptions.h
  vendor/clang/dist-release_80/include/clang/Driver/Options.td
  vendor/clang/dist-release_80/include/clang/Parse/Parser.h
  vendor/clang/dist-release_80/include/clang/Sema/Sema.h
  vendor/clang/dist-release_80/lib/Basic/Targets/PPC.h
  vendor/clang/dist-release_80/lib/CodeGen/CGBuiltin.cpp
  vendor/clang/dist-release_80/lib/CodeGen/CGDecl.cpp
  vendor/clang/dist-release_80/lib/CodeGen/CodeGenModule.cpp
  vendor/clang/dist-release_80/lib/CodeGen/TargetInfo.cpp
  vendor/clang/dist-release_80/lib/Driver/ToolChains/MSVC.cpp
  vendor/clang/dist-release_80/lib/Frontend/InitPreprocessor.cpp
  vendor/clang/dist-release_80/lib/Headers/intrin.h
  vendor/clang/dist-release_80/lib/Parse/ParseObjc.cpp
  vendor/clang/dist-release_80/lib/Parse/ParseOpenMP.cpp
  vendor/clang/dist-release_80/lib/Parse/ParsePragma.cpp
  vendor/clang/dist-release_80/lib/Parse/ParseStmt.cpp
  vendor/clang/dist-release_80/lib/Parse/ParseStmtAsm.cpp
  vendor/clang/dist-release_80/lib/Sema/Sema.cpp
  vendor/clang/dist-release_80/lib/Sema/SemaChecking.cpp
  vendor/clang/dist-release_80/lib/Sema/SemaCoroutine.cpp
  vendor/clang/dist-release_80/lib/Sema/SemaDecl.cpp
  vendor/clang/dist-release_80/lib/Sema/SemaDeclAttr.cpp
  vendor/clang/dist-release_80/lib/Sema/SemaDeclCXX.cpp
  vendor/clang/dist-release_80/lib/Sema/SemaExpr.cpp
  vendor/clang/dist-release_80/lib/Sema/SemaExprCXX.cpp
  vendor/clang/dist-release_80/lib/Sema/SemaLambda.cpp
  vendor/clang/dist-release_80/lib/Sema/SemaOpenMP.cpp
  vendor/clang/dist-release_80/lib/Sema/SemaStmt.cpp
  vendor/clang/dist-release_80/lib/Sema/TreeTransform.h
  vendor/clang/dist-release_80/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
  vendor/clang/dist-release_80/test/Analysis/uninit-vals.m
  vendor/clang/dist-release_80/test/CXX/stmt.stmt/stmt.select/p3.cpp
  vendor/clang/dist-release_80/test/CodeCompletion/pragma-macro-token-caching.c
  vendor/clang/dist-release_80/test/CodeGen/arm64-microsoft-status-reg.cpp
  vendor/clang/dist-release_80/test/CodeGen/microsoft-no-common-align.c
  vendor/clang/dist-release_80/test/CodeGen/powerpc_types.c
  vendor/clang/dist-release_80/test/CodeGenCXX/trivial-auto-var-init.cpp
  vendor/clang/dist-release_80/test/Driver/cl-options.c
  
vendor/clang/dist-release_80/test/Misc/pragma-attribute-supported-attributes-list.test
  vendor/clang/dist-release_80/test/Parser/cxx1z-init-statement.cpp
  vendor/clang/dist-release_80/test/Parser/switch-recovery.cpp
  vendor/clang/dist-release_80/test/SemaCXX/cxx1z-init-statement.cpp
  vendor/clang/dist-release_80/test/SemaCXX/for-range-examples.cpp
  vendor/clang/dist-release_80/test/SemaCXX/warn-float-conversion.cpp
  vendor/clang/dist-release_80/test/SemaCXX/warn-unused-result.cpp
  vendor/clang/dist-release_80/test/SemaObjC/attr-designated-init.m
  vendor/clang/dist-release_80/test/SemaObjC/conversion.m
  vendor/clang/dist-release_80/test/SemaOpenCL/extension-version.cl
  vendor/clang/dist-release_80/test/SemaOpenCL/extensions.cl

Modified: vendor/clang/dist-release_80/docs/AttributeReference.rst
==
--- vendor/clang/dist-release_80/docs/AttributeReference.rstFri Feb 15 
20:48:59 2019(r344167)
+++ vendor/clang/dist-release_80/docs/AttributeReference.rstFri Feb 15 
20:49:05 2019(r344168)
@@ -1,13 +1,5176 @@
 ..
   ---
   NOTE: This file is automatically generated by running clang-tblgen
-  -gen-attr-docs. Do not edit this file by hand!! The contents for
-  this file are automatically generated by a server-side process.
-  
-  Please do not commit this file. The file exists for local testing
-  purposes only.
+  -gen-attr-docs. Do not edit this file by hand!!
   ---
 
 ===
 Attributes in Clang
-===
\ No newline at end of file
+===
+.. contents::
+   :local:
+
+.. |br| raw:: html
+
+  
+
+Introduction
+
+
+This page lists the attributes currently supported by Clang.

svn commit: r344170 - in vendor/compiler-rt/dist-release_80: lib/sanitizer_common utils

2019-02-15 Thread Dimitry Andric
Author: dim
Date: Fri Feb 15 20:49:11 2019
New Revision: 344170
URL: https://svnweb.freebsd.org/changeset/base/344170

Log:
  Vendor import of compiler-rt release_80 branch r354130:
  https://llvm.org/svn/llvm-project/compiler-rt/branches/release_80@354130

Modified:
  
vendor/compiler-rt/dist-release_80/lib/sanitizer_common/sanitizer_interceptors_ioctl_netbsd.inc
  
vendor/compiler-rt/dist-release_80/lib/sanitizer_common/sanitizer_platform_limits_netbsd.cc
  
vendor/compiler-rt/dist-release_80/lib/sanitizer_common/sanitizer_platform_limits_netbsd.h
  vendor/compiler-rt/dist-release_80/utils/generate_netbsd_ioctls.awk

Modified: 
vendor/compiler-rt/dist-release_80/lib/sanitizer_common/sanitizer_interceptors_ioctl_netbsd.inc
==
--- 
vendor/compiler-rt/dist-release_80/lib/sanitizer_common/sanitizer_interceptors_ioctl_netbsd.inc
 Fri Feb 15 20:49:08 2019(r344169)
+++ 
vendor/compiler-rt/dist-release_80/lib/sanitizer_common/sanitizer_interceptors_ioctl_netbsd.inc
 Fri Feb 15 20:49:11 2019(r344170)
@@ -25,7 +25,7 @@ struct ioctl_desc {
   const char *name;
 };
 
-const unsigned ioctl_table_max = 1202;
+const unsigned ioctl_table_max = 1200;
 static ioctl_desc ioctl_table[ioctl_table_max];
 static unsigned ioctl_table_size = 0;
 
@@ -298,9 +298,6 @@ static void ioctl_table_fill() {
   _(IRFRAMETTY_GET_DEVICE, WRITE, sizeof(unsigned int));
   _(IRFRAMETTY_GET_DONGLE, WRITE, sizeof(unsigned int));
   _(IRFRAMETTY_SET_DONGLE, READ, sizeof(unsigned int));
-  /* Entries from file: dev/isa/satlinkio.h */
-  _(SATIORESET, NONE, 0);
-  _(SATIOGID, WRITE, struct_satlink_id_sz);
   /* Entries from file: dev/isa/isvio.h */
   _(ISV_CMD, READWRITE, struct_isv_cmd_sz);
   /* Entries from file: dev/isa/wtreg.h */
@@ -649,8 +646,8 @@ static void ioctl_table_fill() {
   _(SPKRTUNE, NONE, 0);
   _(SPKRGETVOL, WRITE, sizeof(unsigned int));
   _(SPKRSETVOL, READ, sizeof(unsigned int));
-  /* Entries from file: dev/nvmm/nvmm_ioctl.h */
 #if 0 /* WIP */
+  /* Entries from file: dev/nvmm/nvmm_ioctl.h */
   _(NVMM_IOC_CAPABILITY, WRITE, struct_nvmm_ioc_capability_sz);
   _(NVMM_IOC_MACHINE_CREATE, READWRITE, struct_nvmm_ioc_machine_create_sz);
   _(NVMM_IOC_MACHINE_DESTROY, READ, struct_nvmm_ioc_machine_destroy_sz);
@@ -659,7 +656,7 @@ static void ioctl_table_fill() {
   _(NVMM_IOC_VCPU_DESTROY, READ, struct_nvmm_ioc_vcpu_destroy_sz);
   _(NVMM_IOC_VCPU_SETSTATE, READ, struct_nvmm_ioc_vcpu_setstate_sz);
   _(NVMM_IOC_VCPU_GETSTATE, READ, struct_nvmm_ioc_vcpu_getstate_sz);
-  _(NVMM_IOC_VCPU_INJECT, READWRITE, struct_nvmm_ioc_vcpu_inject_sz);
+  _(NVMM_IOC_VCPU_INJECT, READ, struct_nvmm_ioc_vcpu_inject_sz);
   _(NVMM_IOC_VCPU_RUN, READWRITE, struct_nvmm_ioc_vcpu_run_sz);
   _(NVMM_IOC_GPA_MAP, READ, struct_nvmm_ioc_gpa_map_sz);
   _(NVMM_IOC_GPA_UNMAP, READ, struct_nvmm_ioc_gpa_unmap_sz);

Modified: 
vendor/compiler-rt/dist-release_80/lib/sanitizer_common/sanitizer_platform_limits_netbsd.cc
==
--- 
vendor/compiler-rt/dist-release_80/lib/sanitizer_common/sanitizer_platform_limits_netbsd.cc
 Fri Feb 15 20:49:08 2019(r344169)
+++ 
vendor/compiler-rt/dist-release_80/lib/sanitizer_common/sanitizer_platform_limits_netbsd.cc
 Fri Feb 15 20:49:11 2019(r344170)
@@ -122,7 +122,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -639,7 +638,6 @@ unsigned struct_rf_recon_req_sz = sizeof(rf_recon_req)
 unsigned struct_rio_conf_sz = sizeof(rio_conf);
 unsigned struct_rio_interface_sz = sizeof(rio_interface);
 unsigned struct_rio_stats_sz = sizeof(rio_stats);
-unsigned struct_satlink_id_sz = sizeof(satlink_id);
 unsigned struct_scan_io_sz = sizeof(scan_io);
 unsigned struct_scbusaccel_args_sz = sizeof(scbusaccel_args);
 unsigned struct_scbusiodetach_args_sz = sizeof(scbusiodetach_args);
@@ -1105,9 +1103,6 @@ unsigned IOCTL_IRDA_GET_TURNAROUNDMASK = IRDA_GET_TURN
 unsigned IOCTL_IRFRAMETTY_GET_DEVICE = IRFRAMETTY_GET_DEVICE;
 unsigned IOCTL_IRFRAMETTY_GET_DONGLE = IRFRAMETTY_GET_DONGLE;
 unsigned IOCTL_IRFRAMETTY_SET_DONGLE = IRFRAMETTY_SET_DONGLE;
-unsigned IOCTL_SATIORESET = SATIORESET;
-unsigned IOCTL_SATIOGID = SATIOGID;
-unsigned IOCTL_SATIOSBUFSIZE = SATIOSBUFSIZE;
 unsigned IOCTL_ISV_CMD = ISV_CMD;
 unsigned IOCTL_WTQICMD = WTQICMD;
 unsigned IOCTL_ISCSI_GET_VERSION = ISCSI_GET_VERSION;

Modified: 
vendor/compiler-rt/dist-release_80/lib/sanitizer_common/sanitizer_platform_limits_netbsd.h
==
--- 
vendor/compiler-rt/dist-release_80/lib/sanitizer_common/sanitizer_platform_limits_netbsd.h
  Fri Feb 15 20:49:08 2019(r344169)
+++ 
vendor/compiler-rt/dist-release_80/lib/sanitizer_common/sanitizer_platform_limits_netbsd.h
  Fri Feb 15 20:49:11 2019(r344170)
@@ -803,7 +803,6 @@ extern unsigned struct_rf_recon_req_sz;
 extern unsigned 

svn commit: r344166 - in vendor/llvm/dist-release_80: . bindings/go/llvm cmake/modules docs include/llvm/BinaryFormat include/llvm/MC lib/Analysis lib/MC lib/MC/MCParser lib/Object lib/Support/Unix...

2019-02-15 Thread Dimitry Andric
Author: dim
Date: Fri Feb 15 20:48:51 2019
New Revision: 344166
URL: https://svnweb.freebsd.org/changeset/base/344166

Log:
  Vendor import of llvm release_80 branch r354130:
  https://llvm.org/svn/llvm-project/llvm/branches/release_80@354130

Added:
  vendor/llvm/dist-release_80/test/CodeGen/AArch64/cmpxchg-lse-even-regs.ll
  vendor/llvm/dist-release_80/test/CodeGen/AArch64/seqpaircopy.mir
  vendor/llvm/dist-release_80/test/CodeGen/WebAssembly/main-three-args.ll
  vendor/llvm/dist-release_80/test/CodeGen/X86/inline-asm-default-clobbers.ll
  vendor/llvm/dist-release_80/test/CodeGen/X86/pr40529.ll
  
vendor/llvm/dist-release_80/test/Instrumentation/MemorySanitizer/global_ctors_2to3.ll
  vendor/llvm/dist-release_80/test/MC/WebAssembly/import-module.ll
Deleted:
  vendor/llvm/dist-release_80/test/MC/MachO/file-single.s
Modified:
  vendor/llvm/dist-release_80/CMakeLists.txt
  vendor/llvm/dist-release_80/bindings/go/llvm/ir_test.go
  vendor/llvm/dist-release_80/cmake/modules/CheckCompilerVersion.cmake
  vendor/llvm/dist-release_80/cmake/modules/CrossCompile.cmake
  vendor/llvm/dist-release_80/docs/CMake.rst
  vendor/llvm/dist-release_80/docs/DeveloperPolicy.rst
  vendor/llvm/dist-release_80/docs/GettingStarted.rst
  vendor/llvm/dist-release_80/docs/LibFuzzer.rst
  vendor/llvm/dist-release_80/docs/ReleaseNotes.rst
  vendor/llvm/dist-release_80/include/llvm/BinaryFormat/Wasm.h
  vendor/llvm/dist-release_80/include/llvm/MC/MCSymbolWasm.h
  vendor/llvm/dist-release_80/lib/Analysis/TargetLibraryInfo.cpp
  vendor/llvm/dist-release_80/lib/MC/MCExpr.cpp
  vendor/llvm/dist-release_80/lib/MC/MCParser/AsmParser.cpp
  vendor/llvm/dist-release_80/lib/MC/WasmObjectWriter.cpp
  vendor/llvm/dist-release_80/lib/Object/WasmObjectFile.cpp
  vendor/llvm/dist-release_80/lib/Support/Unix/Threading.inc
  vendor/llvm/dist-release_80/lib/Target/AArch64/AArch64InstrInfo.cpp
  vendor/llvm/dist-release_80/lib/Target/AArch64/AArch64InstrInfo.h
  vendor/llvm/dist-release_80/lib/Target/AArch64/AArch64RegisterInfo.td
  
vendor/llvm/dist-release_80/lib/Target/AArch64/Disassembler/AArch64Disassembler.cpp
  vendor/llvm/dist-release_80/lib/Target/SystemZ/SystemZISelLowering.cpp
  vendor/llvm/dist-release_80/lib/Target/SystemZ/SystemZInstrInfo.cpp
  vendor/llvm/dist-release_80/lib/Target/SystemZ/SystemZInstrInfo.h
  vendor/llvm/dist-release_80/lib/Target/SystemZ/SystemZSelectionDAGInfo.cpp
  
vendor/llvm/dist-release_80/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.cpp
  
vendor/llvm/dist-release_80/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.h
  vendor/llvm/dist-release_80/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
  
vendor/llvm/dist-release_80/lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp
  vendor/llvm/dist-release_80/lib/Target/X86/AsmParser/X86AsmParser.cpp
  vendor/llvm/dist-release_80/lib/Target/X86/InstPrinter/X86ATTInstPrinter.cpp
  vendor/llvm/dist-release_80/lib/Target/X86/InstPrinter/X86ATTInstPrinter.h
  vendor/llvm/dist-release_80/lib/Target/X86/InstPrinter/X86IntelInstPrinter.cpp
  vendor/llvm/dist-release_80/lib/Target/X86/InstPrinter/X86IntelInstPrinter.h
  vendor/llvm/dist-release_80/lib/Target/X86/X86ISelLowering.cpp
  vendor/llvm/dist-release_80/lib/Target/X86/X86InstrFPStack.td
  vendor/llvm/dist-release_80/lib/Target/X86/X86InstrInfo.td
  vendor/llvm/dist-release_80/lib/Target/X86/X86RegisterInfo.cpp
  vendor/llvm/dist-release_80/lib/Target/X86/X86RegisterInfo.td
  vendor/llvm/dist-release_80/lib/Transforms/Instrumentation/MemorySanitizer.cpp
  vendor/llvm/dist-release_80/test/CodeGen/MIR/X86/memory-operands.mir
  vendor/llvm/dist-release_80/test/CodeGen/Mips/micromips-b-range.ll
  vendor/llvm/dist-release_80/test/CodeGen/SystemZ/memcmp-01.ll
  vendor/llvm/dist-release_80/test/CodeGen/SystemZ/strcmp-01.ll
  vendor/llvm/dist-release_80/test/CodeGen/WebAssembly/call.ll
  
vendor/llvm/dist-release_80/test/CodeGen/WebAssembly/function-bitcasts-varargs.ll
  vendor/llvm/dist-release_80/test/CodeGen/WebAssembly/function-bitcasts.ll
  vendor/llvm/dist-release_80/test/CodeGen/WebAssembly/import-module.ll
  vendor/llvm/dist-release_80/test/CodeGen/WebAssembly/main-declaration.ll
  vendor/llvm/dist-release_80/test/CodeGen/WebAssembly/main-no-args.ll
  vendor/llvm/dist-release_80/test/CodeGen/WebAssembly/main-with-args.ll
  vendor/llvm/dist-release_80/test/CodeGen/X86/and-su.ll
  vendor/llvm/dist-release_80/test/CodeGen/X86/avx512-regcall-NoMask.ll
  vendor/llvm/dist-release_80/test/CodeGen/X86/fcmove.ll
  vendor/llvm/dist-release_80/test/CodeGen/X86/fmf-flags.ll
  vendor/llvm/dist-release_80/test/CodeGen/X86/fp-cvt.ll
  vendor/llvm/dist-release_80/test/CodeGen/X86/inline-asm-fpstack.ll
  vendor/llvm/dist-release_80/test/CodeGen/X86/ipra-reg-usage.ll
  vendor/llvm/dist-release_80/test/CodeGen/X86/pr13577.ll
  vendor/llvm/dist-release_80/test/CodeGen/X86/pr33349.ll
  vendor/llvm/dist-release_80/test/CodeGen/X86/pr34080.ll
  vendor/llvm/dist-release_80/test/CodeGen/X86/pr34177.ll
  

svn commit: r344165 - in stable/11/sys: dev/atkbdc sys

2019-02-15 Thread Vladimir Kondratyev
Author: wulf
Date: Fri Feb 15 20:46:03 2019
New Revision: 344165
URL: https://svnweb.freebsd.org/changeset/base/344165

Log:
  MFC r343163:
  
  psm(4): detect Lenovo top-button clickpads
  
  libinput has special handling for Lenovo ThinkPad *40 series, where it
  treats clicks on the top button area as if they came from the TrackPoint:
  https://wayland.freedesktop.org/libinput/doc/latest/t440-support.html
  
  Detect these devices and set the corresponding evdev property.
  
  Submitted by: Greg V 
  Differential Revision:https://reviews.freebsd.org/D18676

Modified:
  stable/11/sys/dev/atkbdc/psm.c
  stable/11/sys/sys/mouse.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/atkbdc/psm.c
==
--- stable/11/sys/dev/atkbdc/psm.c  Fri Feb 15 20:45:12 2019
(r344164)
+++ stable/11/sys/dev/atkbdc/psm.c  Fri Feb 15 20:46:03 2019
(r344165)
@@ -136,6 +136,7 @@ struct psmcpnp_softc {
enum {
PSMCPNP_GENERIC,
PSMCPNP_FORCEPAD,
+   PSMCPNP_TOPBUTTONPAD,
} type; /* Based on PnP ID */
 };
 
@@ -1823,6 +1824,8 @@ psm_register_synaptics(device_t dev)
evdev_support_prop(evdev_a, INPUT_PROP_SEMI_MT);
if (sc->synhw.capClickPad)
evdev_support_prop(evdev_a, INPUT_PROP_BUTTONPAD);
+   if (sc->synhw.capClickPad && sc->synhw.topButtonPad)
+   evdev_support_prop(evdev_a, INPUT_PROP_TOPBUTTONPAD);
evdev_support_key(evdev_a, BTN_TOUCH);
evdev_support_nfingers(evdev_a, 3);
psm_support_abs_bulk(evdev_a, synaptics_absinfo_st);
@@ -5717,7 +5720,7 @@ synaptics_sysctl_create_softbuttons_tree(struct psm_so
 */
 
/* hw.psm.synaptics.softbuttons_y */
-   sc->syninfo.softbuttons_y = 1700;
+   sc->syninfo.softbuttons_y = sc->synhw.topButtonPad ? -1700 : 1700;
SYSCTL_ADD_PROC(>syninfo.sysctl_ctx,
SYSCTL_CHILDREN(sc->syninfo.sysctl_tree), OID_AUTO,
"softbuttons_y", CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_ANYBODY,
@@ -6447,6 +6450,9 @@ enable_synaptics(struct psm_softc *sc, enum probearg a
case PSMCPNP_FORCEPAD:
synhw.forcePad = 1;
break;
+   case PSMCPNP_TOPBUTTONPAD:
+   synhw.topButtonPad = 1;
+   break;
default:
break;
}
@@ -6489,8 +6495,11 @@ enable_synaptics(struct psm_softc *sc, enum probearg a
   synhw.minimumYCoord);
}
if (synhw.capClickPad) {
+   printf("  Clickpad capabilities:\n");
printf("   forcePad: %d\n",
   synhw.forcePad);
+   printf("   topButtonPad: %d\n",
+  synhw.topButtonPad);
}
}
buttons += synhw.capClickPad;
@@ -7338,6 +7347,44 @@ static struct isa_pnp_id psmcpnp_ids[] = {
 };
 
 /* _HID list for quirk detection. Any device below has _CID from psmcpnp_ids */
+static struct isa_pnp_id topbtpad_ids[] = {
+   { 0x1700ae30, "Lenovo PS/2 clickpad port" },/* LEN0017, ThinkPad */
+   { 0x1800ae30, "Lenovo PS/2 clickpad port" },/* LEN0018, ThinkPad */
+   { 0x1900ae30, "Lenovo PS/2 clickpad port" },/* LEN0019, ThinkPad */
+   { 0x2300ae30, "Lenovo PS/2 clickpad port" },/* LEN0023, ThinkPad */
+   { 0x2a00ae30, "Lenovo PS/2 clickpad port" },/* LEN002a, ThinkPad */
+   { 0x2b00ae30, "Lenovo PS/2 clickpad port" },/* LEN002b, ThinkPad */
+   { 0x2c00ae30, "Lenovo PS/2 clickpad port" },/* LEN002c, ThinkPad */
+   { 0x2d00ae30, "Lenovo PS/2 clickpad port" },/* LEN002d, ThinkPad */
+   { 0x2e00ae30, "Lenovo PS/2 clickpad port" },/* LEN002e, ThinkPad */
+   { 0x3300ae30, "Lenovo PS/2 clickpad port" },/* LEN0033, ThinkPad */
+   { 0x3400ae30, "Lenovo PS/2 clickpad port" },/* LEN0034, ThinkPad */
+   { 0x3500ae30, "Lenovo PS/2 clickpad port" },/* LEN0035, ThinkPad */
+   { 0x3600ae30, "Lenovo PS/2 clickpad port" },/* LEN0036, ThinkPad */
+   { 0x3700ae30, "Lenovo PS/2 clickpad port" },/* LEN0037, ThinkPad */
+   { 0x3800ae30, "Lenovo PS/2 clickpad port" },/* LEN0038, ThinkPad */
+   { 0x3900ae30, "Lenovo PS/2 clickpad port" },/* LEN0039, ThinkPad */
+   { 0x4100ae30, "Lenovo PS/2 clickpad port" },/* LEN0041, ThinkPad */
+   { 0x4200ae30, "Lenovo PS/2 clickpad port" },/* 

svn commit: r344164 - in stable/12/sys: dev/atkbdc sys

2019-02-15 Thread Vladimir Kondratyev
Author: wulf
Date: Fri Feb 15 20:45:12 2019
New Revision: 344164
URL: https://svnweb.freebsd.org/changeset/base/344164

Log:
  MFC r343163:
  
  psm(4): detect Lenovo top-button clickpads
  
  libinput has special handling for Lenovo ThinkPad *40 series, where it
  treats clicks on the top button area as if they came from the TrackPoint:
  https://wayland.freedesktop.org/libinput/doc/latest/t440-support.html
  
  Detect these devices and set the corresponding evdev property.
  
  Submitted by: Greg V 
  Differential Revision:https://reviews.freebsd.org/D18676

Modified:
  stable/12/sys/dev/atkbdc/psm.c
  stable/12/sys/sys/mouse.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/atkbdc/psm.c
==
--- stable/12/sys/dev/atkbdc/psm.c  Fri Feb 15 19:13:11 2019
(r344163)
+++ stable/12/sys/dev/atkbdc/psm.c  Fri Feb 15 20:45:12 2019
(r344164)
@@ -136,6 +136,7 @@ struct psmcpnp_softc {
enum {
PSMCPNP_GENERIC,
PSMCPNP_FORCEPAD,
+   PSMCPNP_TOPBUTTONPAD,
} type; /* Based on PnP ID */
 };
 
@@ -1826,6 +1827,8 @@ psm_register_synaptics(device_t dev)
evdev_support_prop(evdev_a, INPUT_PROP_SEMI_MT);
if (sc->synhw.capClickPad)
evdev_support_prop(evdev_a, INPUT_PROP_BUTTONPAD);
+   if (sc->synhw.capClickPad && sc->synhw.topButtonPad)
+   evdev_support_prop(evdev_a, INPUT_PROP_TOPBUTTONPAD);
evdev_support_key(evdev_a, BTN_TOUCH);
evdev_support_nfingers(evdev_a, 3);
psm_support_abs_bulk(evdev_a, synaptics_absinfo_st);
@@ -5711,7 +5714,7 @@ synaptics_sysctl_create_softbuttons_tree(struct psm_so
 */
 
/* hw.psm.synaptics.softbuttons_y */
-   sc->syninfo.softbuttons_y = 1700;
+   sc->syninfo.softbuttons_y = sc->synhw.topButtonPad ? -1700 : 1700;
SYSCTL_ADD_PROC(>syninfo.sysctl_ctx,
SYSCTL_CHILDREN(sc->syninfo.sysctl_tree), OID_AUTO,
"softbuttons_y", CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_ANYBODY,
@@ -6441,6 +6444,9 @@ enable_synaptics(struct psm_softc *sc, enum probearg a
case PSMCPNP_FORCEPAD:
synhw.forcePad = 1;
break;
+   case PSMCPNP_TOPBUTTONPAD:
+   synhw.topButtonPad = 1;
+   break;
default:
break;
}
@@ -6483,8 +6489,11 @@ enable_synaptics(struct psm_softc *sc, enum probearg a
   synhw.minimumYCoord);
}
if (synhw.capClickPad) {
+   printf("  Clickpad capabilities:\n");
printf("   forcePad: %d\n",
   synhw.forcePad);
+   printf("   topButtonPad: %d\n",
+  synhw.topButtonPad);
}
}
buttons += synhw.capClickPad;
@@ -7332,6 +7341,44 @@ static struct isa_pnp_id psmcpnp_ids[] = {
 };
 
 /* _HID list for quirk detection. Any device below has _CID from psmcpnp_ids */
+static struct isa_pnp_id topbtpad_ids[] = {
+   { 0x1700ae30, "Lenovo PS/2 clickpad port" },/* LEN0017, ThinkPad */
+   { 0x1800ae30, "Lenovo PS/2 clickpad port" },/* LEN0018, ThinkPad */
+   { 0x1900ae30, "Lenovo PS/2 clickpad port" },/* LEN0019, ThinkPad */
+   { 0x2300ae30, "Lenovo PS/2 clickpad port" },/* LEN0023, ThinkPad */
+   { 0x2a00ae30, "Lenovo PS/2 clickpad port" },/* LEN002a, ThinkPad */
+   { 0x2b00ae30, "Lenovo PS/2 clickpad port" },/* LEN002b, ThinkPad */
+   { 0x2c00ae30, "Lenovo PS/2 clickpad port" },/* LEN002c, ThinkPad */
+   { 0x2d00ae30, "Lenovo PS/2 clickpad port" },/* LEN002d, ThinkPad */
+   { 0x2e00ae30, "Lenovo PS/2 clickpad port" },/* LEN002e, ThinkPad */
+   { 0x3300ae30, "Lenovo PS/2 clickpad port" },/* LEN0033, ThinkPad */
+   { 0x3400ae30, "Lenovo PS/2 clickpad port" },/* LEN0034, ThinkPad */
+   { 0x3500ae30, "Lenovo PS/2 clickpad port" },/* LEN0035, ThinkPad */
+   { 0x3600ae30, "Lenovo PS/2 clickpad port" },/* LEN0036, ThinkPad */
+   { 0x3700ae30, "Lenovo PS/2 clickpad port" },/* LEN0037, ThinkPad */
+   { 0x3800ae30, "Lenovo PS/2 clickpad port" },/* LEN0038, ThinkPad */
+   { 0x3900ae30, "Lenovo PS/2 clickpad port" },/* LEN0039, ThinkPad */
+   { 0x4100ae30, "Lenovo PS/2 clickpad port" },/* LEN0041, ThinkPad */
+   { 0x4200ae30, "Lenovo PS/2 clickpad port" },/* 

svn commit: r344163 - stable/12/sys/dev/ixl

2019-02-15 Thread Eric Joyner
Author: erj
Date: Fri Feb 15 19:13:11 2019
New Revision: 344163
URL: https://svnweb.freebsd.org/changeset/base/344163

Log:
  MFC r344132:
  
  ixl: Fix panic caused by bug exposed by r344062
  
  Don't use a struct if_irq for IFLIB_INTR_IOV type interrupts since that 
results
  in get_core_offset() being called on them, and get_core_offset() doesn't
  handle IFLIB_INTR_IOV type interrupts, which results in an assert() being 
triggered
  in iflib_irq_set_affinity().
  
  PR:   235730
  Reported by:  Jeffrey Pieper 
  Sponsored by: Intel Corporation

Modified:
  stable/12/sys/dev/ixl/if_ixl.c
  stable/12/sys/dev/ixl/ixl_pf.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/ixl/if_ixl.c
==
--- stable/12/sys/dev/ixl/if_ixl.c  Fri Feb 15 18:51:43 2019
(r344162)
+++ stable/12/sys/dev/ixl/if_ixl.c  Fri Feb 15 19:13:11 2019
(r344163)
@@ -932,7 +932,7 @@ ixl_if_msix_intr_assign(if_ctx_t ctx, int msix)
return (err);
}
/* Create soft IRQ for handling VFLRs */
-   iflib_softirq_alloc_generic(ctx, >iov_irq, IFLIB_INTR_IOV, pf, 0, 
"iov");
+   iflib_softirq_alloc_generic(ctx, NULL, IFLIB_INTR_IOV, pf, 0, "iov");
 
/* Now set up the stations */
for (i = 0, vector = 1; i < vsi->shared->isc_nrxqsets; i++, vector++, 
rx_que++) {

Modified: stable/12/sys/dev/ixl/ixl_pf.h
==
--- stable/12/sys/dev/ixl/ixl_pf.h  Fri Feb 15 18:51:43 2019
(r344162)
+++ stable/12/sys/dev/ixl/ixl_pf.h  Fri Feb 15 19:13:11 2019
(r344163)
@@ -138,7 +138,6 @@ struct ixl_pf {
struct ixl_vf   *vfs;
int num_vfs;
uint16_tveb_seid;
-   struct if_irq   iov_irq;
 };
 
 /*
___
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: r344132 - head/sys/dev/ixl

2019-02-15 Thread Eric Joyner
I thought the same thing that John wrote -- I only need re@ approval for
MFC's during the release process.

I know it's unusually fast to have an MFC period of 1 day, but this change
could fix a kernel panic when r344062 is MFC'd and doesn't result in a
functional change to the driver, so I didn't think there was a reason for
it to sit longer.

- Eric

On Thu, Feb 14, 2019 at 11:28 AM John Baldwin  wrote:

> On 2/14/19 10:22 AM, Rodney W. Grimes wrote:
> >> Author: erj
> >> Date: Thu Feb 14 18:02:37 2019
> >> New Revision: 344132
> >> URL: https://svnweb.freebsd.org/changeset/base/344132
> >>
> >> Log:
> >>   ixl: Fix panic caused by bug exposed by r344062
> >>
> >>   Don't use a struct if_irq for IFLIB_INTR_IOV type interrupts since
> that results
> >>   in get_core_offset() being called on them, and get_core_offset()
> doesn't
> >>   handle IFLIB_INTR_IOV type interrupts, which results in an assert()
> being triggered
> >>   in iflib_irq_set_affinity().
> >>
> >>   PR:235730
> >>   Reported by:   Jeffrey Pieper 
> >>   MFC after: 1 day
> >
> > Normally you would request an RE@ approval for a fast track to stable,
> > consider this message such an approval.
>
> That does not match our historical practice over the past 20 years.  If we
> want to change that practice, that's a topic we can debate, but re@ has
> only required oversight on MFC's during slushes/freezes with the additional
> caveat of perhaps watching out for ABI breakage at any time (and requiring
> approvals for a known ABI breakage on a branch).
>
> --
> John Baldwin
>
>
>
>
___
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: r344162 - head/sys/net

2019-02-15 Thread Stephen Hurd
Author: shurd
Date: Fri Feb 15 18:51:43 2019
New Revision: 344162
URL: https://svnweb.freebsd.org/changeset/base/344162

Log:
  iflib: Improve return values of interrupt handlers.
  
  iflib was returning FILTER_HANDLED, in cases where FILTER_STRAY was more
  correct. This potentially caused issues with shared legacy interrupts.
  
  Driver filters returning FILTER_STRAY are now properly handled.
  
  Submitted by: Augustin Cavalier 
  Reviewed by:  marius, gallatin
  Obtained from:Haiku (a84bb9, 4947d1)
  MFC after:1 week
  Sponsored by: Limelight Networks
  Differential Revision:https://reviews.freebsd.org/D19201

Modified:
  head/sys/net/iflib.c

Modified: head/sys/net/iflib.c
==
--- head/sys/net/iflib.cFri Feb 15 18:28:51 2019(r344161)
+++ head/sys/net/iflib.cFri Feb 15 18:51:43 2019(r344162)
@@ -1468,12 +1468,17 @@ iflib_fast_intr(void *arg)
 {
iflib_filter_info_t info = arg;
struct grouptask *gtask = info->ifi_task;
+   int result;
+
if (!iflib_started)
-   return (FILTER_HANDLED);
+   return (FILTER_STRAY);
 
DBG_COUNTER_INC(fast_intrs);
-   if (info->ifi_filter != NULL && info->ifi_filter(info->ifi_filter_arg) 
== FILTER_HANDLED)
-   return (FILTER_HANDLED);
+   if (info->ifi_filter != NULL) {
+   result = info->ifi_filter(info->ifi_filter_arg);
+   if ((result & FILTER_SCHEDULE_THREAD) == 0)
+   return (result);
+   }
 
GROUPTASK_ENQUEUE(gtask);
return (FILTER_HANDLED);
@@ -1488,15 +1493,18 @@ iflib_fast_intr_rxtx(void *arg)
iflib_rxq_t rxq = (iflib_rxq_t)info->ifi_ctx;
iflib_txq_t txq;
void *sc;
-   int i, cidx;
+   int i, cidx, result;
qidx_t txqid;
 
if (!iflib_started)
-   return (FILTER_HANDLED);
+   return (FILTER_STRAY);
 
DBG_COUNTER_INC(fast_intrs);
-   if (info->ifi_filter != NULL && info->ifi_filter(info->ifi_filter_arg) 
== FILTER_HANDLED)
-   return (FILTER_HANDLED);
+   if (info->ifi_filter != NULL) {
+   result = info->ifi_filter(info->ifi_filter_arg);
+   if ((result & FILTER_SCHEDULE_THREAD) == 0)
+   return (result);
+   }
 
ctx = rxq->ifr_ctx;
sc = ctx->ifc_softc;
@@ -1531,13 +1539,17 @@ iflib_fast_intr_ctx(void *arg)
 {
iflib_filter_info_t info = arg;
struct grouptask *gtask = info->ifi_task;
+   int result;
 
if (!iflib_started)
-   return (FILTER_HANDLED);
+   return (FILTER_STRAY);
 
DBG_COUNTER_INC(fast_intrs);
-   if (info->ifi_filter != NULL && info->ifi_filter(info->ifi_filter_arg) 
== FILTER_HANDLED)
-   return (FILTER_HANDLED);
+   if (info->ifi_filter != NULL) {
+   result = info->ifi_filter(info->ifi_filter_arg);
+   if ((result & FILTER_SCHEDULE_THREAD) == 0)
+   return (result);
+   }
 
GROUPTASK_ENQUEUE(gtask);
return (FILTER_HANDLED);
___
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: r344161 - head/stand/common

2019-02-15 Thread Kyle Evans
Author: kevans
Date: Fri Feb 15 18:28:51 2019
New Revision: 344161
URL: https://svnweb.freebsd.org/changeset/base/344161

Log:
  stand: dev_net: correct net_open's interpretation of params
  
  net_open previously casted the first vararg to a char * and this was
  half-OK: at first, it is passed to netif_open, which would cast it back to
  the struct devdesc * that it really is and use it properly. It is then
  strdup()d and used as the netdev_name, which is objectively wrong.
  
  Correct it so that the first vararg is properly casted to a struct devdesc *
  and the netdev_name gets set properly to make it more clear at a glance that
  it's not doing something horribly wrong.
  
  Reported by:  mmel
  Reviewed by:  imp, mmel, tsoome
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D19206

Modified:
  head/stand/common/dev_net.c

Modified: head/stand/common/dev_net.c
==
--- head/stand/common/dev_net.c Fri Feb 15 16:48:15 2019(r344160)
+++ head/stand/common/dev_net.c Fri Feb 15 18:28:51 2019(r344161)
@@ -122,13 +122,15 @@ net_open(struct open_file *f, ...)
 {
struct iodesc *d;
va_list args;
-   char *devname;  /* Device part of file name (or NULL). */
+   struct devdesc *dev;
+   const char *devname;/* Device part of file name (or NULL). */
int error = 0;
 
va_start(args, f);
-   devname = va_arg(args, char*);
+   dev = va_arg(args, struct devdesc *);
va_end(args);
 
+   devname = dev->d_dev->dv_name;
/* Before opening another interface, close the previous one first. */
if (netdev_sock >= 0 && strcmp(devname, netdev_name) != 0)
net_cleanup();
@@ -137,7 +139,7 @@ net_open(struct open_file *f, ...)
if (netdev_opens == 0) {
/* Find network interface. */
if (netdev_sock < 0) {
-   netdev_sock = netif_open(devname);
+   netdev_sock = netif_open(dev);
if (netdev_sock < 0) {
printf("net_open: netif_open() failed\n");
return (ENXIO);
___
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: r343030 - in head/sys: cam conf dev/md dev/nvme fs/fuse fs/nfsclient fs/smbfs kern sys ufs/ffs vm

2019-02-15 Thread Justin Hibbits
On Thu, 14 Feb 2019 15:34:10 -0800
Gleb Smirnoff  wrote:

>   Hi Justin,
> 
> On Wed, Feb 13, 2019 at 07:24:50PM -0600, Justin Hibbits wrote:
> J> This seems to break 32-bit platforms, or at least 32-bit book-e
> J> powerpc, which has a limited KVA space (~500MB).  It preallocates
> J> I've seen over 2500 pbufs, at 128kB each, eating up over 300MB KVA,
> J> leaving very little left for the rest of runtime.
> J> 
> J> I spent a couple hours earlier today debugging with Mark Johnston,
> J> and his consensus is that the vnode_pbuf_zone is too big on 32-bit
> J> platforms.  Unfortunately I know very little about this area, so
> J> can't provide much extra insight, but can readily reproduce the
> J> issues I see triggered by this change, so am willing to help where
> J> I can.  
> 
> Ok, let's roll back to old default on 32-bit platforms and somewhat
> reduce the default on 64-bits.
> 
> Can you please confirm that the patch attached works for you?
> 

Hi Gleb,

Thanks for the patch.  I've built and installed.  My machine boots up
fine, and I dropped to ddb to check vmem.  Results are as follows:

r343029:
  kernel arena domain:
size: 67108864
inuse: 66482176
free: 62668

  kernel arena:
size: 624951296
inuse: 579207168
free: 45744128

r344123 with your patch:
  kernel arena domain:
size: 71303168
inuse: 68153344
free: 3149824
  kernel arena:
645922816
inuse: 632369152
free: 13553664

I've kicked off a buildworld+buildkernel to see how it survives.

This machine has 8GB RAM and 4GB swap, if that has any impact.

- Justin
___
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: r344129 - head

2019-02-15 Thread Enji Cooper

> On Feb 14, 2019, at 19:08, Warner Losh  wrote:
> 
>> On Thu, Feb 14, 2019, 1:42 PM Rodney W. Grimes 
>> > > On Thu, Feb 14, 2019 at 12:00:22PM -0700, Warner Losh wrote:
>> > > On Thu, Feb 14, 2019 at 11:29 AM Rodney W. Grimes <
>> > > > >   Differential Review: https://reviews.freebsd.org/D19193
>> > > >
>> > > > You sited a differential, but not give any attribution
>> > > > to the external source :-(
>> > > >
>> > > 
>> > > The differential review has that information.
>> > 
>> > External contributors should be recognized by having their names appear
>> > in the commit logs.
>> 
>> We even bother to put a special line in the commit template
>> for this.  Further it has been standard operating procedure
>> for at least as long as I have been back that submitters
>> are infact recognized in commit messages.
>> 
>> You have, again, summarily dismissed valid feedback.
> 
> 
> The problem is that was a trivial commit. And you offered not one, but two 
> complaints about adding an 'e' to the updating file. That's what pissed me 
> off. It's advice that might be correct, but was so far over the top, in 
> public, for such a trivial commit. That's why I got mad: it added no value 
> and seemed nit picky and pretty. So I lost it. I shouldn't have, but I did. 
> 
> I'm sorry for my cool.

Thank you both Rod and Warner for the reply.

Thank you Rod for noting that src-committers was a public list; I thought it 
was private to FreeBSD src committers.

I replied to this thread because while I agree with what you said, I felt that 
the reaction and forum were not in proportion to what happened :/.

More than a handful of threads lately have become heated to a point that 
concerns me about inter-developer relations and perception outside of the 
community. I have taken part in some of the discussions, potentially 
contributing to the overall issue.

I’m happy with the eventual outcome, but I hope that we, as a group, can do 
better next time to avoid these situations and be kinder to one another. Many 
of the recent issues (while important in aggregate) seem minor (in 
disaggregate).

All the best,
-Enji
___
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: r344160 - head/usr.sbin/bhyve

2019-02-15 Thread Rodney W. Grimes
Author: rgrimes
Date: Fri Feb 15 16:48:15 2019
New Revision: 344160
URL: https://svnweb.freebsd.org/changeset/base/344160

Log:
  In r340044 an attempt to quiet coverity warning cid 1357336
  was incorrectly implemented leading to a possible double free.
  
  It is possible for both the conditional free,
  and the unconditional free added in r340044 to be done,
  fix that by initializing uopt to NULL,
  removing the conditional free,
  and only using the unconditional free at the end.
  
  Reported by:  Patrick Mooney (patrick.moo...@joyent.com)
  Reviewed by:  jhb (maintainer), Patrick Mooney (joyent/illumos)
  Approved by:  bde (mentor)
  CID:  1357336
  MFC after:3 days
  MFC with: 340044
  Differential Revision:https://reviews.freebsd.org/D19202

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

Modified: head/usr.sbin/bhyve/pci_xhci.c
==
--- head/usr.sbin/bhyve/pci_xhci.c  Fri Feb 15 16:20:21 2019
(r344159)
+++ head/usr.sbin/bhyve/pci_xhci.c  Fri Feb 15 16:48:15 2019
(r344160)
@@ -2626,6 +2626,7 @@ pci_xhci_parse_opts(struct pci_xhci_softc *sc, char *o
char*uopt, *xopts, *config;
int usb3_port, usb2_port, i;
 
+   uopt = NULL;
usb3_port = sc->usb3_port_start - 1;
usb2_port = sc->usb2_port_start - 1;
devices = NULL;
@@ -2700,8 +2701,6 @@ pci_xhci_parse_opts(struct pci_xhci_softc *sc, char *o
 
sc->ndevices++;
}
-   if (uopt != NULL)
-   free(uopt);
 
 portsfinal:
sc->portregs = calloc(XHCI_MAX_DEVS, sizeof(struct pci_xhci_portregs));
___
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: r344159 - head/usr.sbin/bhyve

2019-02-15 Thread Rodney W. Grimes
Author: rgrimes
Date: Fri Feb 15 16:20:21 2019
New Revision: 344159
URL: https://svnweb.freebsd.org/changeset/base/344159

Log:
  In r340042 an attempt to quiet coverity warning cid 1305412 was overdone.
  nopt is the only allocated space,
  xopt and cp are aliases into that allocated space.
  Remove the 2 unneeded free's
  
  Reported by:  Patrick Mooney (@pmooney_pfmooney.com)
  Reviewed by:  jhb (maintainer), Patrick Mooney (joyent/illumos)
  Approved by:  bde (mentor)
  CID:  1305412
  MFC after:3 days
  MFC with: 340042
  Differential Revision:https://reviews.freebsd.org/D19200

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

Modified: head/usr.sbin/bhyve/block_if.c
==
--- head/usr.sbin/bhyve/block_if.c  Fri Feb 15 11:36:16 2019
(r344158)
+++ head/usr.sbin/bhyve/block_if.c  Fri Feb 15 16:20:21 2019
(r344159)
@@ -576,8 +576,6 @@ blockif_open(const char *optstr, const char *ident)
 err:
if (fd >= 0)
close(fd);
-   free(cp);
-   free(xopts);
free(nopt);
return (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"


Re: svn commit: r344118 - head/sys/i386/include

2019-02-15 Thread Bruce Evans

On Fri, 15 Feb 2019, Konstantin Belousov wrote:


On Sat, Feb 16, 2019 at 12:27:16AM +1100, Bruce Evans wrote:

On Fri, 15 Feb 2019, Konstantin Belousov wrote:


On Fri, Feb 15, 2019 at 07:16:04AM +, Alexey Dokuchaev wrote:

Is there a reason to prefer pushl+movl+popl instead of movl+xchgl?

...
xchgl seems to be slower even in registers format (where no implicit
lock is used).  If you can demonstrate that your fragment is better in
some microbenchmark, I can change it.  But also note that its use is not
on the critical path.


The should have the same speed on modern x86.  xchgl %reg1,%reg2 is
not slow, but it changes 2 visible registers and a needs somwhere to
hold one of the registers while changing it, so on 14 year old AthlonXP
...

I think on modern Intels xchgl is implemented by renaming.  Still it is slower
than typically highly optimized push/pops.

That said, what is your preference ? My version or xchgl ?
My own preference is to leave it as is, since it is slightly slower,
and I do not want to spend several hours again, re-testing libc changes.


I like the push/pop instructions, so like it like it is.

Bruce
___
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: r344118 - head/sys/i386/include

2019-02-15 Thread Konstantin Belousov
On Sat, Feb 16, 2019 at 12:27:16AM +1100, Bruce Evans wrote:
> On Fri, 15 Feb 2019, Konstantin Belousov wrote:
> 
> > On Fri, Feb 15, 2019 at 07:16:04AM +, Alexey Dokuchaev wrote:
> >> On Thu, Feb 14, 2019 at 01:53:11PM +, Konstantin Belousov wrote:
> >>> New Revision: 344118
> >>> URL: https://svnweb.freebsd.org/changeset/base/344118
> >>>
> >>> Log:
> >>>   Provide userspace versions of do_cpuid() and cpuid_count() on i386.
> >>>
> >>>   Some older compilers, when generating PIC code, cannot handle inline
> >>>   asm that clobbers %ebx (because %ebx is used as the GOT offset
> >>>   register).  Userspace versions avoid clobbering %ebx by saving it to
> >>>   stack before executing the CPUID instruction.
> >>>
> >>> ...
> >>> +static __inline void
> >>> +do_cpuid(u_int ax, u_int *p)
> >>> +{
> >>> + __asm __volatile(
> >>> + "pushl\t%%ebx\n\t"
> >>> + "cpuid\n\t"
> >>> + "movl\t%%ebx,%1\n\t"
> >>> + "popl\t%%ebx"
> >>
> >> Is there a reason to prefer pushl+movl+popl instead of movl+xchgl?
> >>
> >> "movl %%ebx, %1\n\t"
> >> "cpuid\n\t"
> >> "xchgl %%ebx, %1"
> >
> > xchgl seems to be slower even in registers format (where no implicit
> > lock is used).  If you can demonstrate that your fragment is better in
> > some microbenchmark, I can change it.  But also note that its use is not
> > on the critical path.
> 
> The should have the same speed on modern x86.  xchgl %reg1,%reg2 is
> not slow, but it changes 2 visible registers and a needs somwhere to
> hold one of the registers while changing it, so on 14 year old AthlonXP
> where I know the times in cycles better, register xchgl was twice as slow
> as register move (2 cycles latency instead of 1, and throughput ==
> latency (?)).  On 2015 Haswell, register movl in a loop is in parallel
> with the loop overhead (1 cycle), while xchgl and pushl/popl take 0.5
> cycles longer on average.  Latency might be a problem for pushl/popl
> in critical paths.  There aren't many of those.

I think on modern Intels xchgl is implemented by renaming.  Still it is slower
than typically highly optimized push/pops.

That said, what is your preference ? My version or xchgl ?
My own preference is to leave it as is, since it is slightly slower,
and I do not want to spend several hours again, re-testing libc changes.
___
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: r344118 - head/sys/i386/include

2019-02-15 Thread Alexey Dokuchaev
On Sat, Feb 16, 2019 at 12:27:16AM +1100, Bruce Evans wrote:
> On Fri, 15 Feb 2019, Konstantin Belousov wrote:
> > On Fri, Feb 15, 2019 at 07:16:04AM +, Alexey Dokuchaev wrote:
> >> On Thu, Feb 14, 2019 at 01:53:11PM +, Konstantin Belousov wrote:
> >>> New Revision: 344118
> >>> URL: https://svnweb.freebsd.org/changeset/base/344118
> >>>
> >>> Log:
> >>>   Provide userspace versions of do_cpuid() and cpuid_count() on i386.
> >>> ...
> >>> +static __inline void
> >>> +do_cpuid(u_int ax, u_int *p)
> >>> +{
> >>> + __asm __volatile(
> >>> + "pushl\t%%ebx\n\t"
> >>> + "cpuid\n\t"
> >>> + "movl\t%%ebx,%1\n\t"
> >>> + "popl\t%%ebx"
> >>
> >> Is there a reason to prefer pushl+movl+popl instead of movl+xchgl?
> >>
> >> "movl %%ebx, %1\n\t"
> >> "cpuid\n\t"
> >> "xchgl %%ebx, %1"
> >
> > xchgl seems to be slower even in registers format (where no implicit
> > lock is used).  If you can demonstrate that your fragment is better in
> > some microbenchmark, I can change it.  But also note that its use is not
> > on the critical path.
> 
> The should have the same speed on modern x86.  xchgl %reg1,%reg2 is
> not slow, but it changes 2 visible registers and a needs somwhere to
> hold one of the registers while changing it, so on 14 year old AthlonXP
> where I know the times in cycles better, register xchgl was twice as slow
> as register move (2 cycles latency instead of 1, and throughput ==
> latency (?)).  On 2015 Haswell, register movl in a loop is in parallel
> with the loop overhead (1 cycle), while xchgl and pushl/popl take 0.5
> cycles longer on average.  Latency might be a problem for pushl/popl
> in critical paths.  There aren't many of those.

Thanks Bruce, I guess we can leave it as is then.

./danfe
___
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: r344118 - head/sys/i386/include

2019-02-15 Thread Bruce Evans

On Fri, 15 Feb 2019, Konstantin Belousov wrote:


On Fri, Feb 15, 2019 at 07:16:04AM +, Alexey Dokuchaev wrote:

On Thu, Feb 14, 2019 at 01:53:11PM +, Konstantin Belousov wrote:

New Revision: 344118
URL: https://svnweb.freebsd.org/changeset/base/344118

Log:
  Provide userspace versions of do_cpuid() and cpuid_count() on i386.

  Some older compilers, when generating PIC code, cannot handle inline
  asm that clobbers %ebx (because %ebx is used as the GOT offset
  register).  Userspace versions avoid clobbering %ebx by saving it to
  stack before executing the CPUID instruction.

...
+static __inline void
+do_cpuid(u_int ax, u_int *p)
+{
+   __asm __volatile(
+   "pushl\t%%ebx\n\t"
+   "cpuid\n\t"
+   "movl\t%%ebx,%1\n\t"
+   "popl\t%%ebx"


Is there a reason to prefer pushl+movl+popl instead of movl+xchgl?

"movl %%ebx, %1\n\t"
"cpuid\n\t"
"xchgl %%ebx, %1"


xchgl seems to be slower even in registers format (where no implicit
lock is used).  If you can demonstrate that your fragment is better in
some microbenchmark, I can change it.  But also note that its use is not
on the critical path.


The should have the same speed on modern x86.  xchgl %reg1,%reg2 is
not slow, but it changes 2 visible registers and a needs somwhere to
hold one of the registers while changing it, so on 14 year old AthlonXP
where I know the times in cycles better, register xchgl was twice as slow
as register move (2 cycles latency instead of 1, and throughput ==
latency (?)).  On 2015 Haswell, register movl in a loop is in parallel
with the loop overhead (1 cycle), while xchgl and pushl/popl take 0.5
cycles longer on average.  Latency might be a problem for pushl/popl
in critical paths.  There aren't many of those.

There is no reason to use the style with strings made unreadable using
soft tabs and newlines.  gcc supported hard newlines 20-30 years ago,
but broke this because C90 or C99 made hard newlines in strings invalid.
This broke lots of my asms.  I now use hard tabs and backslash-hard_newlines
after soft newlines:

__asm __volatile(" \n\
pushl   %%ebx   \n\
cpuid   \n\
movl%%ebx,%1\n\
popl%%ebx" \n\
");

The Standard C lossage forces use \n\ before hard newline, and readability
forces a hard-to-edit variable number of hard tabs before \n\, but otherwise
the code looks the same as before (opcodes are outdented to column 8 in
large asms, and labels are outdented to column 0, so that the code looks
the same as non-inline asm too).

Bruce
___
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: r344158 - stable/11/lib/libc/x86/sys

2019-02-15 Thread Konstantin Belousov
Author: kib
Date: Fri Feb 15 11:36:16 2019
New Revision: 344158
URL: https://svnweb.freebsd.org/changeset/base/344158

Log:
  MFC r343859:
  Add comment noting that the strange spelling of GenuineIntel is for reason.

Modified:
  stable/11/lib/libc/x86/sys/__vdso_gettc.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libc/x86/sys/__vdso_gettc.c
==
--- stable/11/lib/libc/x86/sys/__vdso_gettc.c   Fri Feb 15 11:33:48 2019
(r344157)
+++ stable/11/lib/libc/x86/sys/__vdso_gettc.c   Fri Feb 15 11:36:16 2019
(r344158)
@@ -88,6 +88,7 @@ static enum LMB
 select_lmb(void)
 {
u_int p[4];
+   /* Not a typo, string matches our cpuidp() registers use. */
static const char intel_id[] = "GenuntelineI";
 
cpuidp(0, p);
___
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: r344157 - stable/12/lib/libc/x86/sys

2019-02-15 Thread Konstantin Belousov
Author: kib
Date: Fri Feb 15 11:33:48 2019
New Revision: 344157
URL: https://svnweb.freebsd.org/changeset/base/344157

Log:
  MFC r343855, r343859:
  Use ifunc to select the barrier instruction for RDTSC.

Modified:
  stable/12/lib/libc/x86/sys/__vdso_gettc.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libc/x86/sys/__vdso_gettc.c
==
--- stable/12/lib/libc/x86/sys/__vdso_gettc.c   Fri Feb 15 11:28:32 2019
(r344156)
+++ stable/12/lib/libc/x86/sys/__vdso_gettc.c   Fri Feb 15 11:33:48 2019
(r344157)
@@ -1,6 +1,6 @@
 /*-
  * Copyright (c) 2012 Konstantin Belousov 
- * Copyright (c) 2016, 2017 The FreeBSD Foundation
+ * Copyright (c) 2016, 2017, 2019 The FreeBSD Foundation
  * All rights reserved.
  *
  * Portions of this software were developed by Konstantin Belousov
@@ -50,15 +50,9 @@ __FBSDID("$FreeBSD$");
 #ifdef WANT_HYPERV
 #include 
 #endif
+#include 
 #include "libc_private.h"
 
-static enum LMB {
-   LMB_UNKNOWN,
-   LMB_NONE,
-   LMB_MFENCE,
-   LMB_LFENCE
-} lfence_works = LMB_UNKNOWN;
-
 static void
 cpuidp(u_int leaf, u_int p[4])
 {
@@ -84,68 +78,36 @@ cpuidp(u_int leaf, u_int p[4])
:  "0" (leaf));
 }
 
-static enum LMB
-select_lmb(void)
+static void
+rdtsc_mb_lfence(void)
 {
-   u_int p[4];
-   static const char intel_id[] = "GenuntelineI";
 
-   cpuidp(0, p);
-   return (memcmp(p + 1, intel_id, sizeof(intel_id) - 1) == 0 ?
-   LMB_LFENCE : LMB_MFENCE);
+   lfence();
 }
 
 static void
-init_fence(void)
+rdtsc_mb_mfence(void)
 {
-#if defined(__i386__)
-   u_int cpuid_supported, p[4];
 
-   lfence_works = LMB_NONE;
-   __asm __volatile(
-   "   pushfl\n"
-   "   popl%%eax\n"
-   "   movl%%eax,%%ecx\n"
-   "   xorl$0x20,%%eax\n"
-   "   pushl   %%eax\n"
-   "   popfl\n"
-   "   pushfl\n"
-   "   popl%%eax\n"
-   "   xorl%%eax,%%ecx\n"
-   "   je  1f\n"
-   "   movl$1,%0\n"
-   "   jmp 2f\n"
-   "1: movl$0,%0\n"
-   "2:\n"
-   : "=r" (cpuid_supported) : : "eax", "ecx", "cc");
-   if (cpuid_supported) {
-   cpuidp(0x1, p);
-   if ((p[3] & CPUID_SSE2) != 0)
-   lfence_works = select_lmb();
-   }
-#elif defined(__amd64__)
-   lfence_works = select_lmb();
-#else
-#error "Arch"
-#endif
+   mfence();
 }
 
 static void
-rdtsc_mb(void)
+rdtsc_mb_none(void)
 {
+}
 
-again:
-   if (__predict_true(lfence_works == LMB_LFENCE)) {
-   lfence();
-   return;
-   } else if (lfence_works == LMB_MFENCE) {
-   mfence();
-   return;
-   } else if (lfence_works == LMB_NONE) {
-   return;
-   }
-   init_fence();
-   goto again;
+DEFINE_UIFUNC(static, void, rdtsc_mb, (void), static)
+{
+   u_int p[4];
+   /* Not a typo, string matches our cpuidp() registers use. */
+   static const char intel_id[] = "GenuntelineI";
+
+   if ((cpu_feature & CPUID_SSE2) == 0)
+   return (rdtsc_mb_none);
+   cpuidp(0, p);
+   return (memcmp(p + 1, intel_id, sizeof(intel_id) - 1) == 0 ?
+   rdtsc_mb_lfence : rdtsc_mb_mfence);
 }
 
 static u_int
___
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: r344156 - stable/11/sys/fs/nullfs

2019-02-15 Thread Konstantin Belousov
Author: kib
Date: Fri Feb 15 11:28:32 2019
New Revision: 344156
URL: https://svnweb.freebsd.org/changeset/base/344156

Log:
  MFC r343899:
  In null_vptocnp(), cache vp->v_mount and use it for null_nodeget() call.
  
  PR:   235549

Modified:
  stable/11/sys/fs/nullfs/null_vnops.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/fs/nullfs/null_vnops.c
==
--- stable/11/sys/fs/nullfs/null_vnops.cFri Feb 15 11:27:21 2019
(r344155)
+++ stable/11/sys/fs/nullfs/null_vnops.cFri Feb 15 11:28:32 2019
(r344156)
@@ -868,11 +868,14 @@ null_vptocnp(struct vop_vptocnp_args *ap)
struct vnode **dvp = ap->a_vpp;
struct vnode *lvp, *ldvp;
struct ucred *cred = ap->a_cred;
+   struct mount *mp;
int error, locked;
 
locked = VOP_ISLOCKED(vp);
lvp = NULLVPTOLOWERVP(vp);
vhold(lvp);
+   mp = vp->v_mount;
+   vfs_ref(mp);
VOP_UNLOCK(vp, 0); /* vp is held by vn_vptocnp_locked that called us */
ldvp = lvp;
vref(lvp);
@@ -880,6 +883,7 @@ null_vptocnp(struct vop_vptocnp_args *ap)
vdrop(lvp);
if (error != 0) {
vn_lock(vp, locked | LK_RETRY);
+   vfs_rel(mp);
return (ENOENT);
}
 
@@ -891,9 +895,10 @@ null_vptocnp(struct vop_vptocnp_args *ap)
if (error != 0) {
vrele(ldvp);
vn_lock(vp, locked | LK_RETRY);
+   vfs_rel(mp);
return (ENOENT);
}
-   error = null_nodeget(vp->v_mount, ldvp, dvp);
+   error = null_nodeget(mp, ldvp, dvp);
if (error == 0) {
 #ifdef DIAGNOSTIC
NULLVPTOLOWERVP(*dvp);
@@ -901,6 +906,7 @@ null_vptocnp(struct vop_vptocnp_args *ap)
VOP_UNLOCK(*dvp, 0); /* keep reference on *dvp */
}
vn_lock(vp, locked | LK_RETRY);
+   vfs_rel(mp);
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"


svn commit: r344155 - stable/11/sys/fs/nullfs

2019-02-15 Thread Konstantin Belousov
Author: kib
Date: Fri Feb 15 11:27:21 2019
New Revision: 344155
URL: https://svnweb.freebsd.org/changeset/base/344155

Log:
  MFC r343897, r343898:
  Some style for nullfs_mount().
  Before using VTONULL(), check that the covered vnode belongs to nullfs.

Modified:
  stable/11/sys/fs/nullfs/null_vfsops.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/fs/nullfs/null_vfsops.c
==
--- stable/11/sys/fs/nullfs/null_vfsops.c   Fri Feb 15 11:20:25 2019
(r344154)
+++ stable/11/sys/fs/nullfs/null_vfsops.c   Fri Feb 15 11:27:21 2019
(r344155)
@@ -72,14 +72,15 @@ static vfs_extattrctl_t nullfs_extattrctl;
 static int
 nullfs_mount(struct mount *mp)
 {
-   int error = 0;
struct vnode *lowerrootvp, *vp;
struct vnode *nullm_rootvp;
struct null_mount *xmp;
struct thread *td = curthread;
+   struct null_node *nn;
+   struct nameidata nd, *ndp;
char *target;
-   int isvnunlocked = 0, len;
-   struct nameidata nd, *ndp = 
+   int error, len;
+   bool isvnunlocked;
 
NULLFSDEBUG("nullfs_mount(mp = %p)\n", (void *)mp);
 
@@ -111,14 +112,18 @@ nullfs_mount(struct mount *mp)
/*
 * Unlock lower node to avoid possible deadlock.
 */
-   if ((mp->mnt_vnodecovered->v_op == _vnodeops) &&
+   if (mp->mnt_vnodecovered->v_op == _vnodeops &&
VOP_ISLOCKED(mp->mnt_vnodecovered) == LK_EXCLUSIVE) {
VOP_UNLOCK(mp->mnt_vnodecovered, 0);
-   isvnunlocked = 1;
+   isvnunlocked = true;
+   } else {
+   isvnunlocked = false;
}
+
/*
 * Find lower node
 */
+   ndp = 
NDINIT(ndp, LOOKUP, FOLLOW|LOCKLEAF, UIO_SYSSPACE, target, curthread);
error = namei(ndp);
 
@@ -141,10 +146,13 @@ nullfs_mount(struct mount *mp)
/*
 * Check multi null mount to avoid `lock against myself' panic.
 */
-   if (lowerrootvp == VTONULL(mp->mnt_vnodecovered)->null_lowervp) {
-   NULLFSDEBUG("nullfs_mount: multi null mount?\n");
-   vput(lowerrootvp);
-   return (EDEADLK);
+   if (mp->mnt_vnodecovered->v_op == _vnodeops) {
+   nn = VTONULL(mp->mnt_vnodecovered);
+   if (nn == NULL || lowerrootvp == nn->null_lowervp) {
+   NULLFSDEBUG("nullfs_mount: multi null mount?\n");
+   vput(lowerrootvp);
+   return (EDEADLK);
+   }
}
 
xmp = (struct null_mount *) malloc(sizeof(struct null_mount),
___
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: r344154 - stable/12/sys/fs/nullfs

2019-02-15 Thread Konstantin Belousov
Author: kib
Date: Fri Feb 15 11:20:25 2019
New Revision: 344154
URL: https://svnweb.freebsd.org/changeset/base/344154

Log:
  MFC r343899:
  In null_vptocnp(), cache vp->v_mount and use it for null_nodeget() call.
  
  PR:   235549

Modified:
  stable/12/sys/fs/nullfs/null_vnops.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/fs/nullfs/null_vnops.c
==
--- stable/12/sys/fs/nullfs/null_vnops.cFri Feb 15 11:19:12 2019
(r344153)
+++ stable/12/sys/fs/nullfs/null_vnops.cFri Feb 15 11:20:25 2019
(r344154)
@@ -870,11 +870,14 @@ null_vptocnp(struct vop_vptocnp_args *ap)
struct vnode **dvp = ap->a_vpp;
struct vnode *lvp, *ldvp;
struct ucred *cred = ap->a_cred;
+   struct mount *mp;
int error, locked;
 
locked = VOP_ISLOCKED(vp);
lvp = NULLVPTOLOWERVP(vp);
vhold(lvp);
+   mp = vp->v_mount;
+   vfs_ref(mp);
VOP_UNLOCK(vp, 0); /* vp is held by vn_vptocnp_locked that called us */
ldvp = lvp;
vref(lvp);
@@ -882,6 +885,7 @@ null_vptocnp(struct vop_vptocnp_args *ap)
vdrop(lvp);
if (error != 0) {
vn_lock(vp, locked | LK_RETRY);
+   vfs_rel(mp);
return (ENOENT);
}
 
@@ -893,9 +897,10 @@ null_vptocnp(struct vop_vptocnp_args *ap)
if (error != 0) {
vrele(ldvp);
vn_lock(vp, locked | LK_RETRY);
+   vfs_rel(mp);
return (ENOENT);
}
-   error = null_nodeget(vp->v_mount, ldvp, dvp);
+   error = null_nodeget(mp, ldvp, dvp);
if (error == 0) {
 #ifdef DIAGNOSTIC
NULLVPTOLOWERVP(*dvp);
@@ -903,6 +908,7 @@ null_vptocnp(struct vop_vptocnp_args *ap)
VOP_UNLOCK(*dvp, 0); /* keep reference on *dvp */
}
vn_lock(vp, locked | LK_RETRY);
+   vfs_rel(mp);
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"


svn commit: r344153 - stable/12/sys/fs/nullfs

2019-02-15 Thread Konstantin Belousov
Author: kib
Date: Fri Feb 15 11:19:12 2019
New Revision: 344153
URL: https://svnweb.freebsd.org/changeset/base/344153

Log:
  MFC r343897, r343898:
  Some style for nullfs_mount().
  Before using VTONULL(), check that the covered vnode belongs to nullfs.

Modified:
  stable/12/sys/fs/nullfs/null_vfsops.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/fs/nullfs/null_vfsops.c
==
--- stable/12/sys/fs/nullfs/null_vfsops.c   Fri Feb 15 11:13:39 2019
(r344152)
+++ stable/12/sys/fs/nullfs/null_vfsops.c   Fri Feb 15 11:19:12 2019
(r344153)
@@ -74,13 +74,14 @@ static vfs_extattrctl_t nullfs_extattrctl;
 static int
 nullfs_mount(struct mount *mp)
 {
-   int error = 0;
struct vnode *lowerrootvp, *vp;
struct vnode *nullm_rootvp;
struct null_mount *xmp;
+   struct null_node *nn;
+   struct nameidata nd, *ndp;
char *target;
-   int isvnunlocked = 0, len;
-   struct nameidata nd, *ndp = 
+   int error, len;
+   bool isvnunlocked;
 
NULLFSDEBUG("nullfs_mount(mp = %p)\n", (void *)mp);
 
@@ -110,14 +111,18 @@ nullfs_mount(struct mount *mp)
/*
 * Unlock lower node to avoid possible deadlock.
 */
-   if ((mp->mnt_vnodecovered->v_op == _vnodeops) &&
+   if (mp->mnt_vnodecovered->v_op == _vnodeops &&
VOP_ISLOCKED(mp->mnt_vnodecovered) == LK_EXCLUSIVE) {
VOP_UNLOCK(mp->mnt_vnodecovered, 0);
-   isvnunlocked = 1;
+   isvnunlocked = true;
+   } else {
+   isvnunlocked = false;
}
+
/*
 * Find lower node
 */
+   ndp = 
NDINIT(ndp, LOOKUP, FOLLOW|LOCKLEAF, UIO_SYSSPACE, target, curthread);
error = namei(ndp);
 
@@ -140,10 +145,13 @@ nullfs_mount(struct mount *mp)
/*
 * Check multi null mount to avoid `lock against myself' panic.
 */
-   if (lowerrootvp == VTONULL(mp->mnt_vnodecovered)->null_lowervp) {
-   NULLFSDEBUG("nullfs_mount: multi null mount?\n");
-   vput(lowerrootvp);
-   return (EDEADLK);
+   if (mp->mnt_vnodecovered->v_op == _vnodeops) {
+   nn = VTONULL(mp->mnt_vnodecovered);
+   if (nn == NULL || lowerrootvp == nn->null_lowervp) {
+   NULLFSDEBUG("nullfs_mount: multi null mount?\n");
+   vput(lowerrootvp);
+   return (EDEADLK);
+   }
}
 
xmp = (struct null_mount *) malloc(sizeof(struct null_mount),
___
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: r344152 - in stable/12/sys: kern sys

2019-02-15 Thread Konstantin Belousov
Author: kib
Date: Fri Feb 15 11:13:39 2019
New Revision: 344152
URL: https://svnweb.freebsd.org/changeset/base/344152

Log:
  MFC r343891:
  Fix renameat(2) for CAPABILITIES kernelsi.
  
  MFC Note: Layout of the struct nameidata is changed.  I specifically
  decided to not move the new field to the end of the new structure since
  it would mostly make the corruption silent.  __FreeBSD_version is bumped.

Modified:
  stable/12/sys/kern/vfs_lookup.c
  stable/12/sys/kern/vfs_syscalls.c
  stable/12/sys/sys/namei.h
  stable/12/sys/sys/param.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/kern/vfs_lookup.c
==
--- stable/12/sys/kern/vfs_lookup.c Fri Feb 15 10:40:41 2019
(r344151)
+++ stable/12/sys/kern/vfs_lookup.c Fri Feb 15 11:13:39 2019
(r344152)
@@ -388,6 +388,7 @@ namei(struct nameidata *ndp)
dp = NULL;
cnp->cn_nameptr = cnp->cn_pnbuf;
if (cnp->cn_pnbuf[0] == '/') {
+   ndp->ni_resflags |= NIRES_ABS;
error = namei_handle_root(ndp, );
} else {
if (ndp->ni_startdir != NULL) {
@@ -1252,6 +1253,7 @@ NDINIT_ALL(struct nameidata *ndp, u_long op, u_long fl
ndp->ni_dirp = namep;
ndp->ni_dirfd = dirfd;
ndp->ni_startdir = startdir;
+   ndp->ni_resflags = 0;
if (rightsp != NULL)
ndp->ni_rightsneeded = *rightsp;
else

Modified: stable/12/sys/kern/vfs_syscalls.c
==
--- stable/12/sys/kern/vfs_syscalls.c   Fri Feb 15 10:40:41 2019
(r344151)
+++ stable/12/sys/kern/vfs_syscalls.c   Fri Feb 15 11:13:39 2019
(r344152)
@@ -3511,10 +3511,10 @@ again:
goto out;
}
 #ifdef CAPABILITIES
-   if (newfd != AT_FDCWD) {
+   if (newfd != AT_FDCWD && (tond.ni_resflags & NIRES_ABS) == 0) {
/*
 * If the target already exists we require CAP_UNLINKAT
-* from 'newfd'.
+* from 'newfd', when newfd was used for the lookup.
 */
error = cap_check(_filecaps.fc_rights,
_unlinkat_rights);

Modified: stable/12/sys/sys/namei.h
==
--- stable/12/sys/sys/namei.h   Fri Feb 15 10:40:41 2019(r344151)
+++ stable/12/sys/sys/namei.h   Fri Feb 15 11:13:39 2019(r344152)
@@ -88,6 +88,10 @@ struct nameidata {
struct  vnode *ni_vp;   /* vnode of result */
struct  vnode *ni_dvp;  /* vnode of intermediate directory */
/*
+* Results: flags returned from namei
+*/
+   u_int   ni_resflags;
+   /*
 * Shared between namei and lookup/commit routines.
 */
size_t  ni_pathlen; /* remaining chars in path */
@@ -156,6 +160,11 @@ struct nameidata {
 #defineTRAILINGSLASH   0x1000 /* path ended in a slash */
 #defineNOCAPCHECK  0x2000 /* do not perform capability checks 
*/
 #definePARAMASK0x3e00 /* mask of parameter descriptors */
+
+/*
+ * Namei results flags
+ */
+#defineNIRES_ABS   0x0001 /* Path was absolute */
 
 /*
  * Flags in ni_lcf, valid for the duration of the namei call.

Modified: stable/12/sys/sys/param.h
==
--- stable/12/sys/sys/param.h   Fri Feb 15 10:40:41 2019(r344151)
+++ stable/12/sys/sys/param.h   Fri Feb 15 11:13:39 2019(r344152)
@@ -60,7 +60,7 @@
  * in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 1200502  /* Master, propagated to newvers */
+#define __FreeBSD_version 1200503  /* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
___
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: r344151 - head/sys/dev/ena

2019-02-15 Thread Marcin Wojtas
Author: mw
Date: Fri Feb 15 10:40:41 2019
New Revision: 344151
URL: https://svnweb.freebsd.org/changeset/base/344151

Log:
  Do not use ntc for obtaining buffer on Rx in the ENA
  
  In out of order mode Rx buffer are accesses by req_id.
  Accessing and validating mbuf using ntc is causing false error.
  
  Increase driver revision after latest RX OOO completion fixes.
  
  Submitted by: Rafal Kozik 
  Obtained from: Semihalf
  Sponsored by: Amazon, Inc.
  MFC after: 1 week

Modified:
  head/sys/dev/ena/ena.c
  head/sys/dev/ena/ena.h

Modified: head/sys/dev/ena/ena.c
==
--- head/sys/dev/ena/ena.c  Fri Feb 15 10:34:27 2019(r344150)
+++ head/sys/dev/ena/ena.c  Fri Feb 15 10:40:41 2019(r344151)
@@ -1473,13 +1473,7 @@ ena_rx_mbuf(struct ena_ring *rx_ring, struct ena_com_r
 
ntc = *next_to_clean;
adapter = rx_ring->adapter;
-   rx_info = _ring->rx_buffer_info[ntc];
 
-   if (unlikely(rx_info->mbuf == NULL)) {
-   device_printf(adapter->pdev, "NULL mbuf in rx_info");
-   return (NULL);
-   }
-
len = ena_bufs[buf].len;
req_id = ena_bufs[buf].req_id;
rc = validate_rx_req_id(rx_ring, req_id);
@@ -1487,6 +1481,10 @@ ena_rx_mbuf(struct ena_ring *rx_ring, struct ena_com_r
return (NULL);
 
rx_info = _ring->rx_buffer_info[req_id];
+   if (unlikely(rx_info->mbuf == NULL)) {
+   device_printf(adapter->pdev, "NULL mbuf in rx_info");
+   return (NULL);
+   }
 
ena_trace(ENA_DBG | ENA_RXPTH, "rx_info %p, mbuf %p, paddr %jx",
rx_info, rx_info->mbuf, (uintmax_t)rx_info->ena_buf.paddr);

Modified: head/sys/dev/ena/ena.h
==
--- head/sys/dev/ena/ena.h  Fri Feb 15 10:34:27 2019(r344150)
+++ head/sys/dev/ena/ena.h  Fri Feb 15 10:40:41 2019(r344151)
@@ -41,7 +41,7 @@
 
 #define DRV_MODULE_VER_MAJOR   0
 #define DRV_MODULE_VER_MINOR   8
-#define DRV_MODULE_VER_SUBMINOR 2
+#define DRV_MODULE_VER_SUBMINOR 3
 
 #define DRV_MODULE_NAME"ena"
 
___
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: r344118 - head/sys/i386/include

2019-02-15 Thread Konstantin Belousov
On Fri, Feb 15, 2019 at 07:16:04AM +, Alexey Dokuchaev wrote:
> On Thu, Feb 14, 2019 at 01:53:11PM +, Konstantin Belousov wrote:
> > New Revision: 344118
> > URL: https://svnweb.freebsd.org/changeset/base/344118
> > 
> > Log:
> >   Provide userspace versions of do_cpuid() and cpuid_count() on i386.
> >   
> >   Some older compilers, when generating PIC code, cannot handle inline
> >   asm that clobbers %ebx (because %ebx is used as the GOT offset
> >   register).  Userspace versions avoid clobbering %ebx by saving it to
> >   stack before executing the CPUID instruction.
> >   
> > ...
> > +static __inline void
> > +do_cpuid(u_int ax, u_int *p)
> > +{
> > +   __asm __volatile(
> > +   "pushl\t%%ebx\n\t"
> > +   "cpuid\n\t"
> > +   "movl\t%%ebx,%1\n\t"
> > +   "popl\t%%ebx"
> 
> Is there a reason to prefer pushl+movl+popl instead of movl+xchgl?
> 
> "movl %%ebx, %1\n\t"
> "cpuid\n\t"
> "xchgl %%ebx, %1"

xchgl seems to be slower even in registers format (where no implicit
lock is used).  If you can demonstrate that your fragment is better in
some microbenchmark, I can change it.  But also note that its use is not
on the critical path.
___
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: r344150 - head/sys/dev/ena

2019-02-15 Thread Marcin Wojtas
Author: mw
Date: Fri Feb 15 10:34:27 2019
New Revision: 344150
URL: https://svnweb.freebsd.org/changeset/base/344150

Log:
  Fix validation of the Rx OOO completion in the ENA
  
  Requested ID should be validated when the packet is received and not
  when the driver is repopulating the mbufs.
  
  Submitted by: Michal Krawczyk 
  Obtained from: Semihalf
  Sponsored by: Amazon, Inc.
  MFC after: 1 week

Modified:
  head/sys/dev/ena/ena.c

Modified: head/sys/dev/ena/ena.c
==
--- head/sys/dev/ena/ena.c  Fri Feb 15 09:49:09 2019(r344149)
+++ head/sys/dev/ena/ena.c  Fri Feb 15 10:34:27 2019(r344150)
@@ -1046,10 +1046,6 @@ ena_refill_rx_bufs(struct ena_ring *rx_ring, uint32_t 
"RX buffer - next to use: %d", next_to_use);
 
req_id = rx_ring->free_rx_ids[next_to_use];
-   rc = validate_rx_req_id(rx_ring, req_id);
-   if (unlikely(rc != 0))
-   break;
-
rx_info = _ring->rx_buffer_info[req_id];
 
rc = ena_alloc_rx_mbuf(adapter, rx_ring, rx_info);
@@ -1472,6 +1468,7 @@ ena_rx_mbuf(struct ena_ring *rx_ring, struct ena_com_r
struct ena_rx_buffer *rx_info;
struct ena_adapter *adapter;
unsigned int descs = ena_rx_ctx->descs;
+   int rc;
uint16_t ntc, len, req_id, buf = 0;
 
ntc = *next_to_clean;
@@ -1485,6 +1482,10 @@ ena_rx_mbuf(struct ena_ring *rx_ring, struct ena_com_r
 
len = ena_bufs[buf].len;
req_id = ena_bufs[buf].req_id;
+   rc = validate_rx_req_id(rx_ring, req_id);
+   if (unlikely(rc != 0))
+   return (NULL);
+
rx_info = _ring->rx_buffer_info[req_id];
 
ena_trace(ENA_DBG | ENA_RXPTH, "rx_info %p, mbuf %p, paddr %jx",
@@ -1517,6 +1518,16 @@ ena_rx_mbuf(struct ena_ring *rx_ring, struct ena_com_r
++buf;
len = ena_bufs[buf].len;
req_id = ena_bufs[buf].req_id;
+   rc = validate_rx_req_id(rx_ring, req_id);
+   if (unlikely(rc != 0)) {
+   /*
+* If the req_id is invalid, then the device will be
+* reset. In that case we must free all mbufs that
+* were already gathered.
+*/
+   m_freem(mbuf);
+   return (NULL);
+   }
rx_info = _ring->rx_buffer_info[req_id];
 
if (unlikely(rx_info->mbuf == 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: r344149 - in stable/12: . share/man/man4 sys/amd64/conf sys/arm64/conf sys/conf sys/dev/ixgbe sys/i386/conf sys/mips/conf sys/modules sys/modules/iflib sys/powerpc/conf sys/powerpc/conf...

2019-02-15 Thread Konstantin Belousov
Author: kib
Date: Fri Feb 15 09:49:09 2019
New Revision: 344149
URL: https://svnweb.freebsd.org/changeset/base/344149

Log:
  MFC r343617, r343618:
  Make iflib a loadable module.

Added:
  stable/12/sys/modules/iflib/
 - copied from r343617, head/sys/modules/iflib/
Modified:
  stable/12/UPDATING
  stable/12/share/man/man4/bnxt.4
  stable/12/share/man/man4/em.4
  stable/12/share/man/man4/iavf.4
  stable/12/share/man/man4/ixgbe.4
  stable/12/share/man/man4/ixl.4
  stable/12/share/man/man4/vmx.4
  stable/12/sys/amd64/conf/GENERIC
  stable/12/sys/arm64/conf/GENERIC
  stable/12/sys/conf/NOTES
  stable/12/sys/conf/files
  stable/12/sys/dev/ixgbe/if_ixv.c
  stable/12/sys/i386/conf/GENERIC
  stable/12/sys/mips/conf/OCTEON1
  stable/12/sys/mips/conf/std.XLP
  stable/12/sys/modules/Makefile
  stable/12/sys/modules/iflib/Makefile
  stable/12/sys/powerpc/conf/GENERIC64
  stable/12/sys/powerpc/conf/MPC85XX
  stable/12/sys/powerpc/conf/MPC85XXSPE
  stable/12/sys/powerpc/conf/QORIQ64
  stable/12/sys/powerpc/conf/dpaa/DPAA
  stable/12/sys/sparc64/conf/GENERIC
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/UPDATING
==
--- stable/12/UPDATING  Fri Feb 15 09:45:17 2019(r344148)
+++ stable/12/UPDATING  Fri Feb 15 09:49:09 2019(r344149)
@@ -16,6 +16,13 @@ from older versions of FreeBSD, try WITHOUT_CLANG and 
 the tip of head, and then rebuild without this option. The bootstrap process
 from older version of current across the gcc/clang cutover is a bit fragile.
 
+20190214:
+   Iflib is no longer unconditionally compiled into the kernel.  Drivers
+   using iflib and statically compiled into the kernel, now require
+   the 'device iflib' config option.  For the same drivers loaded as
+   modules on kernels not having 'device iflib', the iflib.ko module
+   is loaded automatically.
+
 20181228:
r342561 modifies the NFSv4 server so that it obeys vfs.nfsd.nfs_privport
in the same as it is applied to NFSv2 and 3.  This implies that NFSv4

Modified: stable/12/share/man/man4/bnxt.4
==
--- stable/12/share/man/man4/bnxt.4 Fri Feb 15 09:45:17 2019
(r344148)
+++ stable/12/share/man/man4/bnxt.4 Fri Feb 15 09:49:09 2019
(r344149)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 20, 2018
+.Dd January 30, 2019
 .Dt BNXT 4
 .Os
 .Sh NAME
@@ -36,6 +36,7 @@ To compile this driver into the kernel,
 place the following lines in your
 kernel configuration file:
 .Bd -ragged -offset indent
+.Cd "device iflib"
 .Cd "device bnxt"
 .Ed
 .Pp

Modified: stable/12/share/man/man4/em.4
==
--- stable/12/share/man/man4/em.4   Fri Feb 15 09:45:17 2019
(r344148)
+++ stable/12/share/man/man4/em.4   Fri Feb 15 09:49:09 2019
(r344149)
@@ -31,7 +31,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 20, 2018
+.Dd January 30, 2019
 .Dt EM 4
 .Os
 .Sh NAME
@@ -39,9 +39,10 @@
 .Nd "Intel(R) PRO/1000 Gigabit Ethernet adapter driver"
 .Sh SYNOPSIS
 To compile this driver into the kernel,
-place the following line in your
+place the following lines in your
 kernel configuration file:
 .Bd -ragged -offset indent
+.Cd "device iflib"
 .Cd "device em"
 .Ed
 .Pp

Modified: stable/12/share/man/man4/iavf.4
==
--- stable/12/share/man/man4/iavf.4 Fri Feb 15 09:45:17 2019
(r344148)
+++ stable/12/share/man/man4/iavf.4 Fri Feb 15 09:49:09 2019
(r344149)
@@ -31,7 +31,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 5, 2018
+.Dd January 30, 2019
 .Dt IAVF 4
 .Os
 .Sh NAME
@@ -41,6 +41,7 @@
 To compile this driver into the kernel, place the following lines in your
 kernel configuration file:
 .Bd -ragged -offset indent
+.Cd "device iflib"
 .Cd "device iavf"
 .Ed
 .Pp

Modified: stable/12/share/man/man4/ixgbe.4
==
--- stable/12/share/man/man4/ixgbe.4Fri Feb 15 09:45:17 2019
(r344148)
+++ stable/12/share/man/man4/ixgbe.4Fri Feb 15 09:49:09 2019
(r344149)
@@ -31,7 +31,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 19, 2010
+.Dd January 30, 2019
 .Dt IXGBE 4
 .Os
 .Sh NAME
@@ -39,9 +39,10 @@
 .Nd "Intel(R) 10Gb Ethernet driver for the FreeBSD operating system"
 .Sh SYNOPSIS
 To compile this driver into the kernel,
-place the following line in your
+place the following lines in your
 kernel configuration file:
 .Bd -ragged -offset indent
+.Cd "device iflib"
 .Cd "device ixgbe"
 .Ed
 .Pp

Modified: stable/12/share/man/man4/ixl.4
==
--- stable/12/share/man/man4/ixl.4  Fri Feb 15 09:45:17 2019
(r344148)
+++ stable/12/share/man/man4/ixl.4  Fri Feb 15 09:49:09 

svn commit: r344148 - head/sys/netinet

2019-02-15 Thread Michael Tuexen
Author: tuexen
Date: Fri Feb 15 09:45:17 2019
New Revision: 344148
URL: https://svnweb.freebsd.org/changeset/base/344148

Log:
  Fix a byte ordering issue for the advertised receiver window in ACK
  segments sent in TIMEWAIT state, which I introduced in r336937.
  
  MFC after:3 days
  Sponsored by: Netflix, Inc.

Modified:
  head/sys/netinet/tcp_timewait.c

Modified: head/sys/netinet/tcp_timewait.c
==
--- head/sys/netinet/tcp_timewait.c Fri Feb 15 09:25:52 2019
(r344147)
+++ head/sys/netinet/tcp_timewait.c Fri Feb 15 09:45:17 2019
(r344148)
@@ -302,7 +302,7 @@ tcp_twstart(struct tcpcb *tp)
if (SEQ_GT(tp->rcv_adv, tp->rcv_nxt) &&
recwin < (tp->rcv_adv - tp->rcv_nxt))
recwin = (tp->rcv_adv - tp->rcv_nxt);
-   tw->last_win = htons((u_short)(recwin >> tp->rcv_scale));
+   tw->last_win = (u_short)(recwin >> tp->rcv_scale);
 
/*
 * Set t_recent if timestamps are used on the connection.
___
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: r344147 - stable/9/usr.sbin/bluetooth/sdpd

2019-02-15 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Feb 15 09:25:52 2019
New Revision: 344147
URL: https://svnweb.freebsd.org/changeset/base/344147

Log:
  MFC r343905:
  Improve Bluetooth device discovery support for Android and Microsoft devices.
  
  Tested using the virtual_bt_speaker(8) tool from the virtual_oss(8)
  project at github.com.
  
  PR:   210089
  Sponsored by: Mellanox Technologies

Modified:
  stable/9/usr.sbin/bluetooth/sdpd/ssar.c
Directory Properties:
  stable/9/usr.sbin/   (props changed)
  stable/9/usr.sbin/bluetooth/sdpd/   (props changed)

Modified: stable/9/usr.sbin/bluetooth/sdpd/ssar.c
==
--- stable/9/usr.sbin/bluetooth/sdpd/ssar.c Fri Feb 15 09:22:23 2019
(r344146)
+++ stable/9/usr.sbin/bluetooth/sdpd/ssar.c Fri Feb 15 09:25:52 2019
(r344147)
@@ -44,6 +44,131 @@ int32_t server_prepare_attr_list(provider_p const prov
uint8_t *rsp, uint8_t const * const rsp_end);
 
 /*
+ * Scan an attribute for matching UUID.
+ */
+static int
+server_search_uuid_sub(uint8_t *buf, uint8_t const * const eob, const 
uint128_t *uuid)
+{
+int128_t duuid;
+uint32_t value;
+uint8_t type;
+
+while (buf < eob) {
+
+SDP_GET8(type, buf);
+
+switch (type) {
+case SDP_DATA_UUID16:
+if (buf + 2 > eob)
+continue;
+SDP_GET16(value, buf);
+
+memcpy(, _base, sizeof(duuid));
+duuid.b[2] = value >> 8 & 0xff;
+duuid.b[3] = value & 0xff;
+
+if (memcmp(, uuid, sizeof(duuid)) == 0)
+return (0);
+break;
+case SDP_DATA_UUID32:
+if (buf + 4 > eob)
+continue;
+SDP_GET32(value, buf);
+memcpy(, _base, sizeof(duuid));
+duuid.b[0] = value >> 24 & 0xff;
+duuid.b[1] = value >> 16 & 0xff;
+duuid.b[2] = value >> 8 & 0xff;
+duuid.b[3] = value & 0xff;
+
+if (memcmp(, uuid, sizeof(duuid)) == 0)
+return (0);
+break;
+case SDP_DATA_UUID128:
+if (buf + 16 > eob)
+continue;
+SDP_GET_UUID128(, buf);
+
+if (memcmp(, uuid, sizeof(duuid)) == 0)
+return (0);
+break;
+case SDP_DATA_UINT8:
+case SDP_DATA_INT8:
+case SDP_DATA_SEQ8:
+buf++;
+break;
+case SDP_DATA_UINT16:
+case SDP_DATA_INT16:
+case SDP_DATA_SEQ16:
+buf += 2;
+break;
+case SDP_DATA_UINT32:
+case SDP_DATA_INT32:
+case SDP_DATA_SEQ32:
+buf += 4;
+break;
+case SDP_DATA_UINT64:
+case SDP_DATA_INT64:
+buf += 8;
+break;
+case SDP_DATA_UINT128:
+case SDP_DATA_INT128:
+buf += 16;
+break;
+case SDP_DATA_STR8:
+if (buf + 1 > eob)
+continue;
+SDP_GET8(value, buf);
+buf += value;
+break;
+case SDP_DATA_STR16:
+if (buf + 2 > eob)
+continue;
+SDP_GET16(value, buf);
+if (value > (eob - buf))
+return (1);
+buf += value;
+break;
+case SDP_DATA_STR32:
+if (buf + 4 > eob)
+continue;
+SDP_GET32(value, buf);
+if (value > (eob - buf))
+return (1);
+buf += value;
+break;
+case SDP_DATA_BOOL:
+buf += 1;
+break;
+default:
+return (1);
+}
+}
+return (1);
+}
+
+/*
+ * Search a provider for matching UUID in its attributes.
+ */
+static int
+server_search_uuid(provider_p const provider, const uint128_t *uuid)
+{
+uint8_t buffer[256];
+const attr_t *attr;
+int len;
+
+for (attr = 

svn commit: r344146 - stable/10/usr.sbin/bluetooth/sdpd

2019-02-15 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Feb 15 09:22:23 2019
New Revision: 344146
URL: https://svnweb.freebsd.org/changeset/base/344146

Log:
  MFC r343905:
  Improve Bluetooth device discovery support for Android and Microsoft devices.
  
  Tested using the virtual_bt_speaker(8) tool from the virtual_oss(8)
  project at github.com.
  
  PR:   210089
  Sponsored by: Mellanox Technologies

Modified:
  stable/10/usr.sbin/bluetooth/sdpd/ssar.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/bluetooth/sdpd/ssar.c
==
--- stable/10/usr.sbin/bluetooth/sdpd/ssar.cFri Feb 15 09:21:16 2019
(r344145)
+++ stable/10/usr.sbin/bluetooth/sdpd/ssar.cFri Feb 15 09:22:23 2019
(r344146)
@@ -44,6 +44,131 @@ int32_t server_prepare_attr_list(provider_p const prov
uint8_t *rsp, uint8_t const * const rsp_end);
 
 /*
+ * Scan an attribute for matching UUID.
+ */
+static int
+server_search_uuid_sub(uint8_t *buf, uint8_t const * const eob, const 
uint128_t *uuid)
+{
+int128_t duuid;
+uint32_t value;
+uint8_t type;
+
+while (buf < eob) {
+
+SDP_GET8(type, buf);
+
+switch (type) {
+case SDP_DATA_UUID16:
+if (buf + 2 > eob)
+continue;
+SDP_GET16(value, buf);
+
+memcpy(, _base, sizeof(duuid));
+duuid.b[2] = value >> 8 & 0xff;
+duuid.b[3] = value & 0xff;
+
+if (memcmp(, uuid, sizeof(duuid)) == 0)
+return (0);
+break;
+case SDP_DATA_UUID32:
+if (buf + 4 > eob)
+continue;
+SDP_GET32(value, buf);
+memcpy(, _base, sizeof(duuid));
+duuid.b[0] = value >> 24 & 0xff;
+duuid.b[1] = value >> 16 & 0xff;
+duuid.b[2] = value >> 8 & 0xff;
+duuid.b[3] = value & 0xff;
+
+if (memcmp(, uuid, sizeof(duuid)) == 0)
+return (0);
+break;
+case SDP_DATA_UUID128:
+if (buf + 16 > eob)
+continue;
+SDP_GET_UUID128(, buf);
+
+if (memcmp(, uuid, sizeof(duuid)) == 0)
+return (0);
+break;
+case SDP_DATA_UINT8:
+case SDP_DATA_INT8:
+case SDP_DATA_SEQ8:
+buf++;
+break;
+case SDP_DATA_UINT16:
+case SDP_DATA_INT16:
+case SDP_DATA_SEQ16:
+buf += 2;
+break;
+case SDP_DATA_UINT32:
+case SDP_DATA_INT32:
+case SDP_DATA_SEQ32:
+buf += 4;
+break;
+case SDP_DATA_UINT64:
+case SDP_DATA_INT64:
+buf += 8;
+break;
+case SDP_DATA_UINT128:
+case SDP_DATA_INT128:
+buf += 16;
+break;
+case SDP_DATA_STR8:
+if (buf + 1 > eob)
+continue;
+SDP_GET8(value, buf);
+buf += value;
+break;
+case SDP_DATA_STR16:
+if (buf + 2 > eob)
+continue;
+SDP_GET16(value, buf);
+if (value > (eob - buf))
+return (1);
+buf += value;
+break;
+case SDP_DATA_STR32:
+if (buf + 4 > eob)
+continue;
+SDP_GET32(value, buf);
+if (value > (eob - buf))
+return (1);
+buf += value;
+break;
+case SDP_DATA_BOOL:
+buf += 1;
+break;
+default:
+return (1);
+}
+}
+return (1);
+}
+
+/*
+ * Search a provider for matching UUID in its attributes.
+ */
+static int
+server_search_uuid(provider_p const provider, const uint128_t *uuid)
+{
+uint8_t buffer[256];
+const attr_t *attr;
+int len;
+
+for (attr = provider->profile->attrs; attr->create != NULL; attr++) {
+
+  

svn commit: r344145 - stable/11/usr.sbin/bluetooth/sdpd

2019-02-15 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Feb 15 09:21:16 2019
New Revision: 344145
URL: https://svnweb.freebsd.org/changeset/base/344145

Log:
  MFC r343905:
  Improve Bluetooth device discovery support for Android and Microsoft devices.
  
  Tested using the virtual_bt_speaker(8) tool from the virtual_oss(8)
  project at github.com.
  
  PR:   210089
  Sponsored by: Mellanox Technologies

Modified:
  stable/11/usr.sbin/bluetooth/sdpd/ssar.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/bluetooth/sdpd/ssar.c
==
--- stable/11/usr.sbin/bluetooth/sdpd/ssar.cFri Feb 15 09:20:10 2019
(r344144)
+++ stable/11/usr.sbin/bluetooth/sdpd/ssar.cFri Feb 15 09:21:16 2019
(r344145)
@@ -47,6 +47,131 @@ int32_t server_prepare_attr_list(provider_p const prov
uint8_t *rsp, uint8_t const * const rsp_end);
 
 /*
+ * Scan an attribute for matching UUID.
+ */
+static int
+server_search_uuid_sub(uint8_t *buf, uint8_t const * const eob, const 
uint128_t *uuid)
+{
+int128_t duuid;
+uint32_t value;
+uint8_t type;
+
+while (buf < eob) {
+
+SDP_GET8(type, buf);
+
+switch (type) {
+case SDP_DATA_UUID16:
+if (buf + 2 > eob)
+continue;
+SDP_GET16(value, buf);
+
+memcpy(, _base, sizeof(duuid));
+duuid.b[2] = value >> 8 & 0xff;
+duuid.b[3] = value & 0xff;
+
+if (memcmp(, uuid, sizeof(duuid)) == 0)
+return (0);
+break;
+case SDP_DATA_UUID32:
+if (buf + 4 > eob)
+continue;
+SDP_GET32(value, buf);
+memcpy(, _base, sizeof(duuid));
+duuid.b[0] = value >> 24 & 0xff;
+duuid.b[1] = value >> 16 & 0xff;
+duuid.b[2] = value >> 8 & 0xff;
+duuid.b[3] = value & 0xff;
+
+if (memcmp(, uuid, sizeof(duuid)) == 0)
+return (0);
+break;
+case SDP_DATA_UUID128:
+if (buf + 16 > eob)
+continue;
+SDP_GET_UUID128(, buf);
+
+if (memcmp(, uuid, sizeof(duuid)) == 0)
+return (0);
+break;
+case SDP_DATA_UINT8:
+case SDP_DATA_INT8:
+case SDP_DATA_SEQ8:
+buf++;
+break;
+case SDP_DATA_UINT16:
+case SDP_DATA_INT16:
+case SDP_DATA_SEQ16:
+buf += 2;
+break;
+case SDP_DATA_UINT32:
+case SDP_DATA_INT32:
+case SDP_DATA_SEQ32:
+buf += 4;
+break;
+case SDP_DATA_UINT64:
+case SDP_DATA_INT64:
+buf += 8;
+break;
+case SDP_DATA_UINT128:
+case SDP_DATA_INT128:
+buf += 16;
+break;
+case SDP_DATA_STR8:
+if (buf + 1 > eob)
+continue;
+SDP_GET8(value, buf);
+buf += value;
+break;
+case SDP_DATA_STR16:
+if (buf + 2 > eob)
+continue;
+SDP_GET16(value, buf);
+if (value > (eob - buf))
+return (1);
+buf += value;
+break;
+case SDP_DATA_STR32:
+if (buf + 4 > eob)
+continue;
+SDP_GET32(value, buf);
+if (value > (eob - buf))
+return (1);
+buf += value;
+break;
+case SDP_DATA_BOOL:
+buf += 1;
+break;
+default:
+return (1);
+}
+}
+return (1);
+}
+
+/*
+ * Search a provider for matching UUID in its attributes.
+ */
+static int
+server_search_uuid(provider_p const provider, const uint128_t *uuid)
+{
+uint8_t buffer[256];
+const attr_t *attr;
+int len;
+
+for (attr = provider->profile->attrs; attr->create != NULL; attr++) {
+
+  

svn commit: r344144 - stable/12/usr.sbin/bluetooth/sdpd

2019-02-15 Thread Hans Petter Selasky
Author: hselasky
Date: Fri Feb 15 09:20:10 2019
New Revision: 344144
URL: https://svnweb.freebsd.org/changeset/base/344144

Log:
  MFC r343905:
  Improve Bluetooth device discovery support for Android and Microsoft devices.
  
  Tested using the virtual_bt_speaker(8) tool from the virtual_oss(8)
  project at github.com.
  
  PR:   210089
  Sponsored by: Mellanox Technologies

Modified:
  stable/12/usr.sbin/bluetooth/sdpd/ssar.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.sbin/bluetooth/sdpd/ssar.c
==
--- stable/12/usr.sbin/bluetooth/sdpd/ssar.cFri Feb 15 04:15:43 2019
(r344143)
+++ stable/12/usr.sbin/bluetooth/sdpd/ssar.cFri Feb 15 09:20:10 2019
(r344144)
@@ -47,6 +47,131 @@ int32_t server_prepare_attr_list(provider_p const prov
uint8_t *rsp, uint8_t const * const rsp_end);
 
 /*
+ * Scan an attribute for matching UUID.
+ */
+static int
+server_search_uuid_sub(uint8_t *buf, uint8_t const * const eob, const 
uint128_t *uuid)
+{
+int128_t duuid;
+uint32_t value;
+uint8_t type;
+
+while (buf < eob) {
+
+SDP_GET8(type, buf);
+
+switch (type) {
+case SDP_DATA_UUID16:
+if (buf + 2 > eob)
+continue;
+SDP_GET16(value, buf);
+
+memcpy(, _base, sizeof(duuid));
+duuid.b[2] = value >> 8 & 0xff;
+duuid.b[3] = value & 0xff;
+
+if (memcmp(, uuid, sizeof(duuid)) == 0)
+return (0);
+break;
+case SDP_DATA_UUID32:
+if (buf + 4 > eob)
+continue;
+SDP_GET32(value, buf);
+memcpy(, _base, sizeof(duuid));
+duuid.b[0] = value >> 24 & 0xff;
+duuid.b[1] = value >> 16 & 0xff;
+duuid.b[2] = value >> 8 & 0xff;
+duuid.b[3] = value & 0xff;
+
+if (memcmp(, uuid, sizeof(duuid)) == 0)
+return (0);
+break;
+case SDP_DATA_UUID128:
+if (buf + 16 > eob)
+continue;
+SDP_GET_UUID128(, buf);
+
+if (memcmp(, uuid, sizeof(duuid)) == 0)
+return (0);
+break;
+case SDP_DATA_UINT8:
+case SDP_DATA_INT8:
+case SDP_DATA_SEQ8:
+buf++;
+break;
+case SDP_DATA_UINT16:
+case SDP_DATA_INT16:
+case SDP_DATA_SEQ16:
+buf += 2;
+break;
+case SDP_DATA_UINT32:
+case SDP_DATA_INT32:
+case SDP_DATA_SEQ32:
+buf += 4;
+break;
+case SDP_DATA_UINT64:
+case SDP_DATA_INT64:
+buf += 8;
+break;
+case SDP_DATA_UINT128:
+case SDP_DATA_INT128:
+buf += 16;
+break;
+case SDP_DATA_STR8:
+if (buf + 1 > eob)
+continue;
+SDP_GET8(value, buf);
+buf += value;
+break;
+case SDP_DATA_STR16:
+if (buf + 2 > eob)
+continue;
+SDP_GET16(value, buf);
+if (value > (eob - buf))
+return (1);
+buf += value;
+break;
+case SDP_DATA_STR32:
+if (buf + 4 > eob)
+continue;
+SDP_GET32(value, buf);
+if (value > (eob - buf))
+return (1);
+buf += value;
+break;
+case SDP_DATA_BOOL:
+buf += 1;
+break;
+default:
+return (1);
+}
+}
+return (1);
+}
+
+/*
+ * Search a provider for matching UUID in its attributes.
+ */
+static int
+server_search_uuid(provider_p const provider, const uint128_t *uuid)
+{
+uint8_t buffer[256];
+const attr_t *attr;
+int len;
+
+for (attr = provider->profile->attrs; attr->create != NULL; attr++) {
+
+