svn commit: r342963 - head/tests/sys/kern

2019-01-12 Thread Andrew Turner
Author: andrew
Date: Sat Jan 12 11:50:39 2019
New Revision: 342963
URL: https://svnweb.freebsd.org/changeset/base/342963

Log:
  Temporarily disable the kcov tests. Not all architectures have
  atomic_store_64 and atomic_store_64.
  
  Sponsored by: DARPA, AFRL

Modified:
  head/tests/sys/kern/Makefile

Modified: head/tests/sys/kern/Makefile
==
--- head/tests/sys/kern/MakefileSat Jan 12 11:21:28 2019
(r342962)
+++ head/tests/sys/kern/MakefileSat Jan 12 11:50:39 2019
(r342963)
@@ -5,7 +5,7 @@ TESTSRC=${SRCTOP}/contrib/netbsd-tests/kernel
 
 TESTSDIR=  ${TESTSBASE}/sys/kern
 
-ATF_TESTS_C+=  kcov
+#ATF_TESTS_C+= kcov
 ATF_TESTS_C+=  kern_copyin
 ATF_TESTS_C+=  kern_descrip_test
 ATF_TESTS_C+=  ptrace_test
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r342963 - head/tests/sys/kern

2019-01-12 Thread Warner Losh
On Sat, Jan 12, 2019 at 10:15 AM Dimitry Andric  wrote:

> On 12 Jan 2019, at 18:09, Warner Losh  wrote:
> >
> > On Sat, Jan 12, 2019, 4:50 AM Andrew Turner  > Author: andrew
> > Date: Sat Jan 12 11:50:39 2019
> > New Revision: 342963
> > URL: https://svnweb.freebsd.org/changeset/base/342963
> >
> > Log:
> >   Temporarily disable the kcov tests. Not all architectures have
> >   atomic_store_64 and atomic_store_64.
> >
> > What is the difference between these two things?
>
> I think Andrew meant "atomic_load_64 and atomic_store_64". :-)
>

I think so too... was just having a little fun :)

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


svn commit: r342971 - head/share/man/man4

2019-01-12 Thread Allan Jude
Author: allanjude
Date: Sat Jan 12 17:52:52 2019
New Revision: 342971
URL: https://svnweb.freebsd.org/changeset/base/342971

Log:
  Add missing documentation for dev.acpi_ibm.0.mic_led added in r335304
  
  PR:   229074
  X-MFC-With:   335304
  Submitted by: Ali Abdallah 

Modified:
  head/share/man/man4/acpi_ibm.4

Modified: head/share/man/man4/acpi_ibm.4
==
--- head/share/man/man4/acpi_ibm.4  Sat Jan 12 17:00:54 2019
(r342970)
+++ head/share/man/man4/acpi_ibm.4  Sat Jan 12 17:52:52 2019
(r342971)
@@ -273,6 +273,9 @@ Current brightness level of the display.
 Speaker volume.
 .It Va dev.acpi_ibm.0.mute
 Indicates, whether the speakers are muted or not.
+.It Va dev.acpi_ibm.0.mic_mute
+Indicates, whether the microphone led (present on some model) is on or not. 
+Note that this does not mean that the microphone input is muted.
 .It Va dev.acpi_ibm.0.thinklight
 Indicates, whether the ThinkLight keyboard light is activated or not.
 .It Va dev.acpi_ibm.0.bluetooth
@@ -437,6 +440,17 @@ case ${NOTIFY} in
 MESSAGE="volume unmuted"
 fi
 ;;
+   0x1b)
+   LEVEL=`sysctl -n dev.acpi_ibm.0.mic_led`
+   if [ $LEVEL -eq 0 ]; then
+   sysctl dev.acpi_ibm.0.mic_led=1
+   mixer rec 0
+   fi 
+   if [ $LEVEL -eq 1 ]; then 
+   sysctl dev.acpi_ibm.0.mic_led=0
+   mixer rec 30
+   fi
+   ;;
 *)
 ;;
 esac
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r342961 - in head/sys/dev: sound/usb usb usb/quirk

2019-01-12 Thread Hans Petter Selasky
Author: hselasky
Date: Sat Jan 12 11:14:59 2019
New Revision: 342961
URL: https://svnweb.freebsd.org/changeset/base/342961

Log:
  snd_uaudio: Add quirks for Edirol UA-25EX in advanced driver mode.
  
  Extend the vendor class USB audio quirk to cover devices without
  the USB audio control descriptor.
  
  PR:   234794
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/dev/sound/usb/uaudio.c
  head/sys/dev/sound/usb/uaudioreg.h
  head/sys/dev/usb/quirk/usb_quirk.c
  head/sys/dev/usb/usbdevs

Modified: head/sys/dev/sound/usb/uaudio.c
==
--- head/sys/dev/sound/usb/uaudio.c Sat Jan 12 08:30:13 2019
(r342960)
+++ head/sys/dev/sound/usb/uaudio.c Sat Jan 12 11:14:59 2019
(r342961)
@@ -1745,7 +1745,7 @@ uaudio_chan_fill_info_sub(struct uaudio_softc *sc, str
continue;
}
 
-   if ((acdp != NULL) &&
+   if ((acdp != NULL || sc->sc_uq_au_vendor_class != 0) &&
(desc->bDescriptorType == UDESC_CS_INTERFACE) &&
(desc->bDescriptorSubtype == AS_GENERAL) &&
(asid.v1 == NULL)) {
@@ -1761,7 +1761,7 @@ uaudio_chan_fill_info_sub(struct uaudio_softc *sc, str
}
}
}
-   if ((acdp != NULL) &&
+   if ((acdp != NULL || sc->sc_uq_au_vendor_class != 0) &&
(desc->bDescriptorType == UDESC_CS_INTERFACE) &&
(desc->bDescriptorSubtype == FORMAT_TYPE) &&
(asf1d.v1 == NULL)) {
@@ -1800,7 +1800,7 @@ uaudio_chan_fill_info_sub(struct uaudio_softc *sc, str
continue;
}
}
-   if ((acdp != NULL) &&
+   if ((acdp != NULL || sc->sc_uq_au_vendor_class != 0) &&
(desc->bDescriptorType == UDESC_CS_ENDPOINT) &&
(desc->bDescriptorSubtype == AS_GENERAL) &&
(sed.v1 == NULL)) {

Modified: head/sys/dev/sound/usb/uaudioreg.h
==
--- head/sys/dev/sound/usb/uaudioreg.h  Sat Jan 12 08:30:13 2019
(r342960)
+++ head/sys/dev/sound/usb/uaudioreg.h  Sat Jan 12 11:14:59 2019
(r342961)
@@ -36,7 +36,7 @@
 #ifndef _UAUDIOREG_H_
 #define_UAUDIOREG_H_
 
-#defineUAUDIO_VERSION  0x0100
+#defineUAUDIO_VERSION_10   0x0100
 #defineUAUDIO_VERSION_20   0x0200
 #defineUAUDIO_VERSION_30   0x0300
 

Modified: head/sys/dev/usb/quirk/usb_quirk.c
==
--- head/sys/dev/usb/quirk/usb_quirk.c  Sat Jan 12 08:30:13 2019
(r342960)
+++ head/sys/dev/usb/quirk/usb_quirk.c  Sat Jan 12 11:14:59 2019
(r342961)
@@ -529,6 +529,7 @@ static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRK
USB_QUIRK(MAUDIO, FASTTRACKULTRA8R, 0x, 0x, UQ_AU_VENDOR_CLASS),
USB_QUIRK(CMEDIA, CM6206, 0x, 0x, UQ_AU_SET_SPDIF_CM6206),
USB_QUIRK(PLOYTEC, SPL_CRIMSON_1, 0x, 0x, UQ_CFG_INDEX_1),
+   USB_QUIRK(ROLAND, UA25EX_AD, 0x, 0x, UQ_AU_VENDOR_CLASS),
 
/*
 * Quirks for manufacturers which USB devices does not respond

Modified: head/sys/dev/usb/usbdevs
==
--- head/sys/dev/usb/usbdevsSat Jan 12 08:30:13 2019(r342960)
+++ head/sys/dev/usb/usbdevsSat Jan 12 11:14:59 2019(r342961)
@@ -3998,6 +3998,8 @@ product ROLAND SD20   0x0027  SD-20 MIDI Synth
 product ROLAND SD800x0029  SD-80 MIDI Synth
 product ROLAND UA700   0x002b  UA-700 Audio I/F
 product ROLAND PCR300  0x0033  EDIROL PCR-300 MIDI I/F
+product ROLAND UA25EX_AD   0x00e6  EDIROL UA-25EX (Advanced Driver)
+product ROLAND UA25EX_CC   0x00e7  EDIROL UA-25EX (Class Compliant)
 
 /* Rockfire products */
 product ROCKFIRE GAMEPAD   0x2033  gamepad 203USB
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r342966 - head/sys/net80211

2019-01-12 Thread Andriy Voskoboinyk
Author: avos
Date: Sat Jan 12 14:57:12 2019
New Revision: 342966
URL: https://svnweb.freebsd.org/changeset/base/342966

Log:
  net80211: fix possible panic for some drivers after r342211
  
  Check if rate control structures were allocated before trying to
  access them in various places; this was possible before on
  allocation failure (unlikely), but was revealed after r342211
  where allocation was deferred.
  
  In case if driver uses wlan_amrr(4) and it is loaded it
  is possible to reproduce the panic via
  
  sysctl net.wlan..rate_stats
  
  (for wlan0 the number will be 0).
  
  Tested with: RTL8188EE, AP mode + RTL8188CUS, STA mode.
  
  MFC after:3 days

Modified:
  head/sys/net80211/ieee80211_amrr.c
  head/sys/net80211/ieee80211_rssadapt.c

Modified: head/sys/net80211/ieee80211_amrr.c
==
--- head/sys/net80211/ieee80211_amrr.c  Sat Jan 12 12:57:32 2019
(r342965)
+++ head/sys/net80211/ieee80211_amrr.c  Sat Jan 12 14:57:12 2019
(r342966)
@@ -104,6 +104,9 @@ amrr_setinterval(const struct ieee80211vap *vap, int m
struct ieee80211_amrr *amrr = vap->iv_rs;
int t;
 
+   if (!amrr)
+   return;
+
if (msecs < 100)
msecs = 100;
t = msecs_to_ticks(msecs);
@@ -166,6 +169,12 @@ amrr_node_init(struct ieee80211_node *ni)
struct ieee80211_amrr_node *amn;
uint8_t rate;
 
+   if (!amrr) {
+   if_printf(vap->iv_ifp, "ratectl structure was not allocated, "
+   "per-node structure allocation skipped\n");
+   return;
+   }
+
if (ni->ni_rctls == NULL) {
ni->ni_rctls = amn = IEEE80211_MALLOC(sizeof(struct 
ieee80211_amrr_node),
M_80211_RATECTL, IEEE80211_M_NOWAIT | IEEE80211_M_ZERO);
@@ -327,10 +336,19 @@ static int
 amrr_rate(struct ieee80211_node *ni, void *arg __unused, uint32_t iarg 
__unused)
 {
struct ieee80211_amrr_node *amn = ni->ni_rctls;
-   struct ieee80211_amrr *amrr = amn->amn_amrr;
+   struct ieee80211_amrr *amrr;
const struct ieee80211_rateset *rs = NULL;
int rix;
 
+   /* XXX should return -1 here, but drivers may not expect this... */
+   if (!amn)
+   {
+   ni->ni_txrate = ni->ni_rates.rs_rates[0];
+   return 0;
+   }
+
+   amrr = amn->amn_amrr;
+
/* 11n or not? Pick the right rateset */
if (amrr_node_is_11n(ni)) {
/* XXX ew */
@@ -369,6 +387,9 @@ amrr_tx_complete(const struct ieee80211_node *ni,
struct ieee80211_amrr_node *amn = ni->ni_rctls;
int retries;
 
+   if (!amn)
+   return;
+
retries = 0;
if (status->flags & IEEE80211_RATECTL_STATUS_LONG_RETRY)
retries = status->long_retries;
@@ -386,6 +407,9 @@ amrr_tx_update_cb(void *arg, struct ieee80211_node *ni
struct ieee80211_amrr_node *amn = ni->ni_rctls;
int txcnt, success, retrycnt;
 
+   if (!amn)
+   return;
+
txcnt = stats->nframes;
success = stats->nsuccess;
retrycnt = 0;
@@ -420,9 +444,12 @@ amrr_sysctl_interval(SYSCTL_HANDLER_ARGS)
 {
struct ieee80211vap *vap = arg1;
struct ieee80211_amrr *amrr = vap->iv_rs;
-   int msecs = ticks_to_msecs(amrr->amrr_interval);
-   int error;
+   int msecs, error;
 
+   if (!amrr)
+   return ENOMEM;
+
+   msecs = ticks_to_msecs(amrr->amrr_interval);
error = sysctl_handle_int(oidp, , 0, req);
if (error || !req->newptr)
return error;
@@ -436,6 +463,9 @@ amrr_sysctlattach(struct ieee80211vap *vap,
 {
struct ieee80211_amrr *amrr = vap->iv_rs;
 
+   if (!amrr)
+   return;
+
SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
"amrr_rate_interval", CTLTYPE_INT | CTLFLAG_RW, vap,
0, amrr_sysctl_interval, "I", "amrr operation interval (ms)");
@@ -456,6 +486,9 @@ amrr_node_stats(struct ieee80211_node *ni, struct sbuf
struct ieee80211_rateset *rs;
 
/* XXX TODO: check locking? */
+
+   if (!amn)
+   return;
 
/* XXX TODO: this should be a method */
if (amrr_node_is_11n(ni)) {

Modified: head/sys/net80211/ieee80211_rssadapt.c
==
--- head/sys/net80211/ieee80211_rssadapt.c  Sat Jan 12 12:57:32 2019
(r342965)
+++ head/sys/net80211/ieee80211_rssadapt.c  Sat Jan 12 14:57:12 2019
(r342966)
@@ -119,6 +119,9 @@ rssadapt_setinterval(const struct ieee80211vap *vap, i
struct ieee80211_rssadapt *rs = vap->iv_rs;
int t;
 
+   if (!rs)
+   return;
+
if (msecs < 100)
msecs = 100;
t = msecs_to_ticks(msecs);
@@ -177,6 +180,12 @@ rssadapt_node_init(struct ieee80211_node *ni)
struct ieee80211_rssadapt 

Re: svn commit: r342963 - head/tests/sys/kern

2019-01-12 Thread Warner Losh
On Sat, Jan 12, 2019, 4:50 AM Andrew Turner  Author: andrew
> Date: Sat Jan 12 11:50:39 2019
> New Revision: 342963
> URL: https://svnweb.freebsd.org/changeset/base/342963
>
> Log:
>   Temporarily disable the kcov tests. Not all architectures have
>   atomic_store_64 and atomic_store_64.
>

What is the difference between these two things?

Warner

  Sponsored by: DARPA, AFRL
>
> Modified:
>   head/tests/sys/kern/Makefile
>
> Modified: head/tests/sys/kern/Makefile
>
> ==
> --- head/tests/sys/kern/MakefileSat Jan 12 11:21:28 2019
> (r342962)
> +++ head/tests/sys/kern/MakefileSat Jan 12 11:50:39 2019
> (r342963)
> @@ -5,7 +5,7 @@ TESTSRC=${SRCTOP}/contrib/netbsd-tests/kernel
>
>  TESTSDIR=  ${TESTSBASE}/sys/kern
>
> -ATF_TESTS_C+=  kcov
> +#ATF_TESTS_C+= kcov
>  ATF_TESTS_C+=  kern_copyin
>  ATF_TESTS_C+=  kern_descrip_test
>  ATF_TESTS_C+=  ptrace_test
>
>
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r342963 - head/tests/sys/kern

2019-01-12 Thread Dimitry Andric
On 12 Jan 2019, at 18:09, Warner Losh  wrote:
> 
> On Sat, Jan 12, 2019, 4:50 AM Andrew Turner  Author: andrew
> Date: Sat Jan 12 11:50:39 2019
> New Revision: 342963
> URL: https://svnweb.freebsd.org/changeset/base/342963
> 
> Log:
>   Temporarily disable the kcov tests. Not all architectures have
>   atomic_store_64 and atomic_store_64.
> 
> What is the difference between these two things?

I think Andrew meant "atomic_load_64 and atomic_store_64". :-)

-Dimitry



signature.asc
Description: Message signed with OpenPGP


svn commit: r342972 - head/lib/libsqlite3

2019-01-12 Thread Cy Schubert
Author: cy
Date: Sat Jan 12 17:56:23 2019
New Revision: 342972
URL: https://svnweb.freebsd.org/changeset/base/342972

Log:
  Disable FTS3, FTS4, and RTREE in bundled and private sqlite3.
  
  Suggested by: delphij@
  Reviewed by:  delphij@ (for secteam@)
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D18786

Modified:
  head/lib/libsqlite3/Makefile

Modified: head/lib/libsqlite3/Makefile
==
--- head/lib/libsqlite3/MakefileSat Jan 12 17:52:52 2019
(r342971)
+++ head/lib/libsqlite3/MakefileSat Jan 12 17:56:23 2019
(r342972)
@@ -33,9 +33,6 @@ CFLAGS+=  -I${SQLITE} \
-DHAVE_STRERROR_R=1 \
-DHAVE_POSIX_FALLOCATE=1 \
-D_REENTRANT=1 \
-   -DSQLITE_THREADSAFE=1 \
-   -DSQLITE_ENABLE_FTS3 \
-   -DSQLITE_ENABLE_FTS4 \
-   -DSQLITE_ENABLE_RTREE
+   -DSQLITE_THREADSAFE=1
 
 .include 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r342965 - head/usr.bin/ruptime

2019-01-12 Thread Takahashi Yoshihiro
Author: nyan
Date: Sat Jan 12 12:57:32 2019
New Revision: 342965
URL: https://svnweb.freebsd.org/changeset/base/342965

Log:
  Fix indentation in ruptime command output for hosts in the "down" state.
  
  PR:   234239
  MFC after:1 week

Modified:
  head/usr.bin/ruptime/ruptime.c

Modified: head/usr.bin/ruptime/ruptime.c
==
--- head/usr.bin/ruptime/ruptime.c  Sat Jan 12 12:35:02 2019
(r342964)
+++ head/usr.bin/ruptime/ruptime.c  Sat Jan 12 12:57:32 2019
(r342965)
@@ -264,7 +264,7 @@ ruptime(const char *host, int aflg, int (*cmp)(const v
hsp = [i];
wd = >hs_wd;
if (ISDOWN(hsp)) {
-   (void)printf("%-*.*s%s\n",
+   (void)printf("%-*.*s  %s\n",
hostnamewidth, hostnamewidth, wd->wd_hostname,
interval(now - hsp->hs_wd.wd_recvtime, "down"));
continue;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r342962 - in head: sys/amd64/conf sys/arm64/conf sys/conf sys/kern sys/sys tests/sys/kern

2019-01-12 Thread Andrew Turner
Author: andrew
Date: Sat Jan 12 11:21:28 2019
New Revision: 342962
URL: https://svnweb.freebsd.org/changeset/base/342962

Log:
  Add support for the Clang Coverage Sanitizer in the kernel (KCOV).
  
  When building with KCOV enabled the compiler will insert function calls
  to probes allowing us to trace the execution of the kernel from userspace.
  These probes are on function entry (trace-pc) and on comparison operations
  (trace-cmp).
  
  Userspace can enable the use of these probes on a single kernel thread with
  an ioctl interface. It can allocate space for the probe with KIOSETBUFSIZE,
  then mmap the allocated buffer and enable tracing with KIOENABLE, with the
  trace mode being passed in as the int argument. When complete KIODISABLE
  is used to disable tracing.
  
  The first item in the buffer is the number of trace event that have
  happened. Userspace can write 0 to this to reset the tracing, and is
  expected to do so on first use.
  
  The format of the buffer depends on the trace mode. When in PC tracing just
  the return address of the probe is stored. Under comparison tracing the
  comparison type, the two arguments, and the return address are traced. The
  former method uses on entry per trace event, while the later uses 4. As
  such they are incompatible so only a single mode may be enabled.
  
  KCOV is expected to help fuzzing the kernel, and while in development has
  already found a number of issues. It is required for the syzkaller system
  call fuzzer [1]. Other kernel fuzzers could also make use of it, either
  with the current interface, or by extending it with new modes.
  
  A man page is currently being worked on and is expected to be committed
  soon, however having the code in the kernel now is useful for other
  developers to use.
  
  [1] https://github.com/google/syzkaller
  
  Submitted by: Mitchell Horne  (Earlier version)
  Reviewed by:  kib
  Testing by:   tuexen
  Sponsored by: DARPA, AFRL
  Sponsored by: The FreeBSD Foundation (Mitchell Horne)
  Differential Revision:https://reviews.freebsd.org/D14599

Added:
  head/sys/kern/kern_kcov.c   (contents, props changed)
  head/sys/sys/kcov.h   (contents, props changed)
  head/tests/sys/kern/kcov.c   (contents, props changed)
Modified:
  head/sys/amd64/conf/GENERIC
  head/sys/arm64/conf/GENERIC
  head/sys/conf/files
  head/sys/conf/kern.pre.mk
  head/sys/conf/options
  head/sys/kern/kern_thread.c
  head/sys/sys/proc.h
  head/tests/sys/kern/Makefile

Modified: head/sys/amd64/conf/GENERIC
==
--- head/sys/amd64/conf/GENERIC Sat Jan 12 11:14:59 2019(r342961)
+++ head/sys/amd64/conf/GENERIC Sat Jan 12 11:21:28 2019(r342962)
@@ -102,6 +102,7 @@ options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) 
 optionsVERBOSE_SYSINIT=0   # Support debug.verbose_sysinit, off by 
default
 # Warning: KUBSAN can result in a kernel too large for loader to load
 #options   KUBSAN  # Kernel Undefined Behavior Sanitizer
+#options   KCOV# Kernel Coverage Sanitizer
 
 # Kernel dump features.
 optionsEKCD# Support for encrypted kernel dumps

Modified: head/sys/arm64/conf/GENERIC
==
--- head/sys/arm64/conf/GENERIC Sat Jan 12 11:14:59 2019(r342961)
+++ head/sys/arm64/conf/GENERIC Sat Jan 12 11:21:28 2019(r342962)
@@ -94,6 +94,7 @@ options   USB_DEBUG   # enable debug msgs
 optionsVERBOSE_SYSINIT=0   # Support debug.verbose_sysinit, off by 
default
 # Warning: KUBSAN can result in a kernel too large for loader to load
 #options   KUBSAN  # Kernel Undefined Behavior Sanitizer
+#options   KCOV# Kernel Coverage Sanitizer
 
 # Kernel dump features.
 optionsEKCD# Support for encrypted kernel dumps

Modified: head/sys/conf/files
==
--- head/sys/conf/files Sat Jan 12 11:14:59 2019(r342961)
+++ head/sys/conf/files Sat Jan 12 11:21:28 2019(r342962)
@@ -3807,6 +3807,8 @@ kern/kern_hhook.c standard
 kern/kern_idle.c   standard
 kern/kern_intr.c   standard
 kern/kern_jail.c   standard
+kern/kern_kcov.c   optional kcov   \
+   compile-with"${NORMAL_C} 
-fno-sanitize-coverage=trace-pc,trace-cmp"
 kern/kern_khelp.c  standard
 kern/kern_kthread.cstandard
 kern/kern_ktr.coptional ktr

Modified: head/sys/conf/kern.pre.mk
==
--- head/sys/conf/kern.pre.mk   Sat Jan 12 11:14:59 2019(r342961)
+++ head/sys/conf/kern.pre.mk   Sat Jan 12 11:21:28 2019(r342962)
@@ -117,6 +117,12 @@ 

Re: svn commit: r342963 - head/tests/sys/kern

2019-01-12 Thread Enji Cooper


> On Jan 12, 2019, at 3:50 AM, Andrew Turner  wrote:
> 
> Author: andrew
> Date: Sat Jan 12 11:50:39 2019
> New Revision: 342963
> URL: https://svnweb.freebsd.org/changeset/base/342963
> 
> Log:
>  Temporarily disable the kcov tests. Not all architectures have
>  atomic_store_64 and atomic_store_64.
> 
>  Sponsored by:DARPA, AFRL

Hi Andrew,
Would it make more sense to conditionally enable the tests on some 
architectures instead of disabling it on all architectures?
Thanks!
-Enji


signature.asc
Description: Message signed with OpenPGP


Re: svn commit: r342963 - head/tests/sys/kern

2019-01-12 Thread Warner Losh
On Sat, Jan 12, 2019 at 12:10 PM Enji Cooper  wrote:

>
>
> > On Jan 12, 2019, at 3:50 AM, Andrew Turner  wrote:
> >
> > Author: andrew
> > Date: Sat Jan 12 11:50:39 2019
> > New Revision: 342963
> > URL: https://svnweb.freebsd.org/changeset/base/342963
> >
> > Log:
> >  Temporarily disable the kcov tests. Not all architectures have
> >  atomic_store_64 and atomic_store_64.
> >
> >  Sponsored by:DARPA, AFRL
>
> Hi Andrew,
> Would it make more sense to conditionally enable the tests on some
> architectures instead of disabling it on all architectures?
>

No. Let's stop doing that. Either the architectures provide the 64-bit
stuff, or they will remain broken and removed.

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


Re: svn commit: r342962 - in head: sys/amd64/conf sys/arm64/conf sys/conf sys/kern sys/sys tests/sys/kern

2019-01-12 Thread Cy Schubert
In message 
, Warner Losh writes:
> --656f96057f487d65
> Content-Type: text/plain; charset="UTF-8"
>
> On Sat, Jan 12, 2019 at 1:14 PM Cy Schubert 
> wrote:
>
> > In message <201901121121.x0cblsiv058...@repo.freebsd.org>, Andrew
> > Turner writes
> > :
> > > Author: andrew
> > > Date: Sat Jan 12 11:21:28 2019
> > > New Revision: 342962
> > > URL: https://svnweb.freebsd.org/changeset/base/342962
> > >
> > > Log:
> > >   Add support for the Clang Coverage Sanitizer in the kernel (KCOV).
> > >
> > >   When building with KCOV enabled the compiler will insert function calls
> > >   to probes allowing us to trace the execution of the kernel from
> > userspace.
> > >   These probes are on function entry (trace-pc) and on comparison
> > operations
> > >   (trace-cmp).
> > >
> > >   Userspace can enable the use of these probes on a single kernel thread
> > with
> > >   an ioctl interface. It can allocate space for the probe with
> > KIOSETBUFSIZE,
> > >   then mmap the allocated buffer and enable tracing with KIOENABLE, with
> > the
> > >   trace mode being passed in as the int argument. When complete
> > KIODISABLE
> > >   is used to disable tracing.
> > >
> > >   The first item in the buffer is the number of trace event that have
> > >   happened. Userspace can write 0 to this to reset the tracing, and is
> > >   expected to do so on first use.
> > >
> > >   The format of the buffer depends on the trace mode. When in PC tracing
> > just
> > >   the return address of the probe is stored. Under comparison tracing the
> > >   comparison type, the two arguments, and the return address are traced.
> > The
> > >   former method uses on entry per trace event, while the later uses 4. As
> > >   such they are incompatible so only a single mode may be enabled.
> > >
> > >   KCOV is expected to help fuzzing the kernel, and while in development
> > has
> > >   already found a number of issues. It is required for the syzkaller
> > system
> > >   call fuzzer [1]. Other kernel fuzzers could also make use of it, either
> > >   with the current interface, or by extending it with new modes.
> > >
> > >   A man page is currently being worked on and is expected to be committed
> > >   soon, however having the code in the kernel now is useful for other
> > >   developers to use.
> > >
> > >   [1] https://github.com/google/syzkaller
> > >
> > >   Submitted by:   Mitchell Horne  (Earlier
> > version)
> > >   Reviewed by:kib
> > >   Testing by: tuexen
> > >   Sponsored by:   DARPA, AFRL
> > >   Sponsored by:   The FreeBSD Foundation (Mitchell Horne)
> > >   Differential Revision:  https://reviews.freebsd.org/D14599
> > >
> > > Added:
> > >   head/sys/kern/kern_kcov.c   (contents, props changed)
> > >   head/sys/sys/kcov.h   (contents, props changed)
> > >   head/tests/sys/kern/kcov.c   (contents, props changed)
> > > Modified:
> > >   head/sys/amd64/conf/GENERIC
> > >   head/sys/arm64/conf/GENERIC
> > >   head/sys/conf/files
> > >   head/sys/conf/kern.pre.mk
> > >   head/sys/conf/options
> > >   head/sys/kern/kern_thread.c
> > >   head/sys/sys/proc.h
> > >   head/tests/sys/kern/Makefile
> > >
> > [...]
> > > Modified: head/sys/sys/proc.h
> > >
> > ===
> ==
> > > =
> > > --- head/sys/sys/proc.h   Sat Jan 12 11:14:59 2019(r342961)
> > > +++ head/sys/sys/proc.h   Sat Jan 12 11:21:28 2019(r342962)
> > > @@ -175,6 +175,7 @@ struct filecaps;
> > >  struct filemon;
> > >  struct kaioinfo;
> > >  struct kaudit_record;
> > > +struct kcov_info;
> > >  struct kdtrace_proc;
> > >  struct kdtrace_thread;
> > >  struct mqueue_notifier;
> > > @@ -300,6 +301,7 @@ struct thread {
> > >   sbintime_t  td_sleeptimo;   /* (t) Sleep timeout. */
> > >   int td_rtcgen;  /* (s) rtc_generation of abs.
> > sleep */
> > >   size_t  td_vslock_sz;   /* (k) amount of vslock-ed space */
> > > + struct kcov_info *td_kcov_info; /* (*) Kernel code coverage data */
> > >  #define  td_endzero td_sigmask
> > >
> > >  /* Copied during fork1() or create_thread(). */
> > >
> >
> > This breaks 32-bit builds (see jenkins email to recent committers from
> > this morning).
> >
> > Inserting this here and calculating offsets for 64-bit platforms
> > without taking into consideration 32-bit is the reason why. Maybe we
> > should consider deorbit of 32-bit platforms sooner than later.
> >
>
> I have the missing mips 64-bit stuff for mips32. i386 already has the
> 64-bit ops, I believe. Arm has them. Just powerpc 32-bit will be left w/o
> them.

The problem here is the KASSERTs in kern_thead.c assert due to the 
32-bit offsets whereby 64-bit builds ok. Check the latest jenkins error 
email for i386.


-- 
Cheers,
Cy Schubert 
FreeBSD UNIX: Web:  http://www.FreeBSD.org

The need of the many outweighs the greed of the few.


___
svn-src-head@freebsd.org 

Re: svn commit: r342973 - head/sys/kern

2019-01-12 Thread Cy Schubert
In message <201901122041.x0ckfvui057...@repo.freebsd.org>, Andrew 
Turner writes
:
> Author: andrew
> Date: Sat Jan 12 20:41:57 2019
> New Revision: 342973
> URL: https://svnweb.freebsd.org/changeset/base/342973
>
> Log:
>   Fix the check for the offset of td_frame and td_emuldata in struct thread.
>   
>   Pointy hat: andrew
>   Sponsored by:   DARPA, AFRL
>
> Modified:
>   head/sys/kern/kern_thread.c
>
> Modified: head/sys/kern/kern_thread.c
> =
> =
> --- head/sys/kern/kern_thread.c   Sat Jan 12 17:56:23 2019(r34297
> 2)
> +++ head/sys/kern/kern_thread.c   Sat Jan 12 20:41:57 2019(r34297
> 3)
> @@ -102,9 +102,9 @@ _Static_assert(offsetof(struct thread, td_flags) == 0x
>  "struct thread KBI td_flags");
>  _Static_assert(offsetof(struct thread, td_pflags) == 0xa0,
>  "struct thread KBI td_pflags");
> -_Static_assert(offsetof(struct thread, td_frame) == 0x2e8,
> +_Static_assert(offsetof(struct thread, td_frame) == 0x2ec,
>  "struct thread KBI td_frame");
> -_Static_assert(offsetof(struct thread, td_emuldata) == 0x334,
> +_Static_assert(offsetof(struct thread, td_emuldata) == 0x338,
>  "struct thread KBI td_emuldata");
>  _Static_assert(offsetof(struct proc, p_flag) == 0x68,
>  "struct proc KBI p_flag");
>

Thank you Andrew.


-- 
Cheers,
Cy Schubert 
FreeBSD UNIX: Web:  http://www.FreeBSD.org

The need of the many outweighs the greed of the few.


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


Re: svn commit: r342962 - in head: sys/amd64/conf sys/arm64/conf sys/conf sys/kern sys/sys tests/sys/kern

2019-01-12 Thread Cy Schubert
In message <201901121121.x0cblsiv058...@repo.freebsd.org>, Andrew 
Turner writes
:
> Author: andrew
> Date: Sat Jan 12 11:21:28 2019
> New Revision: 342962
> URL: https://svnweb.freebsd.org/changeset/base/342962
>
> Log:
>   Add support for the Clang Coverage Sanitizer in the kernel (KCOV).
>   
>   When building with KCOV enabled the compiler will insert function calls
>   to probes allowing us to trace the execution of the kernel from userspace.
>   These probes are on function entry (trace-pc) and on comparison operations
>   (trace-cmp).
>   
>   Userspace can enable the use of these probes on a single kernel thread with
>   an ioctl interface. It can allocate space for the probe with KIOSETBUFSIZE,
>   then mmap the allocated buffer and enable tracing with KIOENABLE, with the
>   trace mode being passed in as the int argument. When complete KIODISABLE
>   is used to disable tracing.
>   
>   The first item in the buffer is the number of trace event that have
>   happened. Userspace can write 0 to this to reset the tracing, and is
>   expected to do so on first use.
>   
>   The format of the buffer depends on the trace mode. When in PC tracing just
>   the return address of the probe is stored. Under comparison tracing the
>   comparison type, the two arguments, and the return address are traced. The
>   former method uses on entry per trace event, while the later uses 4. As
>   such they are incompatible so only a single mode may be enabled.
>   
>   KCOV is expected to help fuzzing the kernel, and while in development has
>   already found a number of issues. It is required for the syzkaller system
>   call fuzzer [1]. Other kernel fuzzers could also make use of it, either
>   with the current interface, or by extending it with new modes.
>   
>   A man page is currently being worked on and is expected to be committed
>   soon, however having the code in the kernel now is useful for other
>   developers to use.
>   
>   [1] https://github.com/google/syzkaller
>   
>   Submitted by:   Mitchell Horne  (Earlier version)
>   Reviewed by:kib
>   Testing by: tuexen
>   Sponsored by:   DARPA, AFRL
>   Sponsored by:   The FreeBSD Foundation (Mitchell Horne)
>   Differential Revision:  https://reviews.freebsd.org/D14599
>
> Added:
>   head/sys/kern/kern_kcov.c   (contents, props changed)
>   head/sys/sys/kcov.h   (contents, props changed)
>   head/tests/sys/kern/kcov.c   (contents, props changed)
> Modified:
>   head/sys/amd64/conf/GENERIC
>   head/sys/arm64/conf/GENERIC
>   head/sys/conf/files
>   head/sys/conf/kern.pre.mk
>   head/sys/conf/options
>   head/sys/kern/kern_thread.c
>   head/sys/sys/proc.h
>   head/tests/sys/kern/Makefile
>
[...]
> Modified: head/sys/sys/proc.h
> =
> =
> --- head/sys/sys/proc.h   Sat Jan 12 11:14:59 2019(r342961)
> +++ head/sys/sys/proc.h   Sat Jan 12 11:21:28 2019(r342962)
> @@ -175,6 +175,7 @@ struct filecaps;
>  struct filemon;
>  struct kaioinfo;
>  struct kaudit_record;
> +struct kcov_info;
>  struct kdtrace_proc;
>  struct kdtrace_thread;
>  struct mqueue_notifier;
> @@ -300,6 +301,7 @@ struct thread {
>   sbintime_t  td_sleeptimo;   /* (t) Sleep timeout. */
>   int td_rtcgen;  /* (s) rtc_generation of abs. sleep */
>   size_t  td_vslock_sz;   /* (k) amount of vslock-ed space */
> + struct kcov_info *td_kcov_info; /* (*) Kernel code coverage data */
>  #define  td_endzero td_sigmask
>  
>  /* Copied during fork1() or create_thread(). */
>

This breaks 32-bit builds (see jenkins email to recent committers from 
this morning).

Inserting this here and calculating offsets for 64-bit platforms 
without taking into consideration 32-bit is the reason why. Maybe we 
should consider deorbit of 32-bit platforms sooner than later.


-- 
Cheers,
Cy Schubert 
FreeBSD UNIX: Web:  http://www.FreeBSD.org

The need of the many outweighs the greed of the few.



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


svn commit: r342973 - head/sys/kern

2019-01-12 Thread Andrew Turner
Author: andrew
Date: Sat Jan 12 20:41:57 2019
New Revision: 342973
URL: https://svnweb.freebsd.org/changeset/base/342973

Log:
  Fix the check for the offset of td_frame and td_emuldata in struct thread.
  
  Pointy hat:   andrew
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/kern/kern_thread.c

Modified: head/sys/kern/kern_thread.c
==
--- head/sys/kern/kern_thread.c Sat Jan 12 17:56:23 2019(r342972)
+++ head/sys/kern/kern_thread.c Sat Jan 12 20:41:57 2019(r342973)
@@ -102,9 +102,9 @@ _Static_assert(offsetof(struct thread, td_flags) == 0x
 "struct thread KBI td_flags");
 _Static_assert(offsetof(struct thread, td_pflags) == 0xa0,
 "struct thread KBI td_pflags");
-_Static_assert(offsetof(struct thread, td_frame) == 0x2e8,
+_Static_assert(offsetof(struct thread, td_frame) == 0x2ec,
 "struct thread KBI td_frame");
-_Static_assert(offsetof(struct thread, td_emuldata) == 0x334,
+_Static_assert(offsetof(struct thread, td_emuldata) == 0x338,
 "struct thread KBI td_emuldata");
 _Static_assert(offsetof(struct proc, p_flag) == 0x68,
 "struct proc KBI p_flag");
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r342979 - head/sys/compat/freebsd32

2019-01-12 Thread Olivier Houchard
Author: cognet
Date: Sun Jan 13 00:37:31 2019
New Revision: 342979
URL: https://svnweb.freebsd.org/changeset/base/342979

Log:
  amd64 is the only arch that doesn't require padding for 32bits syscalls, so
  instead of listing every arch thar requires it, just exclude amd64.

Modified:
  head/sys/compat/freebsd32/syscalls.master

Modified: head/sys/compat/freebsd32/syscalls.master
==
--- head/sys/compat/freebsd32/syscalls.master   Sun Jan 13 00:19:15 2019
(r342978)
+++ head/sys/compat/freebsd32/syscalls.master   Sun Jan 13 00:37:31 2019
(r342979)
@@ -54,7 +54,7 @@
 #include 
 #include 
 
-#if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__))
+#if !defined(PAD64_REQUIRED) && !defined(__amd64__)
 #define PAD64_REQUIRED
 #endif
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r342980 - head/sys/compat/freebsd32

2019-01-12 Thread Olivier Houchard
Author: cognet
Date: Sun Jan 13 00:38:55 2019
New Revision: 342980
URL: https://svnweb.freebsd.org/changeset/base/342980

Log:
  Regenerate sysent files after having modified syscalls.master.

Modified:
  head/sys/compat/freebsd32/freebsd32_proto.h
  head/sys/compat/freebsd32/freebsd32_syscalls.c
  head/sys/compat/freebsd32/freebsd32_sysent.c
  head/sys/compat/freebsd32/freebsd32_systrace_args.c

Modified: head/sys/compat/freebsd32/freebsd32_proto.h
==
--- head/sys/compat/freebsd32/freebsd32_proto.h Sun Jan 13 00:37:31 2019
(r342979)
+++ head/sys/compat/freebsd32/freebsd32_proto.h Sun Jan 13 00:38:55 2019
(r342980)
@@ -34,7 +34,7 @@ struct thread;
 #definePADR_(t)0
 #endif
 
-#if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__))
+#if !defined(PAD64_REQUIRED) && !defined(__amd64__)
 #define PAD64_REQUIRED
 #endif
 struct freebsd32_wait4_args {
@@ -167,7 +167,7 @@ struct freebsd32___sysctl_args {
char namelen_l_[PADL_(u_int)]; u_int namelen; char 
namelen_r_[PADR_(u_int)];
char old_l_[PADL_(void *)]; void * old; char old_r_[PADR_(void *)];
char oldlenp_l_[PADL_(uint32_t *)]; uint32_t * oldlenp; char 
oldlenp_r_[PADR_(uint32_t *)];
-   char new_l_[PADL_(void *)]; void * new; char new_r_[PADR_(void *)];
+   char new_l_[PADL_(const void *)]; const void * new; char 
new_r_[PADR_(const void *)];
char newlen_l_[PADL_(uint32_t)]; uint32_t newlen; char 
newlen_r_[PADR_(uint32_t)];
 };
 struct freebsd32_futimes_args {
@@ -728,7 +728,7 @@ struct freebsd32_cpuset_setdomain_args {
char mask_l_[PADL_(domainset_t *)]; domainset_t * mask; char 
mask_r_[PADR_(domainset_t *)];
char policy_l_[PADL_(int)]; int policy; char policy_r_[PADR_(int)];
 };
-#if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__))
+#if !defined(PAD64_REQUIRED) && !defined(__amd64__)
 #define PAD64_REQUIRED
 #endif
 intfreebsd32_wait4(struct thread *, struct freebsd32_wait4_args *);
@@ -868,7 +868,7 @@ int freebsd32_cpuset_setdomain(struct thread *, struct
 
 #ifdef COMPAT_43
 
-#if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__))
+#if !defined(PAD64_REQUIRED) && !defined(__amd64__)
 #define PAD64_REQUIRED
 #endif
 struct ofreebsd32_lseek_args {
@@ -963,7 +963,7 @@ int ofreebsd32_getdirentries(struct thread *, struct o
 
 #ifdef COMPAT_FREEBSD4
 
-#if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__))
+#if !defined(PAD64_REQUIRED) && !defined(__amd64__)
 #define PAD64_REQUIRED
 #endif
 struct freebsd4_freebsd32_getfsstat_args {
@@ -1029,7 +1029,7 @@ int   freebsd4_freebsd32_sigreturn(struct thread *, 
stru
 
 #ifdef COMPAT_FREEBSD6
 
-#if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__))
+#if !defined(PAD64_REQUIRED) && !defined(__amd64__)
 #define PAD64_REQUIRED
 #endif
 struct freebsd6_freebsd32_pread_args {
@@ -1119,7 +1119,7 @@ int   freebsd6_freebsd32_lio_listio(struct thread *, 
str
 
 #ifdef COMPAT_FREEBSD7
 
-#if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__))
+#if !defined(PAD64_REQUIRED) && !defined(__amd64__)
 #define PAD64_REQUIRED
 #endif
 struct freebsd7_freebsd32_semctl_args {
@@ -1162,7 +1162,7 @@ int   freebsd7_freebsd32_shmctl(struct thread *, 
struct 
 
 #ifdef COMPAT_FREEBSD10
 
-#if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__))
+#if !defined(PAD64_REQUIRED) && !defined(__amd64__)
 #define PAD64_REQUIRED
 #endif
 #ifdef PAD64_REQUIRED
@@ -1187,7 +1187,7 @@ int   freebsd10_freebsd32_pipe(struct thread *, 
struct f
 
 #ifdef COMPAT_FREEBSD11
 
-#if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__))
+#if !defined(PAD64_REQUIRED) && !defined(__amd64__)
 #define PAD64_REQUIRED
 #endif
 struct freebsd11_freebsd32_stat_args {

Modified: head/sys/compat/freebsd32/freebsd32_syscalls.c
==
--- head/sys/compat/freebsd32/freebsd32_syscalls.c  Sun Jan 13 00:37:31 
2019(r342979)
+++ head/sys/compat/freebsd32/freebsd32_syscalls.c  Sun Jan 13 00:38:55 
2019(r342980)
@@ -6,7 +6,7 @@
  */
 
 const char *freebsd32_syscallnames[] = {
-#if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__))
+#if !defined(PAD64_REQUIRED) && !defined(__amd64__)
 #define PAD64_REQUIRED
 #endif
"syscall",  /* 0 = syscall */

Modified: head/sys/compat/freebsd32/freebsd32_sysent.c
==
--- head/sys/compat/freebsd32/freebsd32_sysent.cSun Jan 13 00:37:31 
2019(r342979)
+++ head/sys/compat/freebsd32/freebsd32_sysent.cSun Jan 13 00:38:55 
2019(r342980)
@@ -53,7 +53,7 @@
 
 /* The casts are bogus but will do for now. */
 struct sysent freebsd32_sysent[] = {
-#if 

Re: svn commit: r342962 - in head: sys/amd64/conf sys/arm64/conf sys/conf sys/kern sys/sys tests/sys/kern

2019-01-12 Thread Warner Losh
On Sat, Jan 12, 2019 at 1:14 PM Cy Schubert 
wrote:

> In message <201901121121.x0cblsiv058...@repo.freebsd.org>, Andrew
> Turner writes
> :
> > Author: andrew
> > Date: Sat Jan 12 11:21:28 2019
> > New Revision: 342962
> > URL: https://svnweb.freebsd.org/changeset/base/342962
> >
> > Log:
> >   Add support for the Clang Coverage Sanitizer in the kernel (KCOV).
> >
> >   When building with KCOV enabled the compiler will insert function calls
> >   to probes allowing us to trace the execution of the kernel from
> userspace.
> >   These probes are on function entry (trace-pc) and on comparison
> operations
> >   (trace-cmp).
> >
> >   Userspace can enable the use of these probes on a single kernel thread
> with
> >   an ioctl interface. It can allocate space for the probe with
> KIOSETBUFSIZE,
> >   then mmap the allocated buffer and enable tracing with KIOENABLE, with
> the
> >   trace mode being passed in as the int argument. When complete
> KIODISABLE
> >   is used to disable tracing.
> >
> >   The first item in the buffer is the number of trace event that have
> >   happened. Userspace can write 0 to this to reset the tracing, and is
> >   expected to do so on first use.
> >
> >   The format of the buffer depends on the trace mode. When in PC tracing
> just
> >   the return address of the probe is stored. Under comparison tracing the
> >   comparison type, the two arguments, and the return address are traced.
> The
> >   former method uses on entry per trace event, while the later uses 4. As
> >   such they are incompatible so only a single mode may be enabled.
> >
> >   KCOV is expected to help fuzzing the kernel, and while in development
> has
> >   already found a number of issues. It is required for the syzkaller
> system
> >   call fuzzer [1]. Other kernel fuzzers could also make use of it, either
> >   with the current interface, or by extending it with new modes.
> >
> >   A man page is currently being worked on and is expected to be committed
> >   soon, however having the code in the kernel now is useful for other
> >   developers to use.
> >
> >   [1] https://github.com/google/syzkaller
> >
> >   Submitted by:   Mitchell Horne  (Earlier
> version)
> >   Reviewed by:kib
> >   Testing by: tuexen
> >   Sponsored by:   DARPA, AFRL
> >   Sponsored by:   The FreeBSD Foundation (Mitchell Horne)
> >   Differential Revision:  https://reviews.freebsd.org/D14599
> >
> > Added:
> >   head/sys/kern/kern_kcov.c   (contents, props changed)
> >   head/sys/sys/kcov.h   (contents, props changed)
> >   head/tests/sys/kern/kcov.c   (contents, props changed)
> > Modified:
> >   head/sys/amd64/conf/GENERIC
> >   head/sys/arm64/conf/GENERIC
> >   head/sys/conf/files
> >   head/sys/conf/kern.pre.mk
> >   head/sys/conf/options
> >   head/sys/kern/kern_thread.c
> >   head/sys/sys/proc.h
> >   head/tests/sys/kern/Makefile
> >
> [...]
> > Modified: head/sys/sys/proc.h
> >
> =
> > =
> > --- head/sys/sys/proc.h   Sat Jan 12 11:14:59 2019(r342961)
> > +++ head/sys/sys/proc.h   Sat Jan 12 11:21:28 2019(r342962)
> > @@ -175,6 +175,7 @@ struct filecaps;
> >  struct filemon;
> >  struct kaioinfo;
> >  struct kaudit_record;
> > +struct kcov_info;
> >  struct kdtrace_proc;
> >  struct kdtrace_thread;
> >  struct mqueue_notifier;
> > @@ -300,6 +301,7 @@ struct thread {
> >   sbintime_t  td_sleeptimo;   /* (t) Sleep timeout. */
> >   int td_rtcgen;  /* (s) rtc_generation of abs.
> sleep */
> >   size_t  td_vslock_sz;   /* (k) amount of vslock-ed space */
> > + struct kcov_info *td_kcov_info; /* (*) Kernel code coverage data */
> >  #define  td_endzero td_sigmask
> >
> >  /* Copied during fork1() or create_thread(). */
> >
>
> This breaks 32-bit builds (see jenkins email to recent committers from
> this morning).
>
> Inserting this here and calculating offsets for 64-bit platforms
> without taking into consideration 32-bit is the reason why. Maybe we
> should consider deorbit of 32-bit platforms sooner than later.
>

I have the missing mips 64-bit stuff for mips32. i386 already has the
64-bit ops, I believe. Arm has them. Just powerpc 32-bit will be left w/o
them.

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


Re: svn commit: r342963 - head/tests/sys/kern

2019-01-12 Thread Rodney W. Grimes
[ Charset UTF-8 unsupported, converting... ]
> On Sat, Jan 12, 2019 at 12:10 PM Enji Cooper  wrote:
> 
> >
> >
> > > On Jan 12, 2019, at 3:50 AM, Andrew Turner  wrote:
> > >
> > > Author: andrew
> > > Date: Sat Jan 12 11:50:39 2019
> > > New Revision: 342963
> > > URL: https://svnweb.freebsd.org/changeset/base/342963
> > >
> > > Log:
> > >  Temporarily disable the kcov tests. Not all architectures have
> > >  atomic_store_64 and atomic_store_64.
> > >
> > >  Sponsored by:DARPA, AFRL
> >
> > Hi Andrew,
> > Would it make more sense to conditionally enable the tests on some
> > architectures instead of disabling it on all architectures?
> >
> 
> No. Let's stop doing that. Either the architectures provide the 64-bit
> stuff, or they will remain broken and removed.

That makes a counter incentive for people to just break 32 bit archs
with no reason to bother fixing them.  This is a bad idea.


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


svn commit: r342974 - in head: gnu/lib/csu lib/csu/powerpc lib/csu/powerpc64

2019-01-12 Thread Justin Hibbits
Author: jhibbits
Date: Sat Jan 12 21:29:54 2019
New Revision: 342974
URL: https://svnweb.freebsd.org/changeset/base/342974

Log:
  Create crtsavres.o for powerpc builds
  
  Summary:
  GCC expects to link in a crtsavres.o on powerpc platforms.  On
  powerpc64 this is an empty file, but on powerpc and powerpcspe this does 
contain
  some save/restore functions, which may not actually be necessary for newer
  modern GCC and clang.  This appeases the in-tree gcc, though, and is needed in
  order to switch to the BSD CRTRBEGIN.
  
  PR:   233751
  Reviewed By: andrew
  Differential Revision: https://reviews.freebsd.org/D18826

Added:
  head/lib/csu/powerpc/crtsavres.S   (contents, props changed)
Modified:
  head/gnu/lib/csu/Makefile
  head/lib/csu/powerpc/Makefile
  head/lib/csu/powerpc64/Makefile

Modified: head/gnu/lib/csu/Makefile
==
--- head/gnu/lib/csu/Makefile   Sat Jan 12 20:41:57 2019(r342973)
+++ head/gnu/lib/csu/Makefile   Sat Jan 12 21:29:54 2019(r342974)
@@ -28,10 +28,6 @@ CRTS_CFLAGS= -DCRTSTUFFS_O -DSHARED ${PICFLAG}
 CFLAGS+=   -DTARGET_ARM_EABI
 .endif
 
-.if ${MACHINE_CPUARCH} == "powerpc"
-TGTOBJS=   crtsavres.o
-SRCS+= crtsavres.asm
-.endif
 .if ${MACHINE_CPUARCH} == "sparc64"
 TGTOBJS=   crtfastmath.o
 SRCS+= crtfastmath.c

Modified: head/lib/csu/powerpc/Makefile
==
--- head/lib/csu/powerpc/Makefile   Sat Jan 12 20:41:57 2019
(r342973)
+++ head/lib/csu/powerpc/Makefile   Sat Jan 12 21:29:54 2019
(r342974)
@@ -2,7 +2,7 @@
 
 .PATH: ${.CURDIR:H}/common
 
-SRCS=  crt1.c crti.S crtn.S
+SRCS=  crt1.c crti.S crtn.S crtsavres.S
 OBJS=  ${SRCS:N*.h:R:S/$/.o/g}
 OBJS+= Scrt1.o gcrt1.o
 CFLAGS+=   -I${.CURDIR:H}/common \

Added: head/lib/csu/powerpc/crtsavres.S
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/csu/powerpc/crtsavres.SSat Jan 12 21:29:54 2019
(r342974)
@@ -0,0 +1,191 @@
+/*-
+ * SPDX-License-Identifier: BSD-1-Clause
+ *
+ * Copyright 2019 Justin Hibbits
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+.text
+
+/*
+ * The PowerPC ABI spec requires the following save/restore functions to be
+ * provided:
+ *
+ * _savefpr_N
+ * _restfpr_N
+ * _restfpr_N_x
+ * _savegpr_N
+ * _restgpr_N
+ * _restgpr_N_x
+ * 
+ * With N ranging from 14 to 31, to save the nonvolatile registers.
+ */
+
+#define _CRTENTRY(name) \
+   .text; \
+   .globl  name; \
+   .type   name,@function; \
+   name:
+
+#define SAVEFPR(r) _CRTENTRY(__CONCAT(_savefpr_,r))\
+   stfdr,(-256 + r * 8)(11)
+
+SAVEFPR(14)
+SAVEFPR(15)
+SAVEFPR(16)
+SAVEFPR(17)
+SAVEFPR(18)
+SAVEFPR(19)
+SAVEFPR(20)
+SAVEFPR(21)
+SAVEFPR(22)
+SAVEFPR(23)
+SAVEFPR(24)
+SAVEFPR(25)
+SAVEFPR(26)
+SAVEFPR(27)
+SAVEFPR(28)
+SAVEFPR(29)
+SAVEFPR(30)
+SAVEFPR(31)
+   blr
+
+#define RESTFPR(r) _CRTENTRY(__CONCAT(_restfpr_,r))\
+   lfd r,(-256 + r * 8)(11)
+
+RESTFPR(14)
+RESTFPR(15)
+RESTFPR(16)
+RESTFPR(17)
+RESTFPR(18)
+RESTFPR(19)
+RESTFPR(20)
+RESTFPR(21)
+RESTFPR(22)
+RESTFPR(23)
+RESTFPR(24)
+RESTFPR(25)
+RESTFPR(26)
+RESTFPR(27)
+RESTFPR(28)
+RESTFPR(29)
+RESTFPR(30)
+RESTFPR(31)
+   blr
+
+#define SAVEGPR(r) _CRTENTRY(__CONCAT(_savegpr_,r))\
+   stfdr,(-128 + r*4)(11)
+
+SAVEGPR(14)
+SAVEGPR(15)
+SAVEGPR(16)
+SAVEGPR(17)
+SAVEGPR(18)
+SAVEGPR(19)
+SAVEGPR(20)
+SAVEGPR(21)
+SAVEGPR(22)
+SAVEGPR(23)
+SAVEGPR(24)
+SAVEGPR(25)
+SAVEGPR(26)
+SAVEGPR(27)
+SAVEGPR(28)
+SAVEGPR(29)
+SAVEGPR(30)
+SAVEGPR(31)
+   blr
+
+#define RESTGPR(r) _CRTENTRY(__CONCAT(_restgpr_,r))\
+   lwz r,(-128 + r*4)(11)
+
+RESTGPR(14)
+RESTGPR(15)
+RESTGPR(16)
+RESTGPR(17)

svn commit: r342976 - head/sys/powerpc/pseries

2019-01-12 Thread Justin Hibbits
Author: jhibbits
Date: Sat Jan 12 22:10:31 2019
New Revision: 342976
URL: https://svnweb.freebsd.org/changeset/base/342976

Log:
  powerpc/pseries: Cache the IPI vector to avoid the common static lookup
  
  The IPI vector is static, and happens to be the most common interrupt by far
  on some systems.  Rather than searching for the interrupt every time, cache
  the index.
  
  This appears to yield a small performance boost, of about 8% reduction in
  buildworld times, on my POWER9 system, when paired with r342975.

Modified:
  head/sys/powerpc/pseries/xics.c

Modified: head/sys/powerpc/pseries/xics.c
==
--- head/sys/powerpc/pseries/xics.c Sat Jan 12 22:05:42 2019
(r342975)
+++ head/sys/powerpc/pseries/xics.c Sat Jan 12 22:10:31 2019
(r342976)
@@ -126,6 +126,7 @@ struct xicp_softc {
/* XXX: inefficient -- hash table? tree? */
struct xicp_intvec intvecs[256];
int nintvecs;
+   int ipi_vec;
bool xics_emu;
 };
 
@@ -398,15 +399,17 @@ xicp_dispatch(device_t dev, struct trapframe *tf)
else
phyp_hcall(H_IPI, (uint64_t)(PCPU_GET(hwref)),
0xff);
-   }
+   i = sc->ipi_vec;
+   } else {
 
-   /* XXX: super inefficient */
-   for (i = 0; i < sc->nintvecs; i++) {
-   if (sc->intvecs[i].irq == xirr)
-   break;
+   /* XXX: super inefficient */
+   for (i = 0; i < sc->nintvecs; i++) {
+   if (sc->intvecs[i].irq == xirr)
+   break;
+   }
+   KASSERT(i < sc->nintvecs, ("Unmapped XIRR"));
}
 
-   KASSERT(i < sc->nintvecs, ("Unmapped XIRR"));
powerpc_dispatch_intr(sc->intvecs[i].vector, tf);
}
 }
@@ -437,9 +440,11 @@ xicp_enable(device_t dev, u_int irq, u_int vector, voi
intr->cpu = cpu;
mb();
 
-   /* IPIs are also enabled */
-   if (irq == MAX_XICP_IRQS)
+   /* IPIs are also enabled.  Stash off the vector index */
+   if (irq == MAX_XICP_IRQS) {
+   sc->ipi_vec = intr - sc->intvecs;
return;
+   }
 
if (rtas_exists()) {
rtas_call_method(sc->ibm_set_xive, 3, 1, irq, cpu,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r342977 - in head/sys/dev: amdsmn amdtemp

2019-01-12 Thread Conrad Meyer
Author: cem
Date: Sat Jan 12 22:36:33 2019
New Revision: 342977
URL: https://svnweb.freebsd.org/changeset/base/342977

Log:
  amdtemp(4): Add support for Family 15h, Model >=60h
  
  Family 15h is a bit of an oddball.  Early models used the same temperature
  register and spec (mostly[1]) as earlier CPU families.
  
  Model 60h-6Fh and 70-7Fh use something more like Family 17h's Service
  Management Network, communicating with it in a similar fashion.  To support
  them, add support for their version of SMU indirection to amdsmn(4) and use
  it in amdtemp(4) on these models.
  
  While here, clarify some of the deviceid macros in amdtemp(4) that were
  added with arbitrary, incorrect family numbers, and remove ones that were
  not used.  Additionally, clarify intent and condition of heterogenous
  multi-socket system detection.
  
  [1]: 15h adds the "adjust range by -49°C if a certain condition is met,"
  which previous families did not have.
  
  Reported by:  D. C. 
  PR:   234657
  Tested by:D. C. 

Modified:
  head/sys/dev/amdsmn/amdsmn.c
  head/sys/dev/amdtemp/amdtemp.c

Modified: head/sys/dev/amdsmn/amdsmn.c
==
--- head/sys/dev/amdsmn/amdsmn.cSat Jan 12 22:10:31 2019
(r342976)
+++ head/sys/dev/amdsmn/amdsmn.cSat Jan 12 22:36:33 2019
(r342977)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2017 Conrad Meyer 
+ * Copyright (c) 2017-2019 Conrad Meyer 
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -25,7 +25,7 @@
  */
 
 /*
- * Driver for the AMD Family 17h CPU System Management Network.
+ * Driver for the AMD Family 15h and 17h CPU System Management Network.
  */
 
 #include 
@@ -51,24 +51,45 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
-#defineSMN_ADDR_REG0x60
-#defineSMN_DATA_REG0x64
+#defineF15H_SMN_ADDR_REG   0xb8
+#defineF15H_SMN_DATA_REG   0xbc
+#defineF17H_SMN_ADDR_REG   0x60
+#defineF17H_SMN_DATA_REG   0x64
 
+#definePCI_DEVICE_ID_AMD_15H_M60H_ROOT 0x1576
 #definePCI_DEVICE_ID_AMD_17H_ROOT  0x1450
-#definePCI_DEVICE_ID_AMD_17H_ROOT_DF_F30x1463
 #definePCI_DEVICE_ID_AMD_17H_M10H_ROOT 0x15d0
-#definePCI_DEVICE_ID_AMD_17H_M10H_ROOT_DF_F3   0x15eb
 
+struct pciid;
 struct amdsmn_softc {
struct mtx smn_lock;
+   const struct pciid *smn_pciid;
 };
 
-static struct pciid {
+static const struct pciid {
uint16_tamdsmn_vendorid;
uint16_tamdsmn_deviceid;
+   uint8_t amdsmn_addr_reg;
+   uint8_t amdsmn_data_reg;
 } amdsmn_ids[] = {
-   { CPU_VENDOR_AMD, PCI_DEVICE_ID_AMD_17H_ROOT },
-   { CPU_VENDOR_AMD, PCI_DEVICE_ID_AMD_17H_M10H_ROOT },
+   {
+   .amdsmn_vendorid = CPU_VENDOR_AMD,
+   .amdsmn_deviceid = PCI_DEVICE_ID_AMD_15H_M60H_ROOT,
+   .amdsmn_addr_reg = F15H_SMN_ADDR_REG,
+   .amdsmn_data_reg = F15H_SMN_DATA_REG,
+   },
+   {
+   .amdsmn_vendorid = CPU_VENDOR_AMD,
+   .amdsmn_deviceid = PCI_DEVICE_ID_AMD_17H_ROOT,
+   .amdsmn_addr_reg = F17H_SMN_ADDR_REG,
+   .amdsmn_data_reg = F17H_SMN_DATA_REG,
+   },
+   {
+   .amdsmn_vendorid = CPU_VENDOR_AMD,
+   .amdsmn_deviceid = PCI_DEVICE_ID_AMD_17H_M10H_ROOT,
+   .amdsmn_addr_reg = F17H_SMN_ADDR_REG,
+   .amdsmn_data_reg = F17H_SMN_DATA_REG,
+   },
 };
 
 /*
@@ -101,7 +122,7 @@ MODULE_PNP_INFO("U16:vendor;U16:device", pci, amdsmn, 
 nitems(amdsmn_ids));
 
 static bool
-amdsmn_match(device_t parent)
+amdsmn_match(device_t parent, const struct pciid **pciid_out)
 {
uint16_t vendor, device;
size_t i;
@@ -109,10 +130,14 @@ amdsmn_match(device_t parent)
vendor = pci_get_vendor(parent);
device = pci_get_device(parent);
 
-   for (i = 0; i < nitems(amdsmn_ids); i++)
+   for (i = 0; i < nitems(amdsmn_ids); i++) {
if (vendor == amdsmn_ids[i].amdsmn_vendorid &&
-   device == amdsmn_ids[i].amdsmn_deviceid)
+   device == amdsmn_ids[i].amdsmn_deviceid) {
+   if (pciid_out != NULL)
+   *pciid_out = _ids[i];
return (true);
+   }
+   }
return (false);
 }
 
@@ -124,7 +149,7 @@ amdsmn_identify(driver_t *driver, device_t parent)
/* Make sure we're not being doubly invoked. */
if (device_find_child(parent, "amdsmn", -1) != NULL)
return;
-   if (!amdsmn_match(parent))
+   if (!amdsmn_match(parent, NULL))
return;
 
child = device_add_child(parent, "amdsmn", -1);
@@ -136,21 +161,25 @@ static int
 amdsmn_probe(device_t dev)
 {
uint32_t family;
+   char buf[64];
 
if 

svn commit: r342978 - head/sys/kern

2019-01-12 Thread Olivier Houchard
Author: cognet
Date: Sun Jan 13 00:19:15 2019
New Revision: 342978
URL: https://svnweb.freebsd.org/changeset/base/342978

Log:
  Instead of using an incomplete list of platforms that uses 64bits time_t
  in 32bits mode, special case amd64, as i386 is the only arch that still
  uses 32bits time_t.

Modified:
  head/sys/kern/kern_tc.c

Modified: head/sys/kern/kern_tc.c
==
--- head/sys/kern/kern_tc.c Sat Jan 12 22:36:33 2019(r342977)
+++ head/sys/kern/kern_tc.c Sun Jan 13 00:19:15 2019(r342978)
@@ -145,7 +145,8 @@ sysctl_kern_boottime(SYSCTL_HANDLER_ARGS)
 
getboottime();
 
-#ifndef __mips__
+/* i386 is the only arch which uses a 32bits time_t */
+#ifdef __amd64__
 #ifdef SCTL_MASK32
int tv[2];
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r342973 - head/sys/kern

2019-01-12 Thread Conrad Meyer
Maybe bump FreeBSD_version in sys/param.h since these seem to be
asserting KBI and have now been changed.

Best,
Conrad

On Sat, Jan 12, 2019 at 12:42 PM Andrew Turner  wrote:
>
> Author: andrew
> Date: Sat Jan 12 20:41:57 2019
> New Revision: 342973
> URL: https://svnweb.freebsd.org/changeset/base/342973
>
> Log:
>   Fix the check for the offset of td_frame and td_emuldata in struct thread.
>
>   Pointy hat:   andrew
>   Sponsored by: DARPA, AFRL
>
> Modified:
>   head/sys/kern/kern_thread.c
>
> Modified: head/sys/kern/kern_thread.c
> ==
> --- head/sys/kern/kern_thread.c Sat Jan 12 17:56:23 2019(r342972)
> +++ head/sys/kern/kern_thread.c Sat Jan 12 20:41:57 2019(r342973)
> @@ -102,9 +102,9 @@ _Static_assert(offsetof(struct thread, td_flags) == 0x
>  "struct thread KBI td_flags");
>  _Static_assert(offsetof(struct thread, td_pflags) == 0xa0,
>  "struct thread KBI td_pflags");
> -_Static_assert(offsetof(struct thread, td_frame) == 0x2e8,
> +_Static_assert(offsetof(struct thread, td_frame) == 0x2ec,
>  "struct thread KBI td_frame");
> -_Static_assert(offsetof(struct thread, td_emuldata) == 0x334,
> +_Static_assert(offsetof(struct thread, td_emuldata) == 0x338,
>  "struct thread KBI td_emuldata");
>  _Static_assert(offsetof(struct proc, p_flag) == 0x68,
>  "struct proc KBI p_flag");
>
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r342975 - in head/sys/powerpc: include powermac powernv powerpc ps3 pseries

2019-01-12 Thread Justin Hibbits
Author: jhibbits
Date: Sat Jan 12 22:05:42 2019
New Revision: 342975
URL: https://svnweb.freebsd.org/changeset/base/342975

Log:
  powerpc: Add opaque 'private data' to interrupt vectors
  
  The XICS and XIVE need extra data beyond irq and vector.  Rather than
  performing a separate search, it's better for the general interrupt facility
  to hold a private pointer, since the search already must be done anyway at
  that level.

Modified:
  head/sys/powerpc/include/openpicvar.h
  head/sys/powerpc/powermac/cpcht.c
  head/sys/powerpc/powermac/hrowpic.c
  head/sys/powerpc/powernv/opal_pci.c
  head/sys/powerpc/powerpc/intr_machdep.c
  head/sys/powerpc/powerpc/openpic.c
  head/sys/powerpc/powerpc/pic_if.m
  head/sys/powerpc/ps3/ps3pic.c
  head/sys/powerpc/pseries/xics.c

Modified: head/sys/powerpc/include/openpicvar.h
==
--- head/sys/powerpc/include/openpicvar.h   Sat Jan 12 21:29:54 2019
(r342974)
+++ head/sys/powerpc/include/openpicvar.h   Sat Jan 12 22:05:42 2019
(r342975)
@@ -75,14 +75,14 @@ int openpic_common_attach(device_t, uint32_t);
 /*
  * PIC interface.
  */
-void   openpic_bind(device_t dev, u_int irq, cpuset_t cpumask);
+void   openpic_bind(device_t dev, u_int irq, cpuset_t cpumask, void **);
 void   openpic_config(device_t, u_int, enum intr_trigger, enum intr_polarity);
 void   openpic_dispatch(device_t, struct trapframe *);
-void   openpic_enable(device_t, u_int, u_int);
-void   openpic_eoi(device_t, u_int);
+void   openpic_enable(device_t, u_int, u_int, void **);
+void   openpic_eoi(device_t, u_int, void *);
 void   openpic_ipi(device_t, u_int);
-void   openpic_mask(device_t, u_int);
-void   openpic_unmask(device_t, u_int);
+void   openpic_mask(device_t, u_int, void *);
+void   openpic_unmask(device_t, u_int, void *);
 
 intopenpic_suspend(device_t dev);
 intopenpic_resume(device_t dev);

Modified: head/sys/powerpc/powermac/cpcht.c
==
--- head/sys/powerpc/powermac/cpcht.c   Sat Jan 12 21:29:54 2019
(r342974)
+++ head/sys/powerpc/powermac/cpcht.c   Sat Jan 12 22:05:42 2019
(r342975)
@@ -512,9 +512,10 @@ static int openpic_cpcht_probe(device_t);
 static int openpic_cpcht_attach(device_t);
 static voidopenpic_cpcht_config(device_t, u_int irq,
enum intr_trigger trig, enum intr_polarity pol);
-static voidopenpic_cpcht_enable(device_t, u_int irq, u_int vector);
-static voidopenpic_cpcht_unmask(device_t, u_int irq);
-static voidopenpic_cpcht_eoi(device_t, u_int irq);
+static voidopenpic_cpcht_enable(device_t, u_int irq, u_int vector,
+   void **priv);
+static voidopenpic_cpcht_unmask(device_t, u_int irq, void *priv);
+static voidopenpic_cpcht_eoi(device_t, u_int irq, void *priv);
 
 static device_method_t  openpic_cpcht_methods[] = {
/* Device interface */
@@ -649,12 +650,12 @@ openpic_cpcht_config(device_t dev, u_int irq, enum int
 }
 
 static void
-openpic_cpcht_enable(device_t dev, u_int irq, u_int vec)
+openpic_cpcht_enable(device_t dev, u_int irq, u_int vec, void **priv)
 {
struct openpic_cpcht_softc *sc;
uint32_t ht_irq;
 
-   openpic_enable(dev, irq, vec);
+   openpic_enable(dev, irq, vec, priv);
 
sc = device_get_softc(dev);
 
@@ -674,16 +675,16 @@ openpic_cpcht_enable(device_t dev, u_int irq, u_int ve
mtx_unlock_spin(>sc_ht_mtx);
}

-   openpic_cpcht_eoi(dev, irq);
+   openpic_cpcht_eoi(dev, irq, *priv);
 }
 
 static void
-openpic_cpcht_unmask(device_t dev, u_int irq)
+openpic_cpcht_unmask(device_t dev, u_int irq, void *priv)
 {
struct openpic_cpcht_softc *sc;
uint32_t ht_irq;
 
-   openpic_unmask(dev, irq);
+   openpic_unmask(dev, irq, priv);
 
sc = device_get_softc(dev);
 
@@ -703,11 +704,11 @@ openpic_cpcht_unmask(device_t dev, u_int irq)
mtx_unlock_spin(>sc_ht_mtx);
}
 
-   openpic_cpcht_eoi(dev, irq);
+   openpic_cpcht_eoi(dev, irq, priv);
 }
 
 static void
-openpic_cpcht_eoi(device_t dev, u_int irq)
+openpic_cpcht_eoi(device_t dev, u_int irq, void *priv)
 {
struct openpic_cpcht_softc *sc;
uint32_t off, mask;
@@ -737,5 +738,5 @@ openpic_cpcht_eoi(device_t dev, u_int irq)
}
}
 
-   openpic_eoi(dev, irq);
+   openpic_eoi(dev, irq, priv);
 }

Modified: head/sys/powerpc/powermac/hrowpic.c
==
--- head/sys/powerpc/powermac/hrowpic.c Sat Jan 12 21:29:54 2019
(r342974)
+++ head/sys/powerpc/powermac/hrowpic.c Sat Jan 12 22:05:42 2019
(r342975)
@@ -66,11 +66,11 @@ static int  hrowpic_probe(device_t);
 static int hrowpic_attach(device_t);
 
 static voidhrowpic_dispatch(device_t, struct trapframe *);
-static voidhrowpic_enable(device_t, 

svn commit: r342964 - head/usr.bin/bc

2019-01-12 Thread Takahashi Yoshihiro
Author: nyan
Date: Sat Jan 12 12:35:02 2019
New Revision: 342964
URL: https://svnweb.freebsd.org/changeset/base/342964

Log:
  Sync with OpenBSD.
  
  bc.y: Rev 1.50
  - write parse errors to stderr, prompted by Martijn Dekker
  - we're only interactive if stdout en stderr are a tty as well as stdin
  
  PR:   234430
  Obtained from:OpenBSD
  MFC after:1 week

Modified:
  head/usr.bin/bc/bc.y

Modified: head/usr.bin/bc/bc.y
==
--- head/usr.bin/bc/bc.ySat Jan 12 11:50:39 2019(r342963)
+++ head/usr.bin/bc/bc.ySat Jan 12 12:35:02 2019(r342964)
@@ -996,7 +996,7 @@ yyerror(const char *s)
putchar('\\');
putchar(*p);
}
-   fputs("]pc\n", stdout);
+   fputs("]ec\n", stdout);
free(str);
 }
 
@@ -1173,7 +1173,8 @@ main(int argc, char *argv[])
argc -= optind;
argv += optind;
 
-   interactive = isatty(STDIN_FILENO);
+   interactive = isatty(STDIN_FILENO) && isatty(STDOUT_FILENO) &&
+   isatty(STDERR_FILENO);
for (i = 0; i < argc; i++)
sargv[sargc++] = argv[i];
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"