git: bafb68265672 - main - Fix for off-by-one in GPIO driver after r368585. While at it declare the iteration variable outside the for-loop to appease older compilers.

2021-01-13 Thread Hans Petter Selasky
The branch main has been updated by hselasky:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=bafb682656724d06045fa494efb83a4312036f1f

commit bafb682656724d06045fa494efb83a4312036f1f
Author: Hans Petter Selasky 
AuthorDate: 2021-01-12 17:46:09 +
Commit: Hans Petter Selasky 
CommitDate: 2021-01-13 09:06:30 +

Fix for off-by-one in GPIO driver after r368585.
While at it declare the iteration variable outside the for-loop
to appease older compilers.

Sponsored by:   Mellanox Technologies // NVIDIA Networking
---
 sys/dev/gpio/gpioc.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/sys/dev/gpio/gpioc.c b/sys/dev/gpio/gpioc.c
index 727b07a70589..83d55742a3a2 100644
--- a/sys/dev/gpio/gpioc.c
+++ b/sys/dev/gpio/gpioc.c
@@ -567,6 +567,7 @@ gpioc_probe(device_t dev)
 static int
 gpioc_attach(device_t dev)
 {
+   int i;
int err;
struct gpioc_softc *sc;
struct make_dev_args devargs;
@@ -582,7 +583,7 @@ gpioc_attach(device_t dev)
return (err);
sc->sc_pin_intr = malloc(sizeof(struct gpioc_pin_intr) * sc->sc_npins,
M_GPIOC, M_WAITOK | M_ZERO);
-   for (int i = 0; i <= sc->sc_npins; i++) {
+   for (i = 0; i < sc->sc_npins; i++) {
sc->sc_pin_intr[i].pin = malloc(sizeof(struct gpiobus_pin),
M_GPIOC, M_WAITOK | M_ZERO);
sc->sc_pin_intr[i].sc = sc;
@@ -612,11 +613,12 @@ gpioc_detach(device_t dev)
 {
struct gpioc_softc *sc = device_get_softc(dev);
int err;
+   int i;
 
if (sc->sc_ctl_dev)
destroy_dev(sc->sc_ctl_dev);
 
-   for (int i = 0; i <= sc->sc_npins; i++) {
+   for (i = 0; i < sc->sc_npins; i++) {
mtx_destroy(&sc->sc_pin_intr[i].mtx);
free(&sc->sc_pin_intr[i].pin, M_GPIOC);
}
___
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"


git: a339b4223a4f - main - linux: bump the default version from 3.10.0 to 3.17.0

2021-01-13 Thread Edward Tomasz Napierala
The branch main has been updated by trasz:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=a339b4223a4fd7cddbd691302d2eeeddc045415a

commit a339b4223a4fd7cddbd691302d2eeeddc045415a
Author: Edward Tomasz Napierala 
AuthorDate: 2021-01-13 09:59:08 +
Commit: Edward Tomasz Napierala 
CommitDate: 2021-01-13 10:02:16 +

linux: bump the default version from 3.10.0 to 3.17.0

This is required for Qt5, as found in Ubuntu Focal.  The library contains
the minimum kernel version encoded in an ELF note; this makes rtld ignore
it altogether, with a confusing error message.  Without it, things fail
like this:

$ konsole: error while loading shared libraries: libQt5Core.so.5: cannot
open shared object file: No such file or directory

For reference, the Qt kernel version requirements can be found at:
https://github.com/qt/qtbase/blob/dev/src/corelib/global/minimum-linux_p.h

Sponsored by:   The FreeBSD Foundation
Reviewed By:emaste
Differential Revision:  https://reviews.freebsd.org/D28105
---
 sys/compat/linux/linux_mib.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/compat/linux/linux_mib.h b/sys/compat/linux/linux_mib.h
index bef21758acde..0a1baec39826 100644
--- a/sys/compat/linux/linux_mib.h
+++ b/sys/compat/linux/linux_mib.h
@@ -47,7 +47,7 @@ int   linux_get_oss_version(struct thread *td);
 intlinux_kernver(struct thread *td);
 
 #defineLINUX_KVERSION  3
-#defineLINUX_KPATCHLEVEL   10
+#defineLINUX_KPATCHLEVEL   17
 #defineLINUX_KSUBLEVEL 0
 
 #defineLINUX_KERNVER(a,b,c)(((a) << 16) + ((b) << 8) + (c))
___
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"


git: e58c8da0683d - main - Map IPv6 link-local prefix to the link-local ifa.

2021-01-13 Thread Alexander V. Chernikov
The branch main has been updated by melifaro:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=e58c8da0683dcff6ce3432bdfa98f7271140cda3

commit e58c8da0683dcff6ce3432bdfa98f7271140cda3
Author: Alexander V. Chernikov 
AuthorDate: 2021-01-12 23:14:03 +
Commit: Alexander V. Chernikov 
CommitDate: 2021-01-13 10:03:15 +

Map IPv6 link-local prefix to the link-local ifa.

Currently we create link-local route by creating an always-on IPv6 prefix
 in the prefix list. This prefix is not tied to the link-local ifa.

This leads to the following problems:

First, when flushing interface addresses we skip on-link route, leaving
 fe80::/64 prefix on the interface without any IPv6 addresses.
Second, when creating and removing link-local alias we lose fe80::/64 prefix
 from the routing table.

Fix this by attaching link-local prefix to the ifa at the initial creation.

Reviewed by:hrs
MFC after:  2 weeks
Differential revision:  https://reviews.freebsd.org/D28129
---
 sys/netinet6/in6_ifattach.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sys/netinet6/in6_ifattach.c b/sys/netinet6/in6_ifattach.c
index 81cd24823f10..1a07fb13b179 100644
--- a/sys/netinet6/in6_ifattach.c
+++ b/sys/netinet6/in6_ifattach.c
@@ -520,8 +520,11 @@ in6_ifattach_linklocal(struct ifnet *ifp, struct ifnet 
*altifp)
 * valid with referring to the old link-local address.
 */
if ((pr = nd6_prefix_lookup(&pr0)) == NULL) {
-   if ((error = nd6_prelist_add(&pr0, NULL, NULL)) != 0)
+   if ((error = nd6_prelist_add(&pr0, NULL, &pr)) != 0)
return (error);
+   /* Reference prefix */
+   ia->ia6_ndpr = pr;
+   pr->ndpr_addrcnt++;
} else
nd6_prefix_rele(pr);
 
___
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"


git: a6b7689718d2 - main - Remove redundant rtinit() calls from tuntap.

2021-01-13 Thread Alexander V. Chernikov
The branch main has been updated by melifaro:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=a6b7689718d223e5cefc7beb6d8bb317f92ff839

commit a6b7689718d223e5cefc7beb6d8bb317f92ff839
Author: Alexander V. Chernikov 
AuthorDate: 2021-01-11 23:31:37 +
Commit: Alexander V. Chernikov 
CommitDate: 2021-01-13 10:03:15 +

Remove redundant rtinit() calls from tuntap.

Removed code iterates over if_addrhead and tries to remove
 routes for each ifa.
This is exactly the thing that if_purgeaddrs() do, and
 if_purgeaddr() is already called in the end.

Reviewed by:glebius
MFC after:  2 weeks
Differential revision:  https://reviews.freebsd.org/D28106
---
 sys/net/if_tuntap.c | 32 +---
 1 file changed, 1 insertion(+), 31 deletions(-)

diff --git a/sys/net/if_tuntap.c b/sys/net/if_tuntap.c
index 5789fce5407f..0c0a0dd66339 100644
--- a/sys/net/if_tuntap.c
+++ b/sys/net/if_tuntap.c
@@ -123,7 +123,7 @@ struct tuntap_softc {
 #defineTUN_OPEN0x0001
 #defineTUN_INITED  0x0002
 #defineTUN_UNUSED1 0x0008
-#defineTUN_DSTADDR 0x0010
+#defineTUN_UNUSED2 0x0010
 #defineTUN_LMODE   0x0020
 #defineTUN_RWAIT   0x0040
 #defineTUN_ASYNC   0x0080
@@ -1160,19 +1160,8 @@ tundtor(void *data)
 
/* Delete all addresses and routes which reference this interface. */
if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
-   struct ifaddr *ifa;
-
ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
TUN_UNLOCK(tp);
-   CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
-   /* deal w/IPv4 PtP destination; unlocked read */
-   if (!l2tun && ifa->ifa_addr->sa_family == AF_INET) {
-   rtinit(ifa, (int)RTM_DELETE,
-   tp->tun_flags & TUN_DSTADDR ? RTF_HOST : 0);
-   } else {
-   rtinit(ifa, (int)RTM_DELETE, 0);
-   }
-   }
if_purgeaddrs(ifp);
TUN_LOCK(tp);
}
@@ -1197,10 +1186,6 @@ static void
 tuninit(struct ifnet *ifp)
 {
struct tuntap_softc *tp = ifp->if_softc;
-#ifdef INET
-   struct epoch_tracker et;
-   struct ifaddr *ifa;
-#endif
 
TUNDEBUG(ifp, "tuninit\n");
 
@@ -1209,21 +1194,6 @@ tuninit(struct ifnet *ifp)
if ((tp->tun_flags & TUN_L2) == 0) {
ifp->if_flags |= IFF_UP;
getmicrotime(&ifp->if_lastchange);
-#ifdef INET
-   NET_EPOCH_ENTER(et);
-   CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
-   if (ifa->ifa_addr->sa_family == AF_INET) {
-   struct sockaddr_in *si;
-
-   si = (struct sockaddr_in *)ifa->ifa_dstaddr;
-   if (si && si->sin_addr.s_addr) {
-   tp->tun_flags |= TUN_DSTADDR;
-   break;
-   }
-   }
-   }
-   NET_EPOCH_EXIT(et);
-#endif
TUN_UNLOCK(tp);
} else {
ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
___
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"


Re: git: 11d62b6f31ab - main - linuxkpi: add kernel_fpu_begin/kernel_fpu_end

2021-01-13 Thread Emmanuel Vadot
On Tue, 12 Jan 2021 15:16:55 +0200
Konstantin Belousov  wrote:

> On Tue, Jan 12, 2021 at 11:43:00AM +, Emmanuel Vadot wrote:
> > The branch main has been updated by manu:
> > 
> > URL: 
> > https://cgit.FreeBSD.org/src/commit/?id=11d62b6f31ab4e99df6d0c6c23406b57eaa37f41
> > 
> > commit 11d62b6f31ab4e99df6d0c6c23406b57eaa37f41
> > Author: Emmanuel Vadot 
> > AuthorDate: 2021-01-12 11:02:38 +
> > Commit: Emmanuel Vadot 
> > CommitDate: 2021-01-12 11:31:00 +
> > 
> > linuxkpi: add kernel_fpu_begin/kernel_fpu_end
> > 
> > With newer AMD GPUs (>=Navi,Renoir) there is FPU context usage in the
> > amdgpu driver.
> > The `kernel_fpu_begin/end` implementations in drm did not even allow 
> > nested
> > begin-end blocks.
> 
> Does Linux allow more then one thread to execute kernel_fpu_begin ?

 I actually have no idea, adding Greg to cc.

-- 
Emmanuel Vadot 
___
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"


git: ec2700e01532 - main - linux: mute the "unsupported prctl option 23" warnings

2021-01-13 Thread Edward Tomasz Napierala
The branch main has been updated by trasz:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=ec2700e01532c9d1096ac4fd0b57174c2850188b

commit ec2700e01532c9d1096ac4fd0b57174c2850188b
Author: Edward Tomasz Napierala 
AuthorDate: 2021-01-12 14:47:44 +
Commit: Edward Tomasz Napierala 
CommitDate: 2021-01-13 10:31:56 +

linux: mute the "unsupported prctl option 23" warnings

Make the PR_CAPBSET_READ prctl(2) return EINVAL without logging
any warnings; this is way too noisy with Focal.

Sponsored by:   The FreeBSD Foundation
---
 sys/compat/linux/linux_misc.c | 10 ++
 sys/compat/linux/linux_misc.h |  1 +
 2 files changed, 11 insertions(+)

diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
index 0898a361193e..fc846df6689f 100644
--- a/sys/compat/linux/linux_misc.c
+++ b/sys/compat/linux/linux_misc.c
@@ -2041,6 +2041,16 @@ linux_prctl(struct thread *td, struct linux_prctl_args 
*args)
 */
error = EINVAL;
break;
+   case LINUX_PR_CAPBSET_READ:
+#if 0
+   /*
+* This makes too much noise with Ubuntu Focal.
+*/
+   linux_msg(td, "unsupported prctl PR_CAPBSET_READ %d",
+   (int)args->arg2);
+#endif
+   error = EINVAL;
+   break;
case LINUX_PR_SET_NO_NEW_PRIVS:
linux_msg(td, "unsupported prctl PR_SET_NO_NEW_PRIVS");
error = EINVAL;
diff --git a/sys/compat/linux/linux_misc.h b/sys/compat/linux/linux_misc.h
index c3d9b3719dcf..c7e4fa38682c 100644
--- a/sys/compat/linux/linux_misc.h
+++ b/sys/compat/linux/linux_misc.h
@@ -58,6 +58,7 @@
 #defineLINUX_PR_GET_NAME   16  /* Get process name. */
 #defineLINUX_PR_GET_SECCOMP21
 #defineLINUX_PR_SET_SECCOMP22
+#defineLINUX_PR_CAPBSET_READ   23
 #defineLINUX_PR_SET_NO_NEW_PRIVS   38
 #defineLINUX_PR_SET_PTRACER1499557217
 
___
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"


Re: git: bafb68265672 - main - Fix for off-by-one in GPIO driver after r368585. While at it declare the iteration variable outside the for-loop to appease older compilers.

2021-01-13 Thread Michal Meloun




On 13.01.2021 10:07, Hans Petter Selasky wrote:

The branch main has been updated by hselasky:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=bafb682656724d06045fa494efb83a4312036f1f

commit bafb682656724d06045fa494efb83a4312036f1f
Author: Hans Petter Selasky 
AuthorDate: 2021-01-12 17:46:09 +
Commit: Hans Petter Selasky 
CommitDate: 2021-01-13 09:06:30 +

 Fix for off-by-one in GPIO driver after r368585.
 While at it declare the iteration variable outside the for-loop
 to appease older compilers.


Why? All supported compilers are familiar with this variable 
declaration. It is explicitly allowed by style (9) and makes the code 
much more readable, IMHO.


Michal


 Sponsored by:   Mellanox Technologies // NVIDIA Networking
---
  sys/dev/gpio/gpioc.c | 6 --
  1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/sys/dev/gpio/gpioc.c b/sys/dev/gpio/gpioc.c
index 727b07a70589..83d55742a3a2 100644
--- a/sys/dev/gpio/gpioc.c
+++ b/sys/dev/gpio/gpioc.c
@@ -567,6 +567,7 @@ gpioc_probe(device_t dev)
  static int
  gpioc_attach(device_t dev)
  {
+   int i;
int err;
struct gpioc_softc *sc;
struct make_dev_args devargs;
@@ -582,7 +583,7 @@ gpioc_attach(device_t dev)
return (err);
sc->sc_pin_intr = malloc(sizeof(struct gpioc_pin_intr) * sc->sc_npins,
M_GPIOC, M_WAITOK | M_ZERO);
-   for (int i = 0; i <= sc->sc_npins; i++) {
+   for (i = 0; i < sc->sc_npins; i++) {
sc->sc_pin_intr[i].pin = malloc(sizeof(struct gpiobus_pin),
M_GPIOC, M_WAITOK | M_ZERO);
sc->sc_pin_intr[i].sc = sc;
@@ -612,11 +613,12 @@ gpioc_detach(device_t dev)
  {
struct gpioc_softc *sc = device_get_softc(dev);
int err;
+   int i;
  
  	if (sc->sc_ctl_dev)

destroy_dev(sc->sc_ctl_dev);
  
-	for (int i = 0; i <= sc->sc_npins; i++) {

+   for (i = 0; i < sc->sc_npins; i++) {
mtx_destroy(&sc->sc_pin_intr[i].mtx);
free(&sc->sc_pin_intr[i].pin, M_GPIOC);
}


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


Re: git: bafb68265672 - main - Fix for off-by-one in GPIO driver after r368585. While at it declare the iteration variable outside the for-loop to appease older compilers.

2021-01-13 Thread Hans Petter Selasky

On 1/13/21 12:13 PM, Michal Meloun wrote:



On 13.01.2021 10:07, Hans Petter Selasky wrote:

The branch main has been updated by hselasky:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=bafb682656724d06045fa494efb83a4312036f1f 



commit bafb682656724d06045fa494efb83a4312036f1f
Author: Hans Petter Selasky 
AuthorDate: 2021-01-12 17:46:09 +
Commit: Hans Petter Selasky 
CommitDate: 2021-01-13 09:06:30 +

 Fix for off-by-one in GPIO driver after r368585.
 While at it declare the iteration variable outside the for-loop
 to appease older compilers.


Why? All supported compilers are familiar with this variable 
declaration. It is explicitly allowed by style (9) and makes the code 
much more readable, IMHO.




Hi,

Maybe I'm a bit old-fashioned, but it appears declaring variables inside 
for-loops is a C99 thing:


https://stackoverflow.com/questions/1287863/c-for-loop-int-initial-declaration

You are right, I didn't have to change that.

And btw, style(9) was updated:

commit 34a8e7368f3f00d4564b0b980871f73929d6b1ce
Author: Warner Losh 
Date:   Thu Jul 16 14:12:54 2020 +

And I didn't yet install that version :-)

I'll fix.

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


git: f2a7b434b30e - main - Variable declarations are since C99 and r363250 allowed inside for-loops. Partial revert of bafb68265672.

2021-01-13 Thread Hans Petter Selasky
The branch main has been updated by hselasky:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=f2a7b434b30efe341d51c0c0b151614775771ab6

commit f2a7b434b30efe341d51c0c0b151614775771ab6
Author: Hans Petter Selasky 
AuthorDate: 2021-01-13 11:27:04 +
Commit: Hans Petter Selasky 
CommitDate: 2021-01-13 11:30:41 +

Variable declarations are since C99 and r363250 allowed inside for-loops.
Partial revert of bafb68265672.

Suggested by:   mmel@
---
 sys/dev/gpio/gpioc.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/sys/dev/gpio/gpioc.c b/sys/dev/gpio/gpioc.c
index 83d55742a3a2..9e46b32ffcba 100644
--- a/sys/dev/gpio/gpioc.c
+++ b/sys/dev/gpio/gpioc.c
@@ -567,7 +567,6 @@ gpioc_probe(device_t dev)
 static int
 gpioc_attach(device_t dev)
 {
-   int i;
int err;
struct gpioc_softc *sc;
struct make_dev_args devargs;
@@ -583,7 +582,7 @@ gpioc_attach(device_t dev)
return (err);
sc->sc_pin_intr = malloc(sizeof(struct gpioc_pin_intr) * sc->sc_npins,
M_GPIOC, M_WAITOK | M_ZERO);
-   for (i = 0; i < sc->sc_npins; i++) {
+   for (int i = 0; i < sc->sc_npins; i++) {
sc->sc_pin_intr[i].pin = malloc(sizeof(struct gpiobus_pin),
M_GPIOC, M_WAITOK | M_ZERO);
sc->sc_pin_intr[i].sc = sc;
@@ -613,12 +612,11 @@ gpioc_detach(device_t dev)
 {
struct gpioc_softc *sc = device_get_softc(dev);
int err;
-   int i;
 
if (sc->sc_ctl_dev)
destroy_dev(sc->sc_ctl_dev);
 
-   for (i = 0; i < sc->sc_npins; i++) {
+   for (int i = 0; i < sc->sc_npins; i++) {
mtx_destroy(&sc->sc_pin_intr[i].mtx);
free(&sc->sc_pin_intr[i].pin, M_GPIOC);
}
___
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"


Re: git: 11d62b6f31ab - main - linuxkpi: add kernel_fpu_begin/kernel_fpu_end

2021-01-13 Thread myfreeweb


On January 13, 2021 10:08:26 AM UTC, Emmanuel Vadot  
wrote:
>On Tue, 12 Jan 2021 15:16:55 +0200
>Konstantin Belousov  wrote:
>
>> On Tue, Jan 12, 2021 at 11:43:00AM +, Emmanuel Vadot wrote:
>> > The branch main has been updated by manu:
>> > 
>> > URL: 
>> > https://cgit.FreeBSD.org/src/commit/?id=11d62b6f31ab4e99df6d0c6c23406b57eaa37f41
>> > 
>> > commit 11d62b6f31ab4e99df6d0c6c23406b57eaa37f41
>> > Author: Emmanuel Vadot 
>> > AuthorDate: 2021-01-12 11:02:38 +
>> > Commit: Emmanuel Vadot 
>> > CommitDate: 2021-01-12 11:31:00 +
>> > 
>> > linuxkpi: add kernel_fpu_begin/kernel_fpu_end
>> > 
>> > With newer AMD GPUs (>=Navi,Renoir) there is FPU context usage in the
>> > amdgpu driver.
>> > The `kernel_fpu_begin/end` implementations in drm did not even allow 
>> > nested
>> > begin-end blocks.
>> 
>> Does Linux allow more then one thread to execute kernel_fpu_begin ?
>
> I actually have no idea, adding Greg to cc.

Looks like they save the context into the current thread state, so yes? (drm 
doesn't need that)

Also they seem to do something FPU_KERN_NOCTX like (??) because they disable 
preemption inside these blocks.
(Where does our NOCTX actually store the state?)

Apparently the API shouldn't actually support nesting these sections, because 
kernel_fpu_end unconditionally enables preemption. But that nesting would not 
just panic like it did on our old impl. (Indeed in newest linux versions 
there's a WARN on nesting – only a warning though, not a panic!)
And amdgpu relies on that not panicking.

Looks like amdgpu will narrow the FPU sections down now, they are struggling 
with FPU stuff upstream too:
https://www.spinics.net/lists/kernel/msg3793776.html
___
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"


Re: git: f2a7b434b30e - main - Variable declarations are since C99 and r363250 allowed inside for-loops. Partial revert of bafb68265672.

2021-01-13 Thread Michal Meloun




On 13.01.2021 12:31, Hans Petter Selasky wrote:

The branch main has been updated by hselasky:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=f2a7b434b30efe341d51c0c0b151614775771ab6

commit f2a7b434b30efe341d51c0c0b151614775771ab6
Author: Hans Petter Selasky 
AuthorDate: 2021-01-13 11:27:04 +
Commit: Hans Petter Selasky 
CommitDate: 2021-01-13 11:30:41 +

 Variable declarations are since C99 and r363250 allowed inside for-loops.
 Partial revert of bafb68265672.
 
 Suggested by:   mmel@



Thanks for prompt action.
Michal
___
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"


Re: git: facdd1cd2045 - main - cgem: add 64-bit support

2021-01-13 Thread Michal Meloun




On 10.01.2021 21:53, Mitchell Horne wrote:

The branch main has been updated by mhorne:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=facdd1cd20451d7817c72a25e9253b934ca65eb6

commit facdd1cd20451d7817c72a25e9253b934ca65eb6
Author: Thomas Skibo 
AuthorDate: 2021-01-10 20:18:41 +
Commit: Mitchell Horne 
CommitDate: 2021-01-10 20:51:52 +

 cgem: add 64-bit support
 
 Add 64-bit address support to Cadence CGEM Ethernet driver for use in

 other SoCs such as the Zynq UltraScale+ and SiFive HighFive Unleashed.
 
 Reviewed by:philip, 0mp (manpages)

 Differential Revision: https://reviews.freebsd.org/D24304
---
  share/man/man4/Makefile  |   7 +
  share/man/man4/{man4.arm => }/cgem.4 |  14 +-
  share/man/man4/man4.arm/Makefile |   4 +-
  sys/arm/conf/GENERIC |   2 +-
  sys/arm/conf/ZEDBOARD|   2 +-
  sys/arm64/conf/GENERIC   |   1 +
  sys/dev/cadence/if_cgem.c| 341 ---
  sys/dev/cadence/if_cgem_hw.h |  64 ++-
  sys/dts/arm/zynq-7000.dtsi   |  12 +-
  sys/riscv/conf/GENERIC   |   2 +-
  10 files changed, 323 insertions(+), 126 deletions(-)

diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile
index c72caf0199c9..b8e63315cb95 100644
--- a/share/man/man4/Makefile
+++ b/share/man/man4/Makefile
@@ -106,6 +106,7 @@ MAN=aac.4 \
cdceem.4 \
cfi.4 \
cfumass.4 \
+   ${_cgem.4} \
ch.4 \
chromebook_platform.4 \
${_chvgpio.4} \
@@ -903,6 +904,12 @@ _virtio_scsi.4=virtio_scsi.4
  _vtnet.4= vtnet.4
  .endif
  
+.if ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "aarch64" || \

+${MACHINE_CPUARCH} == "riscv"
+_cgem.4=   cgem.4
+MLINKS+=cgem.4 if_cgem.4
+.endif
+
  .if empty(MAN_ARCH)
  __arches= ${MACHINE} ${MACHINE_ARCH} ${MACHINE_CPUARCH}
  .elif ${MAN_ARCH} == "all"
diff --git a/share/man/man4/man4.arm/cgem.4 b/share/man/man4/cgem.4
similarity index 96%
rename from share/man/man4/man4.arm/cgem.4
rename to share/man/man4/cgem.4
index 6de1d7961788..f9f525dc4554 100644
--- a/share/man/man4/man4.arm/cgem.4
+++ b/share/man/man4/cgem.4
@@ -24,7 +24,7 @@
  .\"
  .\" $FreeBSD$
  .\"
-.Dd August 26, 2014
+.Dd January 10, 2021
  .Dt CGEM 4
  .Os
  .Sh NAME
@@ -44,7 +44,8 @@ The
  .Nm
  driver provides support for the Cadence GEM (Gigabit Ethernet MAC).
  The Cadence GEM is used in some SoC (System on a Chip) devices such as
-the Xilinx Zynq-7000 and the Atmel SAMA5D3.
+the Xilinx Zynq-7000, the Xilinx Zynq UltraScale+, and the SiFive
+HiFive Unleashed.
  .Pp
  The
  .Nm
@@ -284,7 +285,7 @@ There are
  variables that count
  packets discarded by the hardware (see below).
  .Pp
-The GEM used in the Zynq-7000 has a bug such that  the receiver can
+The GEM used in the Zynq-7000 has a bug such that the receiver can
  potentially freeze up under a high load.
  The issue is described in sec. 16.7
  "Known Issues" of the Zynq-7000 SoC Technical Reference Manual (Xilinx
@@ -292,7 +293,10 @@ UG585 v1.7).
  The
  .Nm
  driver implements the work-around suggested in the manual.
-If the bug does not exist in other versions of this device, the
-work-around can be disabled by setting the dev.cgem.%d.rxhangwar
+It is believed that the bug does not exist in the Zynq UltraScale+ and
+SiFive SoCs so the work-around is disabled in those instances and enabled
+in all others.
+The work-around can be disabled by setting the
+.Va dev.cgem.%d.rxhangwar
  .Xr sysctl 8
  variable to 0.
diff --git a/share/man/man4/man4.arm/Makefile b/share/man/man4/man4.arm/Makefile
index 21d53f43a7c8..0b3eec427934 100644
--- a/share/man/man4/man4.arm/Makefile
+++ b/share/man/man4/man4.arm/Makefile
@@ -8,7 +8,6 @@ MAN=\
aw_spi.4 \
aw_syscon.4 \
bcm283x_pwm.4 \
-   cgem.4 \
devcfg.4 \
imx6_ahci.4 \
imx6_snvs.4 \
@@ -16,8 +15,7 @@ MAN=  \
mge.4 \
ti_adc.4
  
-MLINKS= cgem.4 if_cgem.4

-MLINKS+= imx_wdog.4 imxwdt.4
+MLINKS= imx_wdog.4 imxwdt.4
  MLINKS+= mge.4 if_mge.4
  
  MANSUBDIR=/arm

diff --git a/sys/arm/conf/GENERIC b/sys/arm/conf/GENERIC
index 0f0522eb9802..3cfe16ccfe54 100644
--- a/sys/arm/conf/GENERIC
+++ b/sys/arm/conf/GENERIC
@@ -228,8 +228,8 @@ device  e6000sw
  devicemiibus
  
  device		awg			# 10/100/1000 integrated EMAC controller

+device cgem# Cadence GEM Gigabit Ethernet device
  devicecpsw# TI Common Platform Ethernet 
Switch (CPSW)
-device cgem# Zynq-7000 gig ethernet device
  devicedwc # 10/100/1000 integrated GMAC 
controller
  deviceemac# 10/100 integrated EMAC 
controller
  deviceffec# Freescale Fast Ethernet 
Controller
diff --git a/sys/arm/conf/ZEDBOARD b/sys/arm/conf/ZEDBOARD
i

Re: git: facdd1cd2045 - main - cgem: add 64-bit support

2021-01-13 Thread Michal Meloun




On 10.01.2021 21:53, Mitchell Horne wrote:

The branch main has been updated by mhorne:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=facdd1cd20451d7817c72a25e9253b934ca65eb6

commit facdd1cd20451d7817c72a25e9253b934ca65eb6
Author: Thomas Skibo 
AuthorDate: 2021-01-10 20:18:41 +
Commit: Mitchell Horne 
CommitDate: 2021-01-10 20:51:52 +

 cgem: add 64-bit support
 
 Add 64-bit address support to Cadence CGEM Ethernet driver for use in

 other SoCs such as the Zynq UltraScale+ and SiFive HighFive Unleashed.
 
 Reviewed by:philip, 0mp (manpages)

 Differential Revision: https://reviews.freebsd.org/D24304
---
  share/man/man4/Makefile  |   7 +
  share/man/man4/{man4.arm => }/cgem.4 |  14 +-
  share/man/man4/man4.arm/Makefile |   4 +-
  sys/arm/conf/GENERIC |   2 +-
  sys/arm/conf/ZEDBOARD|   2 +-
  sys/arm64/conf/GENERIC   |   1 +
  sys/dev/cadence/if_cgem.c| 341 ---
  sys/dev/cadence/if_cgem_hw.h |  64 ++-
  sys/dts/arm/zynq-7000.dtsi   |  12 +-
  sys/riscv/conf/GENERIC   |   2 +-
  10 files changed, 323 insertions(+), 126 deletions(-)

diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile
index c72caf0199c9..b8e63315cb95 100644
--- a/share/man/man4/Makefile
+++ b/share/man/man4/Makefile
@@ -106,6 +106,7 @@ MAN=aac.4 \
cdceem.4 \
cfi.4 \
cfumass.4 \
+   ${_cgem.4} \
ch.4 \
chromebook_platform.4 \
${_chvgpio.4} \
@@ -903,6 +904,12 @@ _virtio_scsi.4=virtio_scsi.4
  _vtnet.4= vtnet.4
  .endif
  
+.if ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "aarch64" || \

+${MACHINE_CPUARCH} == "riscv"
+_cgem.4=   cgem.4
+MLINKS+=cgem.4 if_cgem.4
+.endif
+
  .if empty(MAN_ARCH)
  __arches= ${MACHINE} ${MACHINE_ARCH} ${MACHINE_CPUARCH}
  .elif ${MAN_ARCH} == "all"
diff --git a/share/man/man4/man4.arm/cgem.4 b/share/man/man4/cgem.4
similarity index 96%
rename from share/man/man4/man4.arm/cgem.4
rename to share/man/man4/cgem.4
index 6de1d7961788..f9f525dc4554 100644
--- a/share/man/man4/man4.arm/cgem.4
+++ b/share/man/man4/cgem.4
@@ -24,7 +24,7 @@
  .\"
  .\" $FreeBSD$
  .\"
-.Dd August 26, 2014
+.Dd January 10, 2021
  .Dt CGEM 4
  .Os
  .Sh NAME
@@ -44,7 +44,8 @@ The
  .Nm
  driver provides support for the Cadence GEM (Gigabit Ethernet MAC).
  The Cadence GEM is used in some SoC (System on a Chip) devices such as
-the Xilinx Zynq-7000 and the Atmel SAMA5D3.
+the Xilinx Zynq-7000, the Xilinx Zynq UltraScale+, and the SiFive
+HiFive Unleashed.
  .Pp
  The
  .Nm
@@ -284,7 +285,7 @@ There are
  variables that count
  packets discarded by the hardware (see below).
  .Pp
-The GEM used in the Zynq-7000 has a bug such that  the receiver can
+The GEM used in the Zynq-7000 has a bug such that the receiver can
  potentially freeze up under a high load.
  The issue is described in sec. 16.7
  "Known Issues" of the Zynq-7000 SoC Technical Reference Manual (Xilinx
@@ -292,7 +293,10 @@ UG585 v1.7).
  The
  .Nm
  driver implements the work-around suggested in the manual.
-If the bug does not exist in other versions of this device, the
-work-around can be disabled by setting the dev.cgem.%d.rxhangwar
+It is believed that the bug does not exist in the Zynq UltraScale+ and
+SiFive SoCs so the work-around is disabled in those instances and enabled
+in all others.
+The work-around can be disabled by setting the
+.Va dev.cgem.%d.rxhangwar
  .Xr sysctl 8
  variable to 0.
diff --git a/share/man/man4/man4.arm/Makefile b/share/man/man4/man4.arm/Makefile
index 21d53f43a7c8..0b3eec427934 100644
--- a/share/man/man4/man4.arm/Makefile
+++ b/share/man/man4/man4.arm/Makefile
@@ -8,7 +8,6 @@ MAN=\
aw_spi.4 \
aw_syscon.4 \
bcm283x_pwm.4 \
-   cgem.4 \
devcfg.4 \
imx6_ahci.4 \
imx6_snvs.4 \
@@ -16,8 +15,7 @@ MAN=  \
mge.4 \
ti_adc.4
  
-MLINKS= cgem.4 if_cgem.4

-MLINKS+= imx_wdog.4 imxwdt.4
+MLINKS= imx_wdog.4 imxwdt.4
  MLINKS+= mge.4 if_mge.4
  
  MANSUBDIR=/arm

diff --git a/sys/arm/conf/GENERIC b/sys/arm/conf/GENERIC
index 0f0522eb9802..3cfe16ccfe54 100644
--- a/sys/arm/conf/GENERIC
+++ b/sys/arm/conf/GENERIC
@@ -228,8 +228,8 @@ device  e6000sw
  devicemiibus
  
  device		awg			# 10/100/1000 integrated EMAC controller

+device cgem# Cadence GEM Gigabit Ethernet device
  devicecpsw# TI Common Platform Ethernet 
Switch (CPSW)
-device cgem# Zynq-7000 gig ethernet device
  devicedwc # 10/100/1000 integrated GMAC 
controller
  deviceemac# 10/100 integrated EMAC 
controller
  deviceffec# Freescale Fast Ethernet 
Controller
diff --git a/sys/arm/conf/ZEDBOARD b/sys/arm/conf/ZEDBOARD
i

git: 8f54940f019c - main - x86 busdma_bounce: do not make assumptions about alignment of malloc(9) results.

2021-01-13 Thread Konstantin Belousov
The branch main has been updated by kib:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=8f54940f019ca586bcfbf189ef9974eeb0a8194a

commit 8f54940f019ca586bcfbf189ef9974eeb0a8194a
Author: Konstantin Belousov 
AuthorDate: 2021-01-11 23:42:30 +
Commit: Konstantin Belousov 
CommitDate: 2021-01-13 15:00:49 +

x86 busdma_bounce: do not make assumptions about alignment of malloc(9) 
results.

Reported by:dim
Reviewed by:dim, jah
Tested by:  dim, pho
MFC after:  2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D28108
---
 sys/x86/x86/busdma_bounce.c | 19 +++
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/sys/x86/x86/busdma_bounce.c b/sys/x86/x86/busdma_bounce.c
index 65fbbb7ec1a4..fec6e2144a22 100644
--- a/sys/x86/x86/busdma_bounce.c
+++ b/sys/x86/x86/busdma_bounce.c
@@ -403,6 +403,8 @@ static int
 bounce_bus_dmamem_alloc(bus_dma_tag_t dmat, void **vaddr, int flags,
 bus_dmamap_t *mapp)
 {
+   uintptr_t ma;
+   size_t malloc_sz;
vm_memattr_t attr;
int mflags;
 
@@ -445,19 +447,20 @@ bounce_bus_dmamem_alloc(bus_dma_tag_t dmat, void **vaddr, 
int flags,
 * else allocate a block of contiguous pages because one or more of the
 * constraints is something that only the contig allocator can fulfill.
 *
-* NOTE: The (dmat->common.alignment <= dmat->maxsize) check
-* below is just a quick hack. The exact alignment guarantees
-* of malloc(9) need to be nailed down, and the code below
-* should be rewritten to take that into account.
-*
-* In the meantime warn the user if malloc gets it wrong.
+* Warn the user if we get it wrong.
 */
if (dmat->common.maxsize <= PAGE_SIZE &&
-   dmat->common.alignment <= dmat->common.maxsize &&
dmat->common.lowaddr >= ptoa((vm_paddr_t)Maxmem) &&
attr == VM_MEMATTR_DEFAULT) {
-   *vaddr = malloc_domainset(dmat->common.maxsize, M_DEVBUF,
+   malloc_sz = roundup2(dmat->common.maxsize,
+   dmat->common.alignment);
+   ma = (uintptr_t)malloc_domainset(malloc_sz, M_DEVBUF,
DOMAINSET_PREF(dmat->common.domain), mflags);
+   if (ma != 0) {
+   *vaddr = (void *)roundup2(ma, dmat->common.alignment);
+   } else {
+   *vaddr = NULL;
+   }
} else if (dmat->common.nsegments >=
howmany(dmat->common.maxsize, MIN(dmat->common.maxsegsz,
PAGE_SIZE)) &&
___
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"


git: 895ad33784e0 - main - x86 budma_bounce: style.

2021-01-13 Thread Konstantin Belousov
The branch main has been updated by kib:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=895ad33784e00fc9d601fd51f0571e0e02d9d146

commit 895ad33784e00fc9d601fd51f0571e0e02d9d146
Author: Konstantin Belousov 
AuthorDate: 2021-01-11 23:42:04 +
Commit: Konstantin Belousov 
CommitDate: 2021-01-13 15:00:46 +

x86 budma_bounce: style.

Reviewed by:dim, jah
MFC after:  3 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D28108
---
 sys/x86/x86/busdma_bounce.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/x86/x86/busdma_bounce.c b/sys/x86/x86/busdma_bounce.c
index 037416be0e8a..65fbbb7ec1a4 100644
--- a/sys/x86/x86/busdma_bounce.c
+++ b/sys/x86/x86/busdma_bounce.c
@@ -400,7 +400,7 @@ bounce_bus_dmamap_destroy(bus_dma_tag_t dmat, bus_dmamap_t 
map)
  * A dmamap to for use with dmamap_load is also allocated.
  */
 static int
-bounce_bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags,
+bounce_bus_dmamem_alloc(bus_dma_tag_t dmat, void **vaddr, int flags,
 bus_dmamap_t *mapp)
 {
vm_memattr_t attr;
___
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"


git: ef23df135468 - main - vfs: set NC_KEEPPOSENTRY alongside NOCACHE when creating a file

2021-01-13 Thread Mateusz Guzik
The branch main has been updated by mjg:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=ef23df13546811a49aeebb107dd17298bec8122e

commit ef23df13546811a49aeebb107dd17298bec8122e
Author: Mateusz Guzik 
AuthorDate: 2021-01-13 14:53:55 +
Commit: Mateusz Guzik 
CommitDate: 2021-01-13 15:29:34 +

vfs: set NC_KEEPPOSENTRY alongside NOCACHE when creating a file

Arguably the entire NOCACHE logic should get retired, in the meantime
at least prevent the code from evicting existing entries.
---
 sys/kern/vfs_vnops.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
index de5cd68501a7..6c6727c7f372 100644
--- a/sys/kern/vfs_vnops.c
+++ b/sys/kern/vfs_vnops.c
@@ -240,8 +240,11 @@ restart:
/*
 * Set NOCACHE to avoid flushing the cache when
 * rolling in many files at once.
-   */
-   ndp->ni_cnd.cn_flags |= LOCKPARENT | NOCACHE;
+*
+* Set NC_KEEPPOSENTRY to keep positive entries if they already
+* exist despite NOCACHE.
+*/
+   ndp->ni_cnd.cn_flags |= LOCKPARENT | NOCACHE | NC_KEEPPOSENTRY;
if ((fmode & O_EXCL) == 0 && (fmode & O_NOFOLLOW) == 0)
ndp->ni_cnd.cn_flags |= FOLLOW;
if ((vn_open_flags & VN_OPEN_INVFS) == 0)
___
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"


git: 5753be8e432f - main - fd: add refcount argument to falloc_noinstall

2021-01-13 Thread Mateusz Guzik
The branch main has been updated by mjg:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=5753be8e432f26b02c0bd06d7dd84316ddc50ed5

commit 5753be8e432f26b02c0bd06d7dd84316ddc50ed5
Author: Mateusz Guzik 
AuthorDate: 2021-01-13 14:16:38 +
Commit: Mateusz Guzik 
CommitDate: 2021-01-13 15:29:34 +

fd: add refcount argument to falloc_noinstall

This lets callers avoid atomic ops by initializing the count to required
value from the get go.

While here add falloc_abort to backpedal from this without having to
fdrop.
---
 sys/kern/kern_descrip.c | 29 +
 sys/kern/vfs_syscalls.c |  4 ++--
 sys/sys/filedesc.h  |  4 +++-
 3 files changed, 26 insertions(+), 11 deletions(-)

diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index 407280d79850..257b1de2a6ac 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -1979,13 +1979,14 @@ falloc_caps(struct thread *td, struct file **resultfp, 
int *resultfd, int flags,
MPASS(resultfp != NULL);
MPASS(resultfd != NULL);
 
-   error = falloc_noinstall(td, &fp);
-   if (error)
-   return (error); /* no reference held on error */
+   error = _falloc_noinstall(td, &fp, 2);
+   if (__predict_false(error != 0)) {
+   return (error);
+   }
 
-   error = finstall(td, fp, &fd, flags, fcaps);
-   if (error) {
-   fdrop(fp, td);  /* one reference (fp only) */
+   error = finstall_refed(td, fp, &fd, flags, fcaps);
+   if (__predict_false(error != 0)) {
+   falloc_abort(td, fp);
return (error);
}
 
@@ -1999,7 +2000,7 @@ falloc_caps(struct thread *td, struct file **resultfp, 
int *resultfd, int flags,
  * Create a new open file structure without allocating a file descriptor.
  */
 int
-falloc_noinstall(struct thread *td, struct file **resultfp)
+_falloc_noinstall(struct thread *td, struct file **resultfp, u_int n)
 {
struct file *fp;
int maxuserfiles = maxfiles - (maxfiles / 20);
@@ -2008,6 +2009,7 @@ falloc_noinstall(struct thread *td, struct file 
**resultfp)
static int curfail;
 
KASSERT(resultfp != NULL, ("%s: resultfp == NULL", __func__));
+   MPASS(n > 0);
 
openfiles_new = atomic_fetchadd_int(&openfiles, 1) + 1;
if ((openfiles_new >= maxuserfiles &&
@@ -2022,13 +2024,24 @@ falloc_noinstall(struct thread *td, struct file 
**resultfp)
}
fp = uma_zalloc(file_zone, M_WAITOK);
bzero(fp, sizeof(*fp));
-   refcount_init(&fp->f_count, 1);
+   refcount_init(&fp->f_count, n);
fp->f_cred = crhold(td->td_ucred);
fp->f_ops = &badfileops;
*resultfp = fp;
return (0);
 }
 
+void
+falloc_abort(struct thread *td, struct file *fp)
+{
+
+   /*
+* For assertion purposes.
+*/
+   refcount_init(&fp->f_count, 0);
+   _fdrop(fp, td);
+}
+
 /*
  * Install a file in a file descriptor table.
  */
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index c1b6c70ab0ac..35a56510e9ef 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -1214,14 +1214,14 @@ success:
}
} else {
filecaps_free(&nd.ni_filecaps);
-   fdrop_close(fp, td);
+   falloc_abort(td, fp);
}
 
td->td_retval[0] = indx;
return (0);
 bad:
KASSERT(indx == -1, ("indx=%d, should be -1", indx));
-   fdrop_close(fp, td);
+   falloc_abort(td, fp);
return (error);
 }
 
diff --git a/sys/sys/filedesc.h b/sys/sys/filedesc.h
index f0cae3ed6911..9b65c7a66054 100644
--- a/sys/sys/filedesc.h
+++ b/sys/sys/filedesc.h
@@ -229,7 +229,9 @@ int dupfdopen(struct thread *td, struct filedesc *fdp, int 
dfd, int mode,
int openerror, int *indxp);
 intfalloc_caps(struct thread *td, struct file **resultfp, int *resultfd,
int flags, struct filecaps *fcaps);
-intfalloc_noinstall(struct thread *td, struct file **resultfp);
+void   falloc_abort(struct thread *td, struct file *fp);
+int_falloc_noinstall(struct thread *td, struct file **resultfp, u_int n);
+#definefalloc_noinstall(td, resultfp) _falloc_noinstall(td, resultfp, 
1)
 void   _finstall(struct filedesc *fdp, struct file *fp, int fd, int flags,
struct filecaps *fcaps);
 intfinstall(struct thread *td, struct file *fp, int *resultfd, int flags,
___
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"


git: f9d85a082181 - main - Revert "x86 busdma_bounce: do not make assumptions about alignment of malloc(9) results."

2021-01-13 Thread Konstantin Belousov
The branch main has been updated by kib:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=f9d85a082181a4eeec4200e42c3ffc1ac85f571c

commit f9d85a082181a4eeec4200e42c3ffc1ac85f571c
Author: Konstantin Belousov 
AuthorDate: 2021-01-13 15:40:54 +
Commit: Konstantin Belousov 
CommitDate: 2021-01-13 15:44:00 +

Revert "x86 busdma_bounce: do not make assumptions about alignment of 
malloc(9) results."

This reverts commit 8f54940f019ca586bcfbf189ef9974eeb0a8194a.
The free needs to be called on the address returned by malloc,
not the realigned address.

Noted by:   andrew
Sponsored by:   The FreeBSD Foundation
---
 sys/x86/x86/busdma_bounce.c | 19 ---
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/sys/x86/x86/busdma_bounce.c b/sys/x86/x86/busdma_bounce.c
index fec6e2144a22..65fbbb7ec1a4 100644
--- a/sys/x86/x86/busdma_bounce.c
+++ b/sys/x86/x86/busdma_bounce.c
@@ -403,8 +403,6 @@ static int
 bounce_bus_dmamem_alloc(bus_dma_tag_t dmat, void **vaddr, int flags,
 bus_dmamap_t *mapp)
 {
-   uintptr_t ma;
-   size_t malloc_sz;
vm_memattr_t attr;
int mflags;
 
@@ -447,20 +445,19 @@ bounce_bus_dmamem_alloc(bus_dma_tag_t dmat, void **vaddr, 
int flags,
 * else allocate a block of contiguous pages because one or more of the
 * constraints is something that only the contig allocator can fulfill.
 *
-* Warn the user if we get it wrong.
+* NOTE: The (dmat->common.alignment <= dmat->maxsize) check
+* below is just a quick hack. The exact alignment guarantees
+* of malloc(9) need to be nailed down, and the code below
+* should be rewritten to take that into account.
+*
+* In the meantime warn the user if malloc gets it wrong.
 */
if (dmat->common.maxsize <= PAGE_SIZE &&
+   dmat->common.alignment <= dmat->common.maxsize &&
dmat->common.lowaddr >= ptoa((vm_paddr_t)Maxmem) &&
attr == VM_MEMATTR_DEFAULT) {
-   malloc_sz = roundup2(dmat->common.maxsize,
-   dmat->common.alignment);
-   ma = (uintptr_t)malloc_domainset(malloc_sz, M_DEVBUF,
+   *vaddr = malloc_domainset(dmat->common.maxsize, M_DEVBUF,
DOMAINSET_PREF(dmat->common.domain), mflags);
-   if (ma != 0) {
-   *vaddr = (void *)roundup2(ma, dmat->common.alignment);
-   } else {
-   *vaddr = NULL;
-   }
} else if (dmat->common.nsegments >=
howmany(dmat->common.maxsize, MIN(dmat->common.maxsegsz,
PAGE_SIZE)) &&
___
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"


git: 594389d1de64 - main - Create a stack frame when needed in the arm64 kernel

2021-01-13 Thread Andrew Turner
The branch main has been updated by andrew:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=594389d1de647cbda3cb36f06c06d3f73b190e82

commit 594389d1de647cbda3cb36f06c06d3f73b190e82
Author: Andrew Turner 
AuthorDate: 2021-01-12 14:18:59 +
Commit: Andrew Turner 
CommitDate: 2021-01-13 16:36:52 +

Create a stack frame when needed in the arm64 kernel

When building the arm64 kernel for use with dtrace or hwpmc we need
to include a stack frame so they can extract a stack trace.

As with amd64 also build a stack frame in modules.

Sponsored by:   Innovate UK
---
 sys/conf/Makefile.arm64 | 2 +-
 sys/conf/kmod.mk| 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/conf/Makefile.arm64 b/sys/conf/Makefile.arm64
index 1f5760021f3e..d48826197dbd 100644
--- a/sys/conf/Makefile.arm64
+++ b/sys/conf/Makefile.arm64
@@ -45,7 +45,7 @@ SYSTEM_LD= \
 KERNEL_EXTRA+= ${KERNEL_KO}.bin
 KERNEL_EXTRA_INSTALL+= ${KERNEL_KO}.bin
 
-.if !empty(DDB_ENABLED)
+.if !empty(DDB_ENABLED) || !empty(DTR_ENABLED) || !empty(HWPMC_ENABLED)
 CFLAGS += -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer
 .endif
 
diff --git a/sys/conf/kmod.mk b/sys/conf/kmod.mk
index b7ba121925ea..c245f447cefb 100644
--- a/sys/conf/kmod.mk
+++ b/sys/conf/kmod.mk
@@ -146,7 +146,7 @@ LDFLAGS+=   --build-id=sha1
 .endif
 
 CFLAGS+=   ${DEBUG_FLAGS}
-.if ${MACHINE_CPUARCH} == amd64
+.if ${MACHINE_CPUARCH} == aarch64 || ${MACHINE_CPUARCH} == amd64
 CFLAGS+=   -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer
 .endif
 
___
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"


git: 63c858a04d56 - main - Switch the arm64 pcpu to a global register variable

2021-01-13 Thread Andrew Turner
The branch main has been updated by andrew:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=63c858a04d56529eddbddf85ad04fc8e99e73762

commit 63c858a04d56529eddbddf85ad04fc8e99e73762
Author: Andrew Turner 
AuthorDate: 2021-01-11 15:43:39 +
Commit: Andrew Turner 
CommitDate: 2021-01-13 16:36:52 +

Switch the arm64 pcpu to a global register variable

This removes an unneeded instruction to move the pointer from x18 to a
temporary register.

Reviewed by:emaste
Sponsored by:   Innovate UK
Differential Revision:  https://reviews.freebsd.org/D26971
---
 sys/arm64/include/pcpu.h | 17 ++---
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/sys/arm64/include/pcpu.h b/sys/arm64/include/pcpu.h
index a520cfc7df56..ce4dc46e1609 100644
--- a/sys/arm64/include/pcpu.h
+++ b/sys/arm64/include/pcpu.h
@@ -56,14 +56,9 @@ struct debug_monitor_state;
 struct pcb;
 struct pcpu;
 
-static inline struct pcpu *
-get_pcpu(void)
-{
-   struct pcpu *pcpu;
+register struct pcpu *pcpup __asm ("x18");
 
-   __asm __volatile("mov   %0, x18" : "=&r"(pcpu));
-   return (pcpu);
-}
+#defineget_pcpu()  pcpup
 
 static inline struct thread *
 get_curthread(void)
@@ -76,11 +71,11 @@ get_curthread(void)
 
 #definecurthread get_curthread()
 
-#definePCPU_GET(member)(get_pcpu()->pc_ ## member)
-#definePCPU_ADD(member, value) (get_pcpu()->pc_ ## member += (value))
+#definePCPU_GET(member)(pcpup->pc_ ## member)
+#definePCPU_ADD(member, value) (pcpup->pc_ ## member += (value))
 #definePCPU_INC(member)PCPU_ADD(member, 1)
-#definePCPU_PTR(member)(&get_pcpu()->pc_ ## member)
-#definePCPU_SET(member,value)  (get_pcpu()->pc_ ## member = (value))
+#definePCPU_PTR(member)(&pcpup->pc_ ## member)
+#definePCPU_SET(member,value)  (pcpup->pc_ ## member = (value))
 
 #endif /* _KERNEL */
 
___
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"


git: 98c15d4dc284 - main - loader.efi: initial terminal size should base on UEFI terminal size

2021-01-13 Thread Toomas Soome
The branch main has been updated by tsoome:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=98c15d4dc28450688dcee6c6082d3a4d417b5d5d

commit 98c15d4dc28450688dcee6c6082d3a4d417b5d5d
Author: Toomas Soome 
AuthorDate: 2021-01-13 17:05:51 +
Commit: Toomas Soome 
CommitDate: 2021-01-13 17:05:51 +

loader.efi: initial terminal size should base on UEFI terminal size

We do select font based on desired terminal size, we do query
UEFI terminal size with conout->QueryMode(), but by mistake, the fallback
values are used.
---
 stand/efi/libefi/efi_console.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/stand/efi/libefi/efi_console.c b/stand/efi/libefi/efi_console.c
index 1ed2be15d3d6..4c04461a5f92 100644
--- a/stand/efi/libefi/efi_console.c
+++ b/stand/efi/libefi/efi_console.c
@@ -953,13 +953,13 @@ cons_update_mode(bool use_gfx_mode)
 
/*
 * setup_font() can adjust terminal size.
-* Note, we assume 80x24 terminal first, this is
-* because the font selection will attempt to achieve
-* at least this terminal dimension and we do not
-* end up with too small font.
+* Note, we do use UEFI terminal dimensions first,
+* this is because the font selection will attempt
+* to achieve at least this terminal dimension and
+* we do not end up with too small font.
 */
-   gfx_state.tg_tp.tp_row = TEXT_ROWS;
-   gfx_state.tg_tp.tp_col = TEXT_COLS;
+   gfx_state.tg_tp.tp_row = rows;
+   gfx_state.tg_tp.tp_col = cols;
setup_font(&gfx_state, fb_height, fb_width);
rows = gfx_state.tg_tp.tp_row;
cols = gfx_state.tg_tp.tp_col;
___
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"


git: 0a05676b44ae - main - Add driver for Synopsys Designware Watchdog timer.

2021-01-13 Thread Emmanuel Vadot
The branch main has been updated by manu:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=0a05676b44ae5575141ff731079a8405e111f965

commit 0a05676b44ae5575141ff731079a8405e111f965
Author: Emmanuel Vadot 
AuthorDate: 2021-01-13 17:23:51 +
Commit: Emmanuel Vadot 
CommitDate: 2021-01-13 17:43:47 +

Add driver for Synopsys Designware Watchdog timer.

This driver supports some arm and arm64 boards equipped with
"snps,dw-wdt"-compatible watchdog device.
Tested on RK3399-based board (RockPro64).
Once started watchdog device cannot be stopped.
Interrupt handler has mode to kick watchdog even when software does not do 
it
properly.
This can be controlled via sysctl: dev.dwwdt.prevent_restart.
Also - driver handles system shutdown and prevents from restart when system
is asked to reboot.

Submitted by:   kjo...@gmail.com
Differential Revision:  https://reviews.freebsd.org/D26761
---
 sys/dev/dwwdt/dwwdt.c  | 360 +
 sys/modules/Makefile   |   2 +
 sys/modules/dwwdt/Makefile |   7 +
 3 files changed, 369 insertions(+)

diff --git a/sys/dev/dwwdt/dwwdt.c b/sys/dev/dwwdt/dwwdt.c
new file mode 100644
index ..c08927f44c60
--- /dev/null
+++ b/sys/dev/dwwdt/dwwdt.c
@@ -0,0 +1,360 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2020 BusyTech
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* Registers */
+#define DWWDT_CR   0x00
+#define DWWDT_CR_WDT_EN(1 << 0)
+#define DWWDT_CR_RESP_MODE (1 << 1)
+#define DWWDT_TORR 0x04
+#define DWWDT_CCVR 0x08
+#define DWWDT_CRR  0x0C
+#define DWWDT_CRR_KICK 0x76
+#define DWWDT_STAT 0x10
+#define DWWDT_STAT_STATUS  0x01
+#define DWWDT_EOI  0x14
+
+#define DWWDT_READ4(sc, reg)   bus_read_4((sc)->sc_mem_res, (reg))
+#define DWWDT_WRITE4(sc, reg, val) \
+   bus_write_4((sc)->sc_mem_res, (reg), (val))
+
+/*
+ * 47 = 16 (timeout shift of dwwdt) + 30 (1s ~= 2 ** 30ns) + 1
+ * (pre-restart delay)
+ */
+#define DWWDT_EXP_OFFSET   47
+
+struct dwwdt_softc {
+   device_t sc_dev;
+   struct resource *sc_mem_res;
+   struct resource *sc_irq_res;
+   void*sc_intr_cookie;
+   clk_tsc_clk;
+   uint64_t sc_clk_freq;
+   eventhandler_tag sc_evtag;
+   int  sc_mem_rid;
+   int  sc_irq_rid;
+   enum {
+   DWWDT_STOPPED,
+   DWWDT_RUNNING,
+   }sc_status;
+};
+
+static devclass_t dwwdt_devclass;
+
+SYSCTL_NODE(_dev, OID_AUTO, dwwdt, CTLFLAG_RW | CTLFLAG_MPSAFE, 0,
+"Synopsys Designware watchdog timer");
+/* Setting this to 0 enables full restart mode. */
+static uint32_t dwwdt_prevent_restart = 1;
+SYSCTL_UINT(_dev_dwwdt, OID_AUTO, prevent_restart, CTLFLAG_RW | CTLFLAG_MPSAFE,
+&dwwdt_prevent_restart, 1,
+"Prevent system restart (0 - Disabled; 1 - Enabled)");
+
+static uint32_t dwwdt_debug_enabled = 0;
+SYSCTL_UINT(_dev_dwwdt, OID_AUTO, debug, CTLFLAG_RW | CTLFLAG_MPSAFE,
+&dwwdt_debug_enabled, 1, "Debug mode (0 - Disabled; 1 - Enabled)");
+
+static int dwwdt_probe(device_t);
+static int dwwdt_attach(device_t);
+static int dwwdt_detach(device_t);
+static int dwwdt_shutdown(device_t);
+
+static void dwwdt_intr(void *);
+static void dwwdt_eve

git: 6003bf9290cd - main - dwwdt: Add PNP info for the driver

2021-01-13 Thread Emmanuel Vadot
The branch main has been updated by manu:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=6003bf9290cd6f5b2fd9adcd45ac82144e6cb789

commit 6003bf9290cd6f5b2fd9adcd45ac82144e6cb789
Author: Emmanuel Vadot 
AuthorDate: 2021-01-13 17:41:34 +
Commit: Emmanuel Vadot 
CommitDate: 2021-01-13 17:43:51 +

dwwdt: Add PNP info for the driver
---
 sys/dev/dwwdt/dwwdt.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/sys/dev/dwwdt/dwwdt.c b/sys/dev/dwwdt/dwwdt.c
index c08927f44c60..4eab26ef2915 100644
--- a/sys/dev/dwwdt/dwwdt.c
+++ b/sys/dev/dwwdt/dwwdt.c
@@ -86,6 +86,11 @@ struct dwwdt_softc {
 
 static devclass_t dwwdt_devclass;
 
+static struct ofw_compat_data compat_data[] = {
+   { "snps,dw-wdt",1 },
+   { NULL, 0 }
+};
+
 SYSCTL_NODE(_dev, OID_AUTO, dwwdt, CTLFLAG_RW | CTLFLAG_MPSAFE, 0,
 "Synopsys Designware watchdog timer");
 /* Setting this to 0 enables full restart mode. */
@@ -219,7 +224,7 @@ dwwdt_probe(device_t dev)
if (!ofw_bus_status_okay(dev))
return (ENXIO);
 
-   if (!ofw_bus_is_compatible(dev, "snps,dw-wdt"))
+   if (!ofw_bus_search_compatible(dev, compat_data)->ocd_data)
return (ENXIO);
 
device_set_desc(dev, "Synopsys Designware watchdog timer");
@@ -358,3 +363,4 @@ static driver_t dwwdt_driver = {
 
 DRIVER_MODULE(dwwdt, simplebus, dwwdt_driver, dwwdt_devclass, NULL, NULL);
 MODULE_VERSION(dwwdt, 1);
+OFWBUS_PNP_INFO(compat_data);
___
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"


git: fdaf9cb942d9 - main - Revert "loader.efi: disable workaround for serial console on non-x86"

2021-01-13 Thread Toomas Soome
The branch main has been updated by tsoome:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=fdaf9cb942d995969b79eb8ad3fa91b7592198cd

commit fdaf9cb942d995969b79eb8ad3fa91b7592198cd
Author: Toomas Soome 
AuthorDate: 2021-01-13 18:18:35 +
Commit: Toomas Soome 
CommitDate: 2021-01-13 18:18:35 +

Revert "loader.efi: disable workaround for serial console on non-x86"

This patch is creating some issues, reverting it.

This reverts commit 8b18395487506d3602205e5844e0b67ba0c0dc80.
---
 stand/efi/libefi/efi_console.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/stand/efi/libefi/efi_console.c b/stand/efi/libefi/efi_console.c
index 4c04461a5f92..7024f9c8b2f2 100644
--- a/stand/efi/libefi/efi_console.c
+++ b/stand/efi/libefi/efi_console.c
@@ -929,11 +929,7 @@ cons_update_mode(bool use_gfx_mode)
 * also just use the old emulator. RB_MULTIPLE also implies
 * we're using a serial console.
 */
-#if defined(__i386__) || defined(__amd64__)
mode = parse_uefi_con_out();
-#else
-   mode = 0;
-#endif
if ((mode & (RB_SERIAL | RB_MULTIPLE)) == 0) {
conout->EnableCursor(conout, FALSE);
gfx_state.tg_cursor_visible = false;
___
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"


git: ea36212bf571 - main - pf: Don't hold PF_RULES_WLOCK during copyin() on DIOCRCLRTSTATS

2021-01-13 Thread Kristof Provost
The branch main has been updated by kp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=ea36212bf5711206bbaf5362a23ebb52c7f7e2a4

commit ea36212bf5711206bbaf5362a23ebb52c7f7e2a4
Author: Kristof Provost 
AuthorDate: 2021-01-13 18:30:01 +
Commit: Kristof Provost 
CommitDate: 2021-01-13 18:49:42 +

pf: Don't hold PF_RULES_WLOCK during copyin() on DIOCRCLRTSTATS

We cannot hold a non-sleepable lock during copyin(). This means we can't
safely count the table, so instead we fall back to the pf_ioctl_maxcount
used in other ioctls to protect against overly large requests.

Reported by:syzbot+81e380344d4a6c37d...@syzkaller.appspotmail.com
MFC after:  1 week
---
 sys/netpfil/pf/pf_ioctl.c | 17 -
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c
index b6e2ec98ddce..60c38a980d1e 100644
--- a/sys/netpfil/pf/pf_ioctl.c
+++ b/sys/netpfil/pf/pf_ioctl.c
@@ -3363,36 +3363,35 @@ DIOCCHANGEADDR_error:
struct pfioc_table *io = (struct pfioc_table *)addr;
struct pfr_table *pfrts;
size_t totlen;
-   int n;
 
if (io->pfrio_esize != sizeof(struct pfr_table)) {
error = ENODEV;
break;
}
 
-   PF_RULES_WLOCK();
-   n = pfr_table_count(&io->pfrio_table, io->pfrio_flags);
-   if (n < 0) {
-   PF_RULES_WUNLOCK();
-   error = EINVAL;
+   if (io->pfrio_size < 0 || io->pfrio_size > pf_ioctl_maxcount ||
+   WOULD_OVERFLOW(io->pfrio_size, sizeof(struct pfr_table))) {
+   /* We used to count tables and use the minimum required
+* size, so we didn't fail on overly large requests.
+* Keep doing so. */
+   io->pfrio_size = pf_ioctl_maxcount;
break;
}
-   io->pfrio_size = min(io->pfrio_size, n);
 
totlen = io->pfrio_size * sizeof(struct pfr_table);
pfrts = mallocarray(io->pfrio_size, sizeof(struct pfr_table),
M_TEMP, M_NOWAIT);
if (pfrts == NULL) {
error = ENOMEM;
-   PF_RULES_WUNLOCK();
break;
}
error = copyin(io->pfrio_buffer, pfrts, totlen);
if (error) {
free(pfrts, M_TEMP);
-   PF_RULES_WUNLOCK();
break;
}
+
+   PF_RULES_WLOCK();
error = pfr_clr_tstats(pfrts, io->pfrio_size,
&io->pfrio_nzero, io->pfrio_flags | PFR_FLAG_USERIOCTL);
PF_RULES_WUNLOCK();
___
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"


git: 44117554b1ee - main - pf tests: pass NULL buffer to DIOCRCLRTSTATS

2021-01-13 Thread Kristof Provost
The branch main has been updated by kp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=44117554b1ee8edd66d7383c17802d5799fd18f2

commit 44117554b1ee8edd66d7383c17802d5799fd18f2
Author: Kristof Provost 
AuthorDate: 2021-01-13 18:41:07 +
Commit: Kristof Provost 
CommitDate: 2021-01-13 18:49:45 +

pf tests: pass NULL buffer to DIOCRCLRTSTATS

As discovered by syzcaller this used to provoke panics.

MFC after:  1 week
---
 tests/sys/netpfil/pf/ioctl/validation.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/tests/sys/netpfil/pf/ioctl/validation.c 
b/tests/sys/netpfil/pf/ioctl/validation.c
index 5b1f61720f66..0d7f7631e91b 100644
--- a/tests/sys/netpfil/pf/ioctl/validation.c
+++ b/tests/sys/netpfil/pf/ioctl/validation.c
@@ -265,6 +265,11 @@ ATF_TC_BODY(clrtstats, tc)
io.pfrio_size = 1 << 24;
if (ioctl(dev, DIOCRCLRTSTATS, &io) != 0)
atf_tc_fail("Request with size 1 << 24 failed");
+
+   io.pfrio_size = sizeof(tbl);
+   io.pfrio_buffer = NULL;
+   if (ioctl(dev, DIOCRCLRTSTATS, &io) == 0)
+   atf_tc_fail("Request with NULL buffer succeeded");
 }
 
 ATF_TC_CLEANUP(clrtstats, tc)
___
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"


Re: git: 11d62b6f31ab - main - linuxkpi: add kernel_fpu_begin/kernel_fpu_end

2021-01-13 Thread John Baldwin
On 1/13/21 3:42 AM, myfreeweb wrote:
> 
> 
> On January 13, 2021 10:08:26 AM UTC, Emmanuel Vadot  
> wrote:
>> On Tue, 12 Jan 2021 15:16:55 +0200
>> Konstantin Belousov  wrote:
>>
>>> On Tue, Jan 12, 2021 at 11:43:00AM +, Emmanuel Vadot wrote:
 The branch main has been updated by manu:

 URL: 
 https://cgit.FreeBSD.org/src/commit/?id=11d62b6f31ab4e99df6d0c6c23406b57eaa37f41

 commit 11d62b6f31ab4e99df6d0c6c23406b57eaa37f41
 Author: Emmanuel Vadot 
 AuthorDate: 2021-01-12 11:02:38 +
 Commit: Emmanuel Vadot 
 CommitDate: 2021-01-12 11:31:00 +

 linuxkpi: add kernel_fpu_begin/kernel_fpu_end
 
 With newer AMD GPUs (>=Navi,Renoir) there is FPU context usage in the
 amdgpu driver.
 The `kernel_fpu_begin/end` implementations in drm did not even allow 
 nested
 begin-end blocks.
>>>
>>> Does Linux allow more then one thread to execute kernel_fpu_begin ?
>>
>> I actually have no idea, adding Greg to cc.
> 
> Looks like they save the context into the current thread state, so yes? (drm 
> doesn't need that)
> 
> Also they seem to do something FPU_KERN_NOCTX like (??) because they disable 
> preemption inside these blocks.
> (Where does our NOCTX actually store the state?)

It doesn't store at all because threads aren't allowed to sleep in a critical
section, so the thread will never give up the CPU while in the FPU section.  If
threads can voluntarily sleep (cv_wait*, *sleep(), etc.) while using
kernel_fpu_begin(), then NOCTX won't work and we will need something else.

However, the code snippet from the stackoverflow URL I posted earlier looks
exactly like the NOCTX case where we flush the user FPU state to the thread
if the FPU state is "dirty" and then load a clean initial state for use by
the FPU.  It would also seem to never save the kernel FPU state anywhere by
counting on avoiding context switches.  So, I think you probably should just
make this use NOCTX.

-- 
John Baldwin
___
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"


git: 074a91f746bd - main - Enable accelerated AES-XTS software crypto in GENERIC.

2021-01-13 Thread John Baldwin
The branch main has been updated by jhb:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=074a91f746bd80498a4c815aa795e5dc51b12121

commit 074a91f746bd80498a4c815aa795e5dc51b12121
Author: John Baldwin 
AuthorDate: 2021-01-13 21:13:01 +
Commit: John Baldwin 
CommitDate: 2021-01-13 21:13:01 +

Enable accelerated AES-XTS software crypto in GENERIC.

In particular, using GELI on a root filesystem will only use
accelerated software crypto drivers if they are available before the
root filesystem is mounted.  While these modules can be loaded from
the loader, including them in GENERIC provides a better out-of-the-box
experience for users.

Both aesni(4) and armv8crypto(4) provide accelerated implementations
of the default cipher used by GELI (AES-XTS) in addition to other
ciphers.

Reviewed by:mhorne, allanjude, markj
Differential Revision:  https://reviews.freebsd.org/D28100
---
 sys/amd64/conf/GENERIC | 1 +
 sys/arm64/conf/GENERIC | 1 +
 sys/i386/conf/GENERIC  | 1 +
 3 files changed, 3 insertions(+)

diff --git a/sys/amd64/conf/GENERIC b/sys/amd64/conf/GENERIC
index 1ccd06669951..393fec26d423 100644
--- a/sys/amd64/conf/GENERIC
+++ b/sys/amd64/conf/GENERIC
@@ -315,6 +315,7 @@ device  wpi # Intel 3945ABG 
wireless NICs.
 
 # Pseudo devices.
 device crypto  # core crypto support
+device aesni   # AES-NI OpenCrypto module
 device loop# Network loopback
 device padlock_rng # VIA Padlock RNG
 device rdrand_rng  # Intel Bull Mountain RNG
diff --git a/sys/arm64/conf/GENERIC b/sys/arm64/conf/GENERIC
index 463271d1db26..d1ad101975de 100644
--- a/sys/arm64/conf/GENERIC
+++ b/sys/arm64/conf/GENERIC
@@ -217,6 +217,7 @@ device  aw_rtc  # Allwinner Real-time 
Clock
 device mv_rtc  # Marvell Real-time Clock
 
 # Crypto accelerators
+device armv8crypto # ARMv8 OpenCrypto module
 device safexcel# Inside Secure EIP-97
 
 # Watchdog controllers
diff --git a/sys/i386/conf/GENERIC b/sys/i386/conf/GENERIC
index eac3a0af6c82..b65235ca9668 100644
--- a/sys/i386/conf/GENERIC
+++ b/sys/i386/conf/GENERIC
@@ -287,6 +287,7 @@ device  wpi # Intel 3945ABG 
wireless NICs.
 
 # Pseudo devices.
 device crypto  # core crypto support
+device aesni   # AES-NI OpenCrypto module
 device loop# Network loopback
 device padlock_rng # VIA Padlock RNG
 device rdrand_rng  # Intel Bull Mountain RNG
___
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"


Re: git: 074a91f746bd - main - Enable accelerated AES-XTS software crypto in GENERIC.

2021-01-13 Thread Alan Somers
On Wed, Jan 13, 2021 at 2:13 PM John Baldwin  wrote:

> The branch main has been updated by jhb:
>
> URL:
> https://cgit.FreeBSD.org/src/commit/?id=074a91f746bd80498a4c815aa795e5dc51b12121
>
> commit 074a91f746bd80498a4c815aa795e5dc51b12121
> Author: John Baldwin 
> AuthorDate: 2021-01-13 21:13:01 +
> Commit: John Baldwin 
> CommitDate: 2021-01-13 21:13:01 +
>
> Enable accelerated AES-XTS software crypto in GENERIC.
>
> In particular, using GELI on a root filesystem will only use
> accelerated software crypto drivers if they are available before the
> root filesystem is mounted.  While these modules can be loaded from
> the loader, including them in GENERIC provides a better out-of-the-box
> experience for users.
>
> Both aesni(4) and armv8crypto(4) provide accelerated implementations
> of the default cipher used by GELI (AES-XTS) in addition to other
> ciphers.
>
> Reviewed by:mhorne, allanjude, markj
> Differential Revision:  https://reviews.freebsd.org/D28100
>
>
How about an entry in UPDATING?
___
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"


git: 818390ce0ca5 - main - arm64: fix early devmap assertion

2021-01-13 Thread Mitchell Horne
The branch main has been updated by mhorne:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=818390ce0ca539300dd15d7a817784f1e3f7a9b8

commit 818390ce0ca539300dd15d7a817784f1e3f7a9b8
Author: Mitchell Horne 
AuthorDate: 2021-01-13 18:30:50 +
Commit: Mitchell Horne 
CommitDate: 2021-01-13 21:27:44 +

arm64: fix early devmap assertion

The purpose of this KASSERT is to ensure that we do not run out of space
in the early devmap. However, the devmap grew beyond its initial size of
2MB in r336519, and this assertion did not grow with it.

A devmap mapping of a 1080p framebuffer requires 1920x1080 bytes, or
1.977 MB, so it is just barely able to fit without triggering the
assertion, provided no other devices are mapped before it. With the
addition of `options GDB` in GENERIC by bbfa199cbc16, the uart is now
mapped for the purposes of a debug port, before mapping the framebuffer.
The presence of both these conditions pushes the selected virtual
address just below the threshold, triggering the assertion.

To fix this, use the correct size of the devmap, defined by
PMAP_MAPDEV_EARLY_SIZE. Since this code is shared with RISC-V, define
it for that platform as well (although it is a different size).

PR: 25241
Reported by:gbe
MFC after:  3 days
Sponsored by:   The FreeBSD Foundation
---
 sys/kern/subr_devmap.c  | 2 +-
 sys/riscv/include/vmparam.h | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/kern/subr_devmap.c b/sys/kern/subr_devmap.c
index 581e85086f0f..8e07199b7f73 100644
--- a/sys/kern/subr_devmap.c
+++ b/sys/kern/subr_devmap.c
@@ -275,7 +275,7 @@ pmap_mapdev(vm_offset_t pa, vm_size_t size)
if (early_boot) {
akva_devmap_vaddr = trunc_page(akva_devmap_vaddr - size);
va = akva_devmap_vaddr;
-   KASSERT(va >= VM_MAX_KERNEL_ADDRESS - L2_SIZE,
+   KASSERT(va >= VM_MAX_KERNEL_ADDRESS - PMAP_MAPDEV_EARLY_SIZE,
("Too many early devmap mappings"));
} else
 #endif
diff --git a/sys/riscv/include/vmparam.h b/sys/riscv/include/vmparam.h
index f3cab1074454..9580ab3e1218 100644
--- a/sys/riscv/include/vmparam.h
+++ b/sys/riscv/include/vmparam.h
@@ -235,6 +235,7 @@ extern vm_offset_t init_pt_va;
 #defineZERO_REGION_SIZE(64 * 1024) /* 64KB */
 
 #defineDEVMAP_MAX_VADDRVM_MAX_KERNEL_ADDRESS
+#definePMAP_MAPDEV_EARLY_SIZE  (L2_SIZE * 2)
 
 /*
  * No non-transparent large page support in the pmap.
___
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"


Re: git: 818390ce0ca5 - main - arm64: fix early devmap assertion

2021-01-13 Thread Mitchell Horne
On Wed, Jan 13, 2021 at 5:28 PM Mitchell Horne  wrote:
>
> The branch main has been updated by mhorne:
>
> URL: 
> https://cgit.FreeBSD.org/src/commit/?id=818390ce0ca539300dd15d7a817784f1e3f7a9b8
>
> commit 818390ce0ca539300dd15d7a817784f1e3f7a9b8
> Author: Mitchell Horne 
> AuthorDate: 2021-01-13 18:30:50 +
> Commit: Mitchell Horne 
> CommitDate: 2021-01-13 21:27:44 +
>
> arm64: fix early devmap assertion
>
> The purpose of this KASSERT is to ensure that we do not run out of space
> in the early devmap. However, the devmap grew beyond its initial size of
> 2MB in r336519, and this assertion did not grow with it.
>
> A devmap mapping of a 1080p framebuffer requires 1920x1080 bytes, or
> 1.977 MB, so it is just barely able to fit without triggering the
> assertion, provided no other devices are mapped before it. With the
> addition of `options GDB` in GENERIC by bbfa199cbc16, the uart is now
> mapped for the purposes of a debug port, before mapping the framebuffer.
> The presence of both these conditions pushes the selected virtual
> address just below the threshold, triggering the assertion.
>
> To fix this, use the correct size of the devmap, defined by
> PMAP_MAPDEV_EARLY_SIZE. Since this code is shared with RISC-V, define
> it for that platform as well (although it is a different size).
>
> PR: 25241

Sigh. This should be PR 252541.

Mitchell

> Reported by:gbe
> MFC after:  3 days
> Sponsored by:   The FreeBSD Foundation
> ---
>  sys/kern/subr_devmap.c  | 2 +-
>  sys/riscv/include/vmparam.h | 1 +
>  2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/sys/kern/subr_devmap.c b/sys/kern/subr_devmap.c
> index 581e85086f0f..8e07199b7f73 100644
> --- a/sys/kern/subr_devmap.c
> +++ b/sys/kern/subr_devmap.c
> @@ -275,7 +275,7 @@ pmap_mapdev(vm_offset_t pa, vm_size_t size)
> if (early_boot) {
> akva_devmap_vaddr = trunc_page(akva_devmap_vaddr - size);
> va = akva_devmap_vaddr;
> -   KASSERT(va >= VM_MAX_KERNEL_ADDRESS - L2_SIZE,
> +   KASSERT(va >= VM_MAX_KERNEL_ADDRESS - PMAP_MAPDEV_EARLY_SIZE,
> ("Too many early devmap mappings"));
> } else
>  #endif
> diff --git a/sys/riscv/include/vmparam.h b/sys/riscv/include/vmparam.h
> index f3cab1074454..9580ab3e1218 100644
> --- a/sys/riscv/include/vmparam.h
> +++ b/sys/riscv/include/vmparam.h
> @@ -235,6 +235,7 @@ extern vm_offset_t init_pt_va;
>  #defineZERO_REGION_SIZE(64 * 1024) /* 64KB */
>
>  #defineDEVMAP_MAX_VADDRVM_MAX_KERNEL_ADDRESS
> +#definePMAP_MAPDEV_EARLY_SIZE  (L2_SIZE * 2)
>
>  /*
>   * No non-transparent large page support in the pmap.
___
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"


git: 7ae27c2d6c4f - main - newvers.sh: set to ALPHA1 as part of the 13.0 cycle

2021-01-13 Thread Glen Barber
The branch main has been updated by gjb:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=7ae27c2d6c4fe4f21e1219bb5d8a37cfc932337b

commit 7ae27c2d6c4fe4f21e1219bb5d8a37cfc932337b
Author: Glen Barber 
AuthorDate: 2021-01-14 00:01:30 +
Commit: Glen Barber 
CommitDate: 2021-01-14 00:01:30 +

newvers.sh: set to ALPHA1 as part of the 13.0 cycle

Sponsored by:   Rubicon Communications, LLC (netgate.com)
---
 sys/conf/newvers.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh
index b8667844210b..2a0ace45f2f6 100644
--- a/sys/conf/newvers.sh
+++ b/sys/conf/newvers.sh
@@ -54,7 +54,7 @@
 
 TYPE="FreeBSD"
 REVISION="13.0"
-BRANCH="CURRENT"
+BRANCH="ALPHA1"
 if [ -n "${BRANCH_OVERRIDE}" ]; then
BRANCH=${BRANCH_OVERRIDE}
 fi
___
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"


Re: git: 11d62b6f31ab - main - linuxkpi: add kernel_fpu_begin/kernel_fpu_end

2021-01-13 Thread myfreeweb


On January 13, 2021 8:58:58 PM UTC, John Baldwin  wrote:
>On 1/13/21 3:42 AM, myfreeweb wrote:
>> 
>> 
>> On January 13, 2021 10:08:26 AM UTC, Emmanuel Vadot  
>> wrote:
>>> On Tue, 12 Jan 2021 15:16:55 +0200
>>> Konstantin Belousov  wrote:
>>>
 On Tue, Jan 12, 2021 at 11:43:00AM +, Emmanuel Vadot wrote:
> The branch main has been updated by manu:
>
> URL: 
> https://cgit.FreeBSD.org/src/commit/?id=11d62b6f31ab4e99df6d0c6c23406b57eaa37f41
>
> commit 11d62b6f31ab4e99df6d0c6c23406b57eaa37f41
> Author: Emmanuel Vadot 
> AuthorDate: 2021-01-12 11:02:38 +
> Commit: Emmanuel Vadot 
> CommitDate: 2021-01-12 11:31:00 +
>
> linuxkpi: add kernel_fpu_begin/kernel_fpu_end
> 
> With newer AMD GPUs (>=Navi,Renoir) there is FPU context usage in the
> amdgpu driver.
> The `kernel_fpu_begin/end` implementations in drm did not even allow 
> nested
> begin-end blocks.

 Does Linux allow more then one thread to execute kernel_fpu_begin ?
>>>
>>> I actually have no idea, adding Greg to cc.
>> 
>> Looks like they save the context into the current thread state, so yes? (drm 
>> doesn't need that)
>> 
>> Also they seem to do something FPU_KERN_NOCTX like (??) because they disable 
>> preemption inside these blocks.
>> (Where does our NOCTX actually store the state?)
>
>It doesn't store at all because threads aren't allowed to sleep in a critical
>section, so the thread will never give up the CPU while in the FPU section.  If
>threads can voluntarily sleep (cv_wait*, *sleep(), etc.) while using
>kernel_fpu_begin(), then NOCTX won't work and we will need something else.

Hmm but with no storage at all, how would it work from a syscall?
The manpage does mention a "usermode save area" – I was talking about that.

Linux kernel_fpu_begin starts with preempt_disable, so definitely no condvars 
and the like. No idea about simple time sleeps. But amdgpu doesn't seem to do 
even that.

>However, the code snippet from the stackoverflow URL I posted earlier looks
>exactly like the NOCTX case where we flush the user FPU state to the thread
>if the FPU state is "dirty" and then load a clean initial state for use by
>the FPU.  It would also seem to never save the kernel FPU state anywhere by
>counting on avoiding context switches.  So, I think you probably should just
>make this use NOCTX.

NOCTX was the first thing I've tried, and it didn't work, but probably just 
because of the nesting. Haven't retried it with the nesting counter.
Testing a bunch of things would be easier if I had one of the GPUs that use 
this code instead of having to ask someone else to test…
___
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"


Re: git: 11d62b6f31ab - main - linuxkpi: add kernel_fpu_begin/kernel_fpu_end

2021-01-13 Thread Konstantin Belousov
On Thu, Jan 14, 2021 at 01:36:27AM +, myfreeweb wrote:
> 
> 
> On January 13, 2021 8:58:58 PM UTC, John Baldwin  wrote:
> >It doesn't store at all because threads aren't allowed to sleep in a critical
> >section, so the thread will never give up the CPU while in the FPU section.  
> >If
> >threads can voluntarily sleep (cv_wait*, *sleep(), etc.) while using
> >kernel_fpu_begin(), then NOCTX won't work and we will need something else.
> 
> Hmm but with no storage at all, how would it work from a syscall?
> The manpage does mention a "usermode save area" – I was talking about that.
There is a storage for the user state, always.  When NOCTX is used, FPU state
is spilled into the _current_ save area, and then kernel lives to the promise
that the new state after fpu_enter(NOCTX) does not ever need to be saved.

> 
> Linux kernel_fpu_begin starts with preempt_disable, so definitely no condvars 
> and the like. No idea about simple time sleeps. But amdgpu doesn't seem to do 
> even that.

You should get enough assertions fired if something tries to context switch
while entered NOCTX region.
___
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"


git: 0495ed398c4f - main - contrib/lua: update to 5.4.2

2021-01-13 Thread Kyle Evans
The branch main has been updated by kevans:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=0495ed398c4f64013bab2327eb13a303e1f90c13

commit 0495ed398c4f64013bab2327eb13a303e1f90c13
Merge: 7ae27c2d6c4f 0ea45b9cd43c
Author: Kyle Evans 
AuthorDate: 2021-01-14 05:56:18 +
Commit: Kyle Evans 
CommitDate: 2021-01-14 05:56:18 +

contrib/lua: update to 5.4.2

Merge commit '0ea45b9cd43ce1247eb3eee9bfd5cee3d19068e7' into main

 contrib/lua/Makefile   |   30 +-
 contrib/lua/README |2 +-
 contrib/lua/doc/contents.html  |   81 +-
 contrib/lua/doc/lua.1  |   93 +-
 contrib/lua/doc/manual.html| 3260 ++--
 contrib/lua/doc/readme.html|  115 +-
 contrib/lua/src/Makefile   |   83 +-
 contrib/lua/src/lapi.c |  706 +
 contrib/lua/src/lapi.h |   27 +-
 contrib/lua/src/lauxlib.c  |  385 ++---
 contrib/lua/src/lauxlib.h  |   54 +-
 contrib/lua/src/lbaselib.c |  139 +-
 contrib/lua/src/lbitlib.c  |  233 ---
 contrib/lua/src/lcode.c| 1141 ++
 contrib/lua/src/lcode.h|   34 +-
 contrib/lua/src/lcorolib.c |   89 +-
 contrib/lua/src/lctype.c   |   43 +-
 contrib/lua/src/lctype.h   |   18 +-
 contrib/lua/src/ldblib.c   |   94 +-
 contrib/lua/src/ldebug.c   |  462 --
 contrib/lua/src/ldebug.h   |   21 +-
 contrib/lua/src/ldo.c  |  559 +++
 contrib/lua/src/ldo.h  |   38 +-
 contrib/lua/src/ldump.c|  197 +--
 contrib/lua/src/lfunc.c|  223 ++-
 contrib/lua/src/lfunc.h|   50 +-
 contrib/lua/src/lgc.c  | 1387 +++--
 contrib/lua/src/lgc.h  |  128 +-
 contrib/lua/src/linit.c|7 +-
 contrib/lua/src/liolib.c   |  121 +-
 contrib/lua/src/ljumptab.h |  112 ++
 contrib/lua/src/llex.c |   74 +-
 contrib/lua/src/llex.h |   12 +-
 contrib/lua/src/llimits.h  |  134 +-
 contrib/lua/src/lmathlib.c |  433 +-
 contrib/lua/src/lmem.c |  178 ++-
 contrib/lua/src/lmem.h |   72 +-
 contrib/lua/src/loadlib.c  |  261 ++--
 contrib/lua/src/lobject.c  |  340 +++--
 contrib/lua/src/lobject.h  |  737 ++---
 contrib/lua/src/lopcodes.c |  190 ++-
 contrib/lua/src/lopcodes.h |  401 +++--
 contrib/lua/src/lopnames.h |  103 ++
 contrib/lua/src/loslib.c   |   85 +-
 contrib/lua/src/lparser.c  |  967 
 contrib/lua/src/lparser.h  |   80 +-
 contrib/lua/src/lprefix.h  |4 +-
 contrib/lua/src/lstate.c   |  221 ++-
 contrib/lua/src/lstate.h   |  202 ++-
 contrib/lua/src/lstring.c  |  135 +-
 contrib/lua/src/lstring.h  |   22 +-
 contrib/lua/src/lstrlib.c  |  504 +--
 contrib/lua/src/ltable.c   |  692 ++---
 contrib/lua/src/ltable.h   |   22 +-
 contrib/lua/src/ltablib.c  |   52 +-
 contrib/lua/src/ltm.c  |  173 ++-
 contrib/lua/src/ltm.h  |   37 +-
 contrib/lua/src/lua.c  |  439 +++---
 contrib/lua/src/lua.h  |   60 +-
 contrib/lua/src/luac.c |  470 --
 contrib/lua/src/luaconf.h.dist |  253 ++--
 contrib/lua/src/lualib.h   |5 +-
 contrib/lua/src/lundump.c  |  266 ++--
 contrib/lua/src/lundump.h  |8 +-
 contrib/lua/src/lutf8lib.c |  117 +-
 contrib/lua/src/lvm.c  | 1762 ++
 contrib/lua/src/lvm.h  |   91 +-
 contrib/lua/src/lzio.c |2 +-
 contrib/lua/src/lzio.h |2 +-
 lib/liblua/Makefile|2 +-
 lib/liblua/luaconf.h   |  248 ++-
 stand/liblua/luaconf.h |  244 ++-
 72 files changed, 12945 insertions(+), 7087 deletions(-)

diff --cc contrib/lua/Makefile
index a2820e04fe24,..36447a0f61c7
mode 100644,00..100644
--- a/contrib/lua/Makefile
+++ b/contrib/lua/Makefile
@@@ -1,114 -1,0 +1,106 @@@
 +# Makefile for installing Lua
 +# See doc/readme.html for installation and customization instructions.
 +
 +# == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT 
===
 +
 +# Your platform. See PLATS for possible values.
- PLAT= none
++PLAT= guess
 +
 +# Where to install. The installation starts in the src and doc directories,
 +# so take care if INSTALL_TOP is not an absolute path. See the local target.
 +# You may want to make INSTALL_LMOD and INSTALL_CMOD consistent with
 +# LUA_ROOT, LUA_LDIR, and LUA_CDIR in luaconf.h.
 +INSTALL_TOP= /usr/local
 +INSTALL_BIN= $(INSTALL_TOP)/bin
 +INSTALL_INC= $(INSTALL_TOP)/include
 +INSTALL_LIB= $(INSTALL_TOP)/lib
 +INSTALL_MAN= $(INSTALL_TOP)/man/man1
 +INSTALL_LMOD= $(INSTALL_TOP)/share/lua/$V
 +INSTALL_CMOD= $(INSTALL_TOP)/lib/lua/$V
 +
 +# How to install. If your install program does not support "-p", then
 +# you may have to run ranlib on the installed liblua.a.
 +INSTALL= install -p
 +INSTALL_EXEC= $(INSTALL) -m 0755
 +INSTALL_DATA= $(INSTALL) -m 0644
 +#
 +# If you don't have "install" you can use "cp" instead.
 +# INSTALL= cp -p

git: 06b9b3e0ad0d - main - Merge bmake-20210110

2021-01-13 Thread Simon J. Gerraty
The branch main has been updated by sjg:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=06b9b3e0ad0dc3f0166b3e8f26ced68c271cf527

commit 06b9b3e0ad0dc3f0166b3e8f26ced68c271cf527
Merge: 0495ed398c4f 8e11a9b4250b
Author: Simon J. Gerraty 
AuthorDate: 2021-01-14 06:21:37 +
Commit: Simon J. Gerraty 
CommitDate: 2021-01-14 06:21:37 +

Merge bmake-20210110

Quite a lot of churn on style, but lots of
good work refactoring complicated functions
and lots more unit-tests.
Thanks mostly to rillig at NetBSD

Some interesting entries from ChangeLog

o .MAKE.{UID,GID} represent uid and gid running make.

o allow env var MAKE_OBJDIR_CHECK_WRITABLE=no to skip writable
  checks in InitObjdir.  Explicit .OBJDIR target always allows
  read-only directory.

o add more unit tests for META MODE

Merge commit '8e11a9b4250be3c3379c45fa820bff78d99d5946' into main

Change-Id: I464fd4c013067f0915671c1ccc96d2d8090b2b9c

 contrib/bmake/ChangeLog|  241 +-
 contrib/bmake/FILES|   64 +-
 contrib/bmake/LICENSE  |4 +-
 contrib/bmake/PSD.doc/tutorial.ms  |   10 +-
 contrib/bmake/VERSION  |2 +-
 contrib/bmake/arch.c   | 1323 ++---
 contrib/bmake/bmake.1  |   18 +-
 contrib/bmake/bmake.cat1   |  248 +-
 contrib/bmake/buf.c|  139 +-
 contrib/bmake/buf.h|   28 +-
 contrib/bmake/compat.c |  932 +--
 contrib/bmake/cond.c   | 1611 +++---
 contrib/bmake/dir.c| 2047 ---
 contrib/bmake/dir.h|   36 +-
 contrib/bmake/enum.c   |   11 +-
 contrib/bmake/enum.h   |   69 +-
 contrib/bmake/filemon/filemon.h|6 +-
 contrib/bmake/filemon/filemon_dev.c|6 +-
 contrib/bmake/filemon/filemon_ktrace.c |   79 +-
 contrib/bmake/for.c|  633 +-
 contrib/bmake/hash.c   |   41 +-
 contrib/bmake/hash.h   |   72 +-
 contrib/bmake/import.sh|   87 +
 contrib/bmake/job.c| 3893 +++--
 contrib/bmake/job.h|   84 +-
 contrib/bmake/lst.c|  304 +-
 contrib/bmake/lst.h|   88 +-
 contrib/bmake/main.c   |  364 +-
 contrib/bmake/make-conf.h  |   20 +-
 contrib/bmake/make.1   |   18 +-
 contrib/bmake/make.c   | 1825 +++---
 contrib/bmake/make.h   |  812 +--
 contrib/bmake/make_malloc.c|7 +-
 contrib/bmake/make_malloc.h|   12 +-
 contrib/bmake/meta.c   |  359 +-
 contrib/bmake/meta.h   |4 +-
 contrib/bmake/metachar.h   |4 +-
 contrib/bmake/mk/ChangeLog |   39 +
 contrib/bmake/mk/dirdeps-options.mk|5 +-
 contrib/bmake/mk/dirdeps-targets.mk|7 +-
 contrib/bmake/mk/dirdeps.mk|   25 +-
 contrib/bmake/mk/init.mk   |   17 +-
 contrib/bmake/mk/install-mk|4 +-
 contrib/bmake/mk/meta.subdir.mk|4 +-
 contrib/bmake/mk/mkopt.sh  |0
 contrib/bmake/mk/own.mk|6 +-
 contrib/bmake/mk/sys.mk|6 +-
 contrib/bmake/nonints.h|  278 +-
 contrib/bmake/os.sh|0
 contrib/bmake/parse.c  | 4058 ++---
 contrib/bmake/pathnames.h  |   15 +-
 contrib/bmake/str.c|   15 +-
 contrib/bmake/suff.c   | 2897 +-
 contrib/bmake/targ.c   |  568 +-
 contrib/bmake/trace.c  |   16 +-
 contrib/bmake/trace.h  |6 +-
 contrib/bmake/unit-tests/Makefile  |  159 +-
 contrib/bmake/unit-tests/cmd-errors-jobs.exp   |9 +
 contrib/bmake/unit-tests/cmd-errors-jobs.mk|   32 +
 contrib/bmake/unit-tests/cmd-errors.mk |4 +-
 contrib/bmake/unit-tests/cmdline.mk|2 +-
 contrib/bmake/unit-tests/compat-error.exp  |   15 +
 contrib/bmake/unit-tests/compat-error.mk   |   37 +
 contrib/bmake/unit-tests/cond-eof.exp  |  

git: 03774659d1f2 - main - tools: git hooks: drop "submitted by" from commit template

2021-01-13 Thread Kyle Evans
The branch main has been updated by kevans:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=03774659d1f24d47ce00e165048a253263028cff

commit 03774659d1f24d47ce00e165048a253263028cff
Author: Kyle Evans 
AuthorDate: 2021-01-14 06:33:07 +
Commit: Kyle Evans 
CommitDate: 2021-01-14 06:33:07 +

tools: git hooks: drop "submitted by" from commit template

With the switch to git, we should strive to properly attribute every
commit appropriately with the metadata that's provided to do so. In this
case, the submitter should be recorded via the author metadata.  Committing
an arbitrary patch, one can set it as such:

git commit --author="John Smith "

Reviewed-by:emaste
Differential-Revision:  https://reviews.freebsd.org/D28069
---
 tools/tools/git/hooks/prepare-commit-msg | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/tools/git/hooks/prepare-commit-msg 
b/tools/tools/git/hooks/prepare-commit-msg
index 51b92a10724d..0ebec48fd9a5 100755
--- a/tools/tools/git/hooks/prepare-commit-msg
+++ b/tools/tools/git/hooks/prepare-commit-msg
@@ -43,7 +43,6 @@ $(awk '1;/^#$/{exit}' $1)
 # Uncomment and complete these metadata fields, as appropriate:
 # 
 # PR:  
-# Submitted by:
 # Reported by: 
 # Reviewed by: 
 # Approved by: 
@@ -57,7 +56,8 @@ $(awk '1;/^#$/{exit}' $1)
 # Differential Revision:   
 #
 # "Pull Request" and "Differential Revision" require the *full* GitHub or
-# Phabricator URL.
+# Phabricator URL.  The commit author should be set appropriately, using
+# \`git commit --author\` if someone besides the committer sent in the change.
 $(awk '/^#$/,EOF' "$1")
 EOF
 
___
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"


git: 9a01a2551636 - main - unifdef -D__FreeBSD__ to remove the OpenBSD support

2021-01-13 Thread David E. O'Brien
The branch main has been updated by obrien:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=9a01a25516367d1deeb48484d38a66137b01ebb0

commit 9a01a25516367d1deeb48484d38a66137b01ebb0
Author: David E. O'Brien 
AuthorDate: 2021-01-14 04:45:54 +
Commit: David E. O'Brien 
CommitDate: 2021-01-14 06:35:22 +

unifdef -D__FreeBSD__ to remove the OpenBSD support

OpenBSD never accepted this driver, and instead wrote their
own minimal one (sys/dev/acpi/tpm.c for suspending the device).

Reviewed by:stevek, emaste
Differential Revision:  D10321
---
 sys/dev/tpm/tpm.c | 199 --
 1 file changed, 199 deletions(-)

diff --git a/sys/dev/tpm/tpm.c b/sys/dev/tpm/tpm.c
index a458804d0ac9..21d68012aded 100644
--- a/sys/dev/tpm/tpm.c
+++ b/sys/dev/tpm/tpm.c
@@ -27,7 +27,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#ifdef __FreeBSD__
 #include 
 #include 
 #include 
@@ -41,24 +40,8 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
-#else
-#include 
-
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#include 
-#endif
 #include 
 
-#ifndef __FreeBSD__
-/* XXX horrible hack for tcsd (-lpthread) workaround on OpenBSD */
-#undef PCATCH
-#define PCATCH 0
-#endif
 
 #defineTPM_BUFSIZ  1024
 
@@ -66,9 +49,7 @@ __FBSDID("$FreeBSD$");
 
 #define TPM_PARAM_SIZE 0x0001
 
-#ifdef __FreeBSD__
 #define IRQUNK -1
-#endif
 
 #defineTPM_ACCESS  0x  /* access register */
 #defineTPM_ACCESS_ESTABLISHMENT0x01/* establishment */
@@ -146,7 +127,6 @@ __FBSDID("$FreeBSD$");
 /* Set when enabling legacy interface in host bridge. */
 int tpm_enabled;
 
-#ifdef __FreeBSD__
 #defineTPMSOFTC(dev) \
((struct tpm_softc *)dev->si_drv1)
 
@@ -166,21 +146,6 @@ static struct cdevsw tpm_cdevsw = {
.d_ioctl =  tpmioctl,
.d_name =   "tpm",
 };
-#else
-#defineTPMSOFTC(dev) \
-(struct tpm_softc *)device_lookup(&tpm_cd, minor(dev))
-
-struct cfdriver tpm_cd = {
-   NULL, "tpm", DV_DULL
-};
-
-inttpm_match(device_t , void *, void *);
-void   tpm_attach(device_t , device_t , void *);
-
-struct cfattach tpm_ca = {
-   sizeof(struct tpm_softc), tpm_match, tpm_attach
-};
-#endif
 
 const struct {
u_int32_t devid;
@@ -206,14 +171,7 @@ int tpm_tis12_read(struct tpm_softc *, void *, int, size_t 
*, int);
 int tpm_tis12_write(struct tpm_softc *, void *, int);
 int tpm_tis12_end(struct tpm_softc *, int, int);
 
-#ifdef __FreeBSD__
 void tpm_intr(void *);
-#else
-int tpm_intr(void *);
-void tpm_powerhook(int, void *);
-int tpm_suspend(struct tpm_softc *, int);
-int tpm_resume(struct tpm_softc *, int);
-#endif
 
 int tpm_waitfor_poll(struct tpm_softc *, u_int8_t, int, void *);
 int tpm_waitfor_int(struct tpm_softc *, u_int8_t, int, void *, int);
@@ -230,7 +188,6 @@ int tpm_legacy_read(struct tpm_softc *, void *, int, size_t 
*, int);
 int tpm_legacy_write(struct tpm_softc *, void *, int);
 int tpm_legacy_end(struct tpm_softc *, int, int);
 
-#ifdef __FreeBSD__
 
 /*
  * FreeBSD specific code for probing and attaching TPM to device tree.
@@ -329,100 +286,6 @@ tpm_detach(device_t dev)
return 0;
 }
 
-#else
-/*
- * OpenBSD specific code for probing and attaching TPM to device tree.
- */
-int
-tpm_match(device_t parent, void *match, void *aux)
-{
-   struct isa_attach_args *ia = aux;
-   struct cfdata *cf = match;
-   bus_space_tag_t bt = ia->ia_memt;
-   bus_space_handle_t bh;
-   int rv;
-
-   /* There can be only one. */
-   if (cf->cf_unit)
-   return 0;
-
-   if (tpm_legacy_probe(ia->ia_iot, ia->ia_iobase)) {
-   ia->ia_iosize = 2;
-   return 1;
-   }
-
-   if (ia->ia_maddr == -1)
-   return 0;
-
-   if (bus_space_map(bt, ia->ia_maddr, TPM_SIZE, 0, &bh))
-   return 0;
-
-   if ((rv = tpm_tis12_probe(bt, bh))) {
-   ia->ia_iosize = 0;
-   ia->ia_msize = TPM_SIZE;
-   }
-
-   bus_space_unmap(bt, bh, TPM_SIZE);
-   return rv;
-}
-
-void
-tpm_attach(device_t parent, device_t self, void *aux)
-{
-   struct tpm_softc *sc = (struct tpm_softc *)self;
-   struct isa_attach_args *ia = aux;
-   bus_addr_t iobase;
-   bus_size_t size;
-   int rv;
-
-   if (tpm_legacy_probe(ia->ia_iot, ia->ia_iobase)) {
-   sc->sc_bt = ia->ia_iot;
-   iobase = ia->ia_iobase;
-   size = ia->ia_iosize;
-   sc->sc_batm = ia->ia_iot;
-   sc->sc_init = tpm_legacy_init;
-   sc->sc_start = tpm_legacy_start;
-   sc->sc_read = tpm_legacy_read;
-   sc->sc_write = tpm_legacy_write;
-   sc->sc_end = tpm_legacy_end;
-   } else {
-   sc->sc_bt = ia->ia_memt;
-   iobase = ia->ia_maddr;
-   size = TPM_SIZE;
-   sc->sc_init = tpm_tis12_init;
-

git: 986deea5b518 - main - build: `make check`: use a PATH search instead for Kyua

2021-01-13 Thread Kyle Evans
The branch main has been updated by kevans:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=986deea5b518ee5bf6b8b1486056a21819bd8bd2

commit 986deea5b518ee5bf6b8b1486056a21819bd8bd2
Author: Kyle Evans 
AuthorDate: 2021-01-14 06:34:29 +
Commit: Kyle Evans 
CommitDate: 2021-01-14 06:37:48 +

build: `make check`: use a PATH search instead for Kyua

which(1) accepts both relative/absolute paths as well as lone binary
names.  Set KYUA to kyua and use which(1) to confirm that it can find one;
if it cannot, just advise the user to set KYUA directly to the kyua binary
rather than assuming a relative location from LOCALBASE.

This allows `make check` to be operated with the version of kyua in base
without losing the flexibility of specifying another one.

ngie@ notes that the original intention was to avoid redundant $PATH lookups
and improve the determinism of the target. A future change will likely push
us back to this state, perhaps in the form of reverting this entirely and
just switching to using kyua in base. Accepting any in $PATH should be
considered a transitional move, at least until it's declared otherwise,
since kyua was only semi-recently added to base.

Reviewed-by:brooks, emaste, lwhsu, ngie
Differential-Revision:  https://reviews.freebsd.org/D28045
---
 share/mk/suite.test.mk | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/share/mk/suite.test.mk b/share/mk/suite.test.mk
index 69cd02d684de..e772ccd1b292 100644
--- a/share/mk/suite.test.mk
+++ b/share/mk/suite.test.mk
@@ -77,7 +77,7 @@ Kyuafile: Makefile
@mv ${.TARGET}.tmp ${.TARGET}
 .endif
 
-KYUA= ${LOCALBASE}/bin/kyua
+KYUA?= kyua
 
 # Definition of the "make check" target and supporting variables.
 #
@@ -90,13 +90,13 @@ KYUA= ${LOCALBASE}/bin/kyua
 # report bogus results unless the new binaries are put in place.
 
 realcheck: .PHONY
-   @if [ ! -x ${KYUA} ]; then \
+   if ! which -s "${KYUA}"; then \
echo; \
echo "kyua binary not installed at expected location 
(${.TARGET})"; \
echo; \
echo "Please install via pkg install, or specify the path to 
the kyua"; \
-   echo "package via the \$${LOCALBASE} variable, e.g. "; \
-   echo "LOCALBASE=\"${LOCALBASE}\""; \
+   echo "binary via the \$${KYUA} variable, e.g., "; \
+   echo "KYUA=\"${LOCALBASE}/bin/kyua\""; \
false; \
fi
@env ${TESTS_ENV:Q} ${KYUA} test -k ${DESTDIR}${TESTSDIR}/Kyuafile
___
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"


git: bd72252aace3 - main - [mips] revert r366664 - flip mips back from -O2 to -O

2021-01-13 Thread Adrian Chadd
The branch main has been updated by adrian:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=bd72252aace382921840ddbceea712b96f4ad242

commit bd72252aace382921840ddbceea712b96f4ad242
Author: Adrian Chadd 
AuthorDate: 2021-01-12 21:13:20 +
Commit: Adrian Chadd 
CommitDate: 2021-01-14 07:03:53 +

[mips] revert r34 - flip mips back from -O2 to -O

Now that I have -head fitting in 8MB of flash again, I can test
out freebsd-head on my home AP test setup.  Unfortunately,
the introduction of -O2 in r34 causes the following infinite
loop shortly after boot:

--

MAP: No valid partition found at map/rootfs.uzip
Warning: no time-of-day clock registered, system time will not be set 
accurately
start_init: trying /sbin/init
BAD_PAGE_FAULT: pid 1 tid 11 (init), uid 0: pc 0x4042c320 got a read 
fault (type 0x2) at 0x2e3a0
Trapframe Register Dump:
zero: 0 at: 0   v0: 0   v1: 0
a0: 0x1af34 a1: 0   a2: 0   a3: 0x7fffeff0
t0: 0   t1: 0   t2: 0   t3: 0
t4: 0   t5: 0   t6: 0   t7: 0
t8: 0   t9: 0x152e8 s0: 0x7fffee84  s1: 0
s2: 0   s3: 0   s4: 0   s5: 0
s6: 0   s7: 0   k0: 0   k1: 0
gp: 0x362c0 sp: 0x7fffedf0  s8: 0   ra: 0x40417df0
sr: 0xf413  mullo: 0mulhi: 0badvaddr: 0x2e3a0
cause: 0x8008   pc: 0x4042c31c
Page table info for pc address 0x4042c320: pde = 0x80712000, pte = 
0xa002065a
Dumping 4 words starting at pc address 0x4042c320:
8f9980e0 8082 10400067 00809825
Page table info for bad address 0x2e3a0: pde = 0, pte = 0

--

I'm not yet sure why, but until I figure it out with the mips64/cheri
folk this should be reverted.

This should only use -O on GCC generated code for MIPS platforms.

Tested:

* QCA934x (mips74k) - WDR-3600/WDR-4300 APs

Differential Revision: https://reviews.freebsd.org/D28122
---
 share/mk/sys.mk | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/share/mk/sys.mk b/share/mk/sys.mk
index 8f456b28593a..72f458397683 100644
--- a/share/mk/sys.mk
+++ b/share/mk/sys.mk
@@ -166,7 +166,14 @@ CC ?=  c89
 CFLAGS ?=  -O
 .else
 CC ?=  cc
+.if ${MACHINE_CPUARCH} == "mips" && ${COMPILER_TYPE} == "gcc"
+# Note: there are currently issues generating code gcc-6.x targeting
+# code for at least mips32.  The system hits infinite page faults
+# when starting /sbin/init if -O2 is used.
+CFLAGS ?=  -O -pipe
+.else
 CFLAGS ?=  -O2 -pipe
+.endif
 .if defined(NO_STRICT_ALIASING)
 CFLAGS +=  -fno-strict-aliasing
 .endif
___
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"