Re: svn commit: r353533 - in head/sys: arm64/conf conf dev/usb/controller

2019-10-15 Thread Hans Petter Selasky

On 2019-10-15 00:27, Emmanuel Vadot wrote:

+#defineDWC3_GTXFIFOSIZ(x)  (0xc300 + 0x4 * x)
+#defineDWC3_GRXFIFOSIZ(x)  (0xc380 + 0x4 * x)


Use a pair of ()'s around arguments:

#define DWC3_GRXFIFOSIZ(x)  (0xc380 + 0x4 * (x))

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


svn commit: r353544 - head/stand/efi/boot1

2019-10-15 Thread Toomas Soome
Author: tsoome
Date: Tue Oct 15 08:33:05 2019
New Revision: 353544
URL: https://svnweb.freebsd.org/changeset/base/353544

Log:
  boot1.efi: provide generic exit() and stub getchar()
  
  panic() is expecting us to have exit and getchar, lets provide those.

Modified:
  head/stand/efi/boot1/boot1.c

Modified: head/stand/efi/boot1/boot1.c
==
--- head/stand/efi/boot1/boot1.cTue Oct 15 06:19:33 2019
(r353543)
+++ head/stand/efi/boot1/boot1.cTue Oct 15 08:33:05 2019
(r353544)
@@ -293,6 +293,18 @@ add_device(dev_info_t **devinfop, dev_info_t *devinfo)
dev->next = devinfo;
 }
 
+void
+efi_exit(EFI_STATUS s)
+{
+   BS->Exit(IH, s, 0, NULL);
+}
+
+void
+exit(int error __unused)
+{
+   efi_exit(EFI_LOAD_ERROR);
+}
+
 /*
  * OK. We totally give up. Exit back to EFI with a sensible status so
  * it can try the next option on the list.
@@ -308,7 +320,12 @@ efi_panic(EFI_STATUS s, const char *fmt, ...)
va_end(ap);
printf("\n");
 
-   BS->Exit(IH, s, 0, NULL);
+   efi_exit(s);
+}
+
+int getchar(void)
+{
+   return (-1);
 }
 
 void
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r353545 - head/sbin/ipfw

2019-10-15 Thread Andrey V. Elsukov
Author: ae
Date: Tue Oct 15 09:50:02 2019
New Revision: 353545
URL: https://svnweb.freebsd.org/changeset/base/353545

Log:
  Explicitly initialize the memory buffer to store O_ICMP6TYPE opcode.
  
  By default next_cmd() initializes only first u32 of opcode. O_ICMP6TYPE
  opcode has array of bit masks to store corresponding ICMPv6 types.
  An opcode that precedes O_ICMP6TYPE, e.g. O_IP6_DST, can have variable
  length and during opcode filling it can modify memory that will be used
  by O_ICMP6TYPE opcode. Without explicit initialization this leads to
  creation of wrong opcode.
  
  Reported by:  Boris N. Lytochkin
  Obtained from:Yandex LLC
  MFC after:3 days

Modified:
  head/sbin/ipfw/ipv6.c

Modified: head/sbin/ipfw/ipv6.c
==
--- head/sbin/ipfw/ipv6.c   Tue Oct 15 08:33:05 2019(r353544)
+++ head/sbin/ipfw/ipv6.c   Tue Oct 15 09:50:02 2019(r353545)
@@ -143,6 +143,7 @@ fill_icmp6types(ipfw_insn_icmp6 *cmd, char *av, int cb
uint8_t type;
 
CHECK_LENGTH(cblen, F_INSN_SIZE(ipfw_insn_icmp6));
+   memset(cmd, 0, sizeof(*cmd));
while (*av) {
   if (*av == ',')
   av++;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r353480 - in head/sys: net netinet sys

2019-10-15 Thread Andrey V. Elsukov
On 13.10.2019 21:17, Michael Tuexen wrote:
> Author: tuexen
> Date: Sun Oct 13 18:17:08 2019
> New Revision: 353480
> URL: https://svnweb.freebsd.org/changeset/base/353480
> 
> Log:
>   Use an event handler to notify the SCTP about IP address changes
>   instead of calling an SCTP specific function from the IP code.
>   This is a requirement of supporting SCTP as a kernel loadable module.
>   This patch was developed by markj@, I tweaked a bit the SCTP related
>   code.
> Modified: head/sys/sys/eventhandler.h
> ==
> --- head/sys/sys/eventhandler.h   Sun Oct 13 18:03:23 2019
> (r353479)
> +++ head/sys/sys/eventhandler.h   Sun Oct 13 18:17:08 2019
> (r353480)
> @@ -312,4 +312,9 @@ typedef void (*device_detach_fn)(void *, device_t, enu
>  EVENTHANDLER_DECLARE(device_attach, device_attach_fn);
>  EVENTHANDLER_DECLARE(device_detach, device_detach_fn);
>  
> +/* Interface address addition and removal event */
> +struct ifaddr;
> +typedef void (*rt_addrmsg_fn)(void *, struct ifaddr *, int);
> +EVENTHANDLER_DECLARE(rt_addrmsg, rt_addrmsg_fn);
> +
>  #endif /* _SYS_EVENTHANDLER_H_ */

Hi,

it looks like duplicate functional of ifaddr_event_ext event handler.

-- 
WBR, Andrey V. Elsukov



signature.asc
Description: OpenPGP digital signature


svn commit: r353546 - head/sys/ofed/drivers/infiniband/ulp/ipoib

2019-10-15 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Oct 15 11:11:21 2019
New Revision: 353546
URL: https://svnweb.freebsd.org/changeset/base/353546

Log:
  Fix missing epochification of the ipoib code after r353292.
  
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c
  head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c
  head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_multicast.c

Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c
==
--- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c   Tue Oct 15 
09:50:02 2019(r353545)
+++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c   Tue Oct 15 
11:11:21 2019(r353546)
@@ -845,6 +845,7 @@ static int ipoib_cm_rep_handler(struct ib_cm_id *cm_id
struct ipoib_cm_tx *p = cm_id->context;
struct ipoib_dev_priv *priv = p->priv;
struct ipoib_cm_data *data = event->private_data;
+   struct epoch_tracker et;
struct ifqueue mbqueue;
struct ib_qp_attr qp_attr;
int qp_attr_mask, ret;
@@ -898,6 +899,7 @@ static int ipoib_cm_rep_handler(struct ib_cm_id *cm_id
}
spin_unlock_irq(&priv->lock);
 
+   NET_EPOCH_ENTER(et);
for (;;) {
struct ifnet *dev = p->priv->dev;
_IF_DEQUEUE(&mbqueue, mb);
@@ -908,6 +910,7 @@ static int ipoib_cm_rep_handler(struct ib_cm_id *cm_id
ipoib_warn(priv, "dev_queue_xmit failed "
   "to requeue packet\n");
}
+   NET_EPOCH_EXIT(et);
 
ret = ib_send_cm_rtu(cm_id, NULL, 0);
if (ret) {

Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c
==
--- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Tue Oct 15 
09:50:02 2019(r353545)
+++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Tue Oct 15 
11:11:21 2019(r353546)
@@ -555,6 +555,7 @@ path_rec_completion(int status, struct ib_sa_path_rec 
struct ifnet *dev = priv->dev;
struct ipoib_ah *ah = NULL;
struct ipoib_ah *old_ah = NULL;
+   struct epoch_tracker et;
struct ifqueue mbqueue;
struct mbuf *mb;
unsigned long flags;
@@ -609,6 +610,7 @@ path_rec_completion(int status, struct ib_sa_path_rec 
if (old_ah)
ipoib_put_ah(old_ah);
 
+   NET_EPOCH_ENTER(et);
for (;;) {
_IF_DEQUEUE(&mbqueue, mb);
if (mb == NULL)
@@ -618,6 +620,7 @@ path_rec_completion(int status, struct ib_sa_path_rec 
ipoib_warn(priv, "dev_queue_xmit failed "
   "to requeue packet\n");
}
+   NET_EPOCH_EXIT(et);
 }
 
 static struct ipoib_path *
@@ -1482,6 +1485,8 @@ ipoib_output(struct ifnet *ifp, struct mbuf *m,
struct ipoib_header *eh;
int error = 0, is_gw = 0;
short type;
+
+   NET_EPOCH_ASSERT();
 
if (ro != NULL)
is_gw = (ro->ro_flags & RT_HAS_GW) != 0;

Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
==
--- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_multicast.cTue Oct 
15 09:50:02 2019(r353545)
+++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_multicast.cTue Oct 
15 11:11:21 2019(r353546)
@@ -157,6 +157,7 @@ static int ipoib_mcast_join_finish(struct ipoib_mcast 
struct ipoib_dev_priv *priv = mcast->priv;
struct ifnet *dev = priv->dev;
struct ipoib_ah *ah;
+   struct epoch_tracker et;
int ret;
int set_qkey = 0;
 
@@ -227,6 +228,8 @@ static int ipoib_mcast_join_finish(struct ipoib_mcast 
}
}
 
+   NET_EPOCH_ENTER(et);
+
/* actually send any queued packets */
while (mcast->pkt_queue.ifq_len) {
struct mbuf *mb;
@@ -237,6 +240,7 @@ static int ipoib_mcast_join_finish(struct ipoib_mcast 
ipoib_warn(priv, "dev_queue_xmit failed to requeue 
packet\n");
}
 
+   NET_EPOCH_EXIT(et);
return 0;
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r353547 - head/sys/ofed/drivers/infiniband/core

2019-10-15 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Oct 15 11:12:31 2019
New Revision: 353547
URL: https://svnweb.freebsd.org/changeset/base/353547

Log:
  Fix missing epochification of the ibcore code after r353292.
  
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/ofed/drivers/infiniband/core/ib_addr.c

Modified: head/sys/ofed/drivers/infiniband/core/ib_addr.c
==
--- head/sys/ofed/drivers/infiniband/core/ib_addr.c Tue Oct 15 11:11:21 
2019(r353546)
+++ head/sys/ofed/drivers/infiniband/core/ib_addr.c Tue Oct 15 11:12:31 
2019(r353547)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 2005 Voltaire Inc.  All rights reserved.
  * Copyright (c) 2002-2005, Network Appliance, Inc. All rights reserved.
- * Copyright (c) 1999-2005, Mellanox Technologies, Inc. All rights reserved.
+ * Copyright (c) 1999-2019, Mellanox Technologies, Inc. All rights reserved.
  * Copyright (c) 2005 Intel Corporation.  All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -676,6 +676,7 @@ static int addr_resolve(struct sockaddr *src_in,
const struct sockaddr *dst_in,
struct rdma_dev_addr *addr)
 {
+   struct epoch_tracker et;
struct net_device *ndev = NULL;
u8 edst[MAX_ADDR_LEN];
int ret;
@@ -683,6 +684,7 @@ static int addr_resolve(struct sockaddr *src_in,
if (dst_in->sa_family != src_in->sa_family)
return -EINVAL;
 
+   NET_EPOCH_ENTER(et);
switch (src_in->sa_family) {
case AF_INET:
ret = addr4_resolve((struct sockaddr_in *)src_in,
@@ -698,6 +700,7 @@ static int addr_resolve(struct sockaddr *src_in,
ret = -EADDRNOTAVAIL;
break;
}
+   NET_EPOCH_EXIT(et);
 
/* check for error */
if (ret != 0)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r353548 - head/sys/compat/linuxkpi/common/include/linux

2019-10-15 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Oct 15 11:14:14 2019
New Revision: 353548
URL: https://svnweb.freebsd.org/changeset/base/353548

Log:
  Fix missing epochification of the LinuxKPI after r353292.
  
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/netdevice.h

Modified: head/sys/compat/linuxkpi/common/include/linux/netdevice.h
==
--- head/sys/compat/linuxkpi/common/include/linux/netdevice.h   Tue Oct 15 
11:12:31 2019(r353547)
+++ head/sys/compat/linuxkpi/common/include/linux/netdevice.h   Tue Oct 15 
11:14:14 2019(r353548)
@@ -2,7 +2,7 @@
  * Copyright (c) 2010 Isilon Systems, Inc.
  * Copyright (c) 2010 iX Systems, Inc.
  * Copyright (c) 2010 Panasas, Inc.
- * Copyright (c) 2013-2017 Mellanox Technologies, Ltd.
+ * Copyright (c) 2013-2019 Mellanox Technologies, Ltd.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -60,11 +60,14 @@
 static inline struct ifnet *
 dev_get_by_index(struct vnet *vnet, int if_index)
 {
+   struct epoch_tracker et;
struct ifnet *retval;
 
+   NET_EPOCH_ENTER(et);
CURVNET_SET(vnet);
retval = ifnet_byindex_ref(if_index);
CURVNET_RESTORE();
+   NET_EPOCH_EXIT(et);
 
return (retval);
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r353549 - head/sys/net

2019-10-15 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Oct 15 11:20:16 2019
New Revision: 353549
URL: https://svnweb.freebsd.org/changeset/base/353549

Log:
  Exclude the network link eventhandler from epochification after r353292.
  
  This fixes the following assert when "options RATELIMIT" is used:
  panic()
  malloc()
  sysctl_add_oid()
  tcp_rl_ifnet_link()
  do_link_state_change()
  taskqueue_run_locked()
  
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/net/if.c

Modified: head/sys/net/if.c
==
--- head/sys/net/if.c   Tue Oct 15 11:14:14 2019(r353548)
+++ head/sys/net/if.c   Tue Oct 15 11:20:16 2019(r353549)
@@ -2353,9 +2353,9 @@ do_link_state_change(void *arg, int pending)
if (log_link_state_change)
if_printf(ifp, "link state changed to %s\n",
(link_state == LINK_STATE_UP) ? "UP" : "DOWN" );
+   NET_EPOCH_EXIT(et);
EVENTHANDLER_INVOKE(ifnet_link_event, ifp, link_state);
CURVNET_RESTORE();
-   NET_EPOCH_EXIT(et);
 }
 
 /*
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r353550 - head/sys/net

2019-10-15 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Oct 15 12:08:09 2019
New Revision: 353550
URL: https://svnweb.freebsd.org/changeset/base/353550

Log:
  The two functions ifnet_byindex() and ifnet_byindex_locked() are exactly the
  same after the network stack was epochified. Merge the two into one function
  and cleanup all uses of ifnet_byindex_locked().
  
  While at it:
  - Add branch prediction macros.
  - Make sure the ifnet pointer is only deferred once,
also when code optimisation is disabled.
  
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/net/if.c
  head/sys/net/if_var.h
  head/sys/net/route.c

Modified: head/sys/net/if.c
==
--- head/sys/net/if.c   Tue Oct 15 11:20:16 2019(r353549)
+++ head/sys/net/if.c   Tue Oct 15 12:08:09 2019(r353550)
@@ -329,23 +329,15 @@ MALLOC_DEFINE(M_IFADDR, "ifaddr", "interface address")
 MALLOC_DEFINE(M_IFMADDR, "ether_multi", "link-level multicast address");
 
 struct ifnet *
-ifnet_byindex_locked(u_short idx)
-{
-
-   if (idx > V_if_index)
-   return (NULL);
-   if (V_ifindex_table[idx] == IFNET_HOLD)
-   return (NULL);
-   return (V_ifindex_table[idx]);
-}
-
-struct ifnet *
 ifnet_byindex(u_short idx)
 {
struct ifnet *ifp;
 
-   ifp = ifnet_byindex_locked(idx);
-   return (ifp);
+   if (__predict_false(idx > V_if_index))
+   return (NULL);
+
+   ifp = *(struct ifnet * const volatile *)(V_ifindex_table + idx);
+   return (__predict_false(ifp == IFNET_HOLD) ? NULL : ifp);
 }
 
 struct ifnet *
@@ -355,7 +347,7 @@ ifnet_byindex_ref(u_short idx)
 
NET_EPOCH_ASSERT();
 
-   ifp = ifnet_byindex_locked(idx);
+   ifp = ifnet_byindex(idx);
if (ifp == NULL || (ifp->if_flags & IFF_DYING))
return (NULL);
if_ref(ifp);
@@ -427,7 +419,7 @@ ifaddr_byindex(u_short idx)
 
NET_EPOCH_ASSERT();
 
-   ifp = ifnet_byindex_locked(idx);
+   ifp = ifnet_byindex(idx);
if (ifp != NULL && (ifa = ifp->if_addr) != NULL)
ifa_ref(ifa);
return (ifa);
@@ -653,7 +645,7 @@ if_free(struct ifnet *ifp)
 
CURVNET_SET_QUIET(ifp->if_vnet);
IFNET_WLOCK();
-   KASSERT(ifp == ifnet_byindex_locked(ifp->if_index),
+   KASSERT(ifp == ifnet_byindex(ifp->if_index),
("%s: freeing unallocated ifnet", ifp->if_xname));
 
ifindex_free_locked(ifp->if_index);

Modified: head/sys/net/if_var.h
==
--- head/sys/net/if_var.h   Tue Oct 15 11:20:16 2019(r353549)
+++ head/sys/net/if_var.h   Tue Oct 15 12:08:09 2019(r353550)
@@ -629,7 +629,6 @@ extern  struct sx ifnet_sxlock;
  * to call ifnet_byindex() instead of ifnet_byindex_ref().
  */
 struct ifnet   *ifnet_byindex(u_short idx);
-struct ifnet   *ifnet_byindex_locked(u_short idx);
 struct ifnet   *ifnet_byindex_ref(u_short idx);
 
 /*

Modified: head/sys/net/route.c
==
--- head/sys/net/route.cTue Oct 15 11:20:16 2019(r353549)
+++ head/sys/net/route.cTue Oct 15 12:08:09 2019(r353550)
@@ -1293,7 +1293,7 @@ rt_getifa_fib(struct rt_addrinfo *info, u_int fibnum)
ifpaddr->sa_family == AF_LINK) {
const struct sockaddr_dl *sdl = (const struct sockaddr_dl *)ifpaddr;
if (sdl->sdl_index != 0)
-   info->rti_ifp = ifnet_byindex_locked(sdl->sdl_index);
+   info->rti_ifp = ifnet_byindex(sdl->sdl_index);
}
/*
 * If we have source address specified, try to find it
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r353556 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2019-10-15 Thread Andriy Gapon
Author: avg
Date: Tue Oct 15 14:20:11 2019
New Revision: 353556
URL: https://svnweb.freebsd.org/changeset/base/353556

Log:
  MFV r353551: 10452 ZoL: merge in large dnode feature fixes
  
  illumos/illumos-gate@946342a260bbae359b48bf142ec1fe40792ee862
  
https://github.com/illumos/illumos-gate/commit/946342a260bbae359b48bf142ec1fe40792ee862
  
  https://www.illumos.org/issues/10452
illumos is missing a few small follow up ZoL bug fixes for the large dnode
feature. We should pull those in.
Those commits are in the ZoL tree as (newest to oldest):
PR 8435 - 75d6b7ddca269542279975f716a343bb40a79baf - Add missing copyright
notice to large_dnode tests
PR 7433 - e14a32b1c844d924b9f093375c0badcf10f61741 - Fix object reclaim when
using large dnodes
PR 6616 - 48fbb9ddbf2281911560dfbc2821aa8b74127315 - Free objects when
receiving full stream as clone
PR 6695 - 39f56627ae988d09b4e3803c01c22b2026b2310e - receive_freeobjects()
skips freeing some object
  
  Portions contributed by: Ned Bass 
  Portions contributed by: Tom Caputi 
  Author: Fabian Grünbichler 
  Obtained from:illumos, ZoL
  MFC after:2 weeks
  X-MFC with:   r353176

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.cTue Oct 
15 14:19:44 2019(r353555)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.cTue Oct 
15 14:20:11 2019(r353556)
@@ -267,7 +267,7 @@ dmu_object_reclaim(objset_t *os, uint64_t object, dmu_
 int blocksize, dmu_object_type_t bonustype, int bonuslen, dmu_tx_t *tx)
 {
return (dmu_object_reclaim_dnsize(os, object, ot, blocksize, bonustype,
-   bonuslen, 0, tx));
+   bonuslen, DNODE_MIN_SIZE, tx));
 }
 
 int

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c  Tue Oct 
15 14:19:44 2019(r353555)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c  Tue Oct 
15 14:20:11 2019(r353556)
@@ -2268,11 +2268,13 @@ receive_object(struct receive_writer_arg *rwa, struct 
} else if (drro->drr_type != doi.doi_type ||
drro->drr_blksz != doi.doi_data_block_size ||
drro->drr_bonustype != doi.doi_bonus_type ||
-   drro->drr_bonuslen != doi.doi_bonus_size) {
+   drro->drr_bonuslen != doi.doi_bonus_size ||
+   drro->drr_dn_slots != (doi.doi_dnodesize >> DNODE_SHIFT)) {
/* currently allocated, but with different properties */
-   err = dmu_object_reclaim(rwa->os, drro->drr_object,
+   err = dmu_object_reclaim_dnsize(rwa->os, drro->drr_object,
drro->drr_type, drro->drr_blksz,
-   drro->drr_bonustype, drro->drr_bonuslen, tx);
+   drro->drr_bonustype, drro->drr_bonuslen,
+   drro->drr_dn_slots << DNODE_SHIFT, tx);
}
if (err != 0) {
dmu_tx_commit(tx);
@@ -2323,12 +2325,10 @@ receive_freeobjects(struct receive_writer_arg *rwa,
int err;
 
err = dmu_object_info(rwa->os, obj, NULL);
-   if (err == ENOENT) {
-   obj++;
+   if (err == ENOENT)
continue;
-   } else if (err != 0) {
+   else if (err != 0)
return (err);
-   }
 
err = dmu_free_long_object(rwa->os, obj);
if (err != 0)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Tue Oct 15 
14:19:44 2019(r353555)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Tue Oct 15 
14:20:11 2019(r353556)
@@ -680,8 +680,7 @@ dnode_reallocate(dnode_t *dn, dmu_object_type_t ot, in
ASSERT(DMU_OT_IS_VALID(bonustype));
ASSERT3U(bonuslen, <=,
DN_BONUS_SIZE(spa_maxdnodesize(dmu_objset_spa(dn->dn_objset;
-
-   dn_slots = dn_slots > 0 ? dn_slots : DNODE_MIN_SLOTS;
+   ASSERT3U(bonuslen, <=, DN_BONUS_SIZE(dn_slots << DNODE_SHIFT));
 
dnode_free_interior_slots(dn);
DNODE_STAT_BUMP(dnode_reallocate);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubsc

svn commit: r353559 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2019-10-15 Thread Andriy Gapon
Author: avg
Date: Tue Oct 15 14:29:18 2019
New Revision: 353559
URL: https://svnweb.freebsd.org/changeset/base/353559

Log:
  MFV r353558: 10572 10579 Fix race in dnode_check_slots_free()
  
  illumos/illumos-gate@aa02ea01948372a32cbf08bfc31c72c32e3fc81e
  
https://github.com/illumos/illumos-gate/commit/aa02ea01948372a32cbf08bfc31c72c32e3fc81e
  
  10572 Fix race in dnode_check_slots_free()
  https://www.illumos.org/issues/10572
The Fix from ZoL:
Currently, dnode_check_slots_free() works by checking dn->dn_type
in the dnode to determine if the dnode is reclaimable. However,
there is a small window of time between dnode_free_sync() in the
first call to dsl_dataset_sync() and when the useraccounting code
is run when the type is set DMU_OT_NONE, but the dnode is not yet
evictable, leading to crashes. This patch adds the ability for
dnodes to track which txg they were last dirtied in and adds a
check for this before performing the reclaim.
  
This patch also corrects several instances when dn_dirty_link was
treated as a list_node_t when it is technically a multilist_node_t.
  
  10579 Don't allow dnode allocation if dn_holds != 0
  https://www.illumos.org/issues/10579
The fix from ZoL:
This patch simply fixes a small bug where dnode_hold_impl() could
attempt to allocate a dnode that was in the process of being freed,
but which still had active references. This patch simply adds the
required check.
  
  Author: Tom Caputi 
  Reported by:  delphij
  MFC after:2 weeks
  X-MFC with:   r353176

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_impl.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c  Tue Oct 15 
14:24:32 2019(r353558)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c  Tue Oct 15 
14:29:18 2019(r353559)
@@ -1812,6 +1812,9 @@ dbuf_dirty(dmu_buf_impl_t *db, dmu_tx_t *tx)
FTAG);
}
}
+
+   if (tx->tx_txg > dn->dn_dirty_txg)
+   dn->dn_dirty_txg = tx->tx_txg;
mutex_exit(&dn->dn_mtx);
 
if (db->db_blkid == DMU_SPILL_BLKID)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.cTue Oct 
15 14:24:32 2019(r353558)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.cTue Oct 
15 14:29:18 2019(r353559)
@@ -1249,10 +1249,23 @@ dmu_objset_sync_dnodes(multilist_sublist_t *list, dmu_
ASSERT3U(dn->dn_nlevels, <=, DN_MAX_LEVELS);
multilist_sublist_remove(list, dn);
 
+   /*
+* If we are not doing useraccounting (os_synced_dnodes == NULL)
+* we are done with this dnode for this txg. Unset dn_dirty_txg
+* if later txgs aren't dirtying it so that future holders do
+* not get a stale value. Otherwise, we will do this in
+* userquota_updates_task() when processing has completely
+* finished for this txg.
+*/
multilist_t *newlist = dn->dn_objset->os_synced_dnodes;
if (newlist != NULL) {
(void) dnode_add_ref(dn, newlist);
multilist_insert(newlist, dn);
+   } else {
+   mutex_enter(&dn->dn_mtx);
+   if (dn->dn_dirty_txg == tx->tx_txg)
+   dn->dn_dirty_txg = 0;
+   mutex_exit(&dn->dn_mtx);
}
 
dnode_sync(dn, tx);
@@ -1617,6 +1630,8 @@ userquota_updates_task(void *arg)
dn->dn_id_flags |= DN_ID_CHKED_BONUS;
}
dn->dn_id_flags &= ~(DN_ID_NEW_EXIST);
+   if (dn->dn_dirty_txg == spa_syncing_txg(os->os_spa))
+   dn->dn_dirty_txg = 0;
mutex_exit(&dn->dn_mtx);
 
multilist_sublist_remove(list, dn);

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Tue Oct 15 
14:24:32 2019(r353558)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Tue Oct 15 
14:29:18 2019(r353559)
@@ -1

svn commit: r353565 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2019-10-15 Thread Andriy Gapon
Author: avg
Date: Tue Oct 15 15:09:36 2019
New Revision: 353565
URL: https://svnweb.freebsd.org/changeset/base/353565

Log:
  MFV r353561: 10343 ZoL: Prefix all refcount functions with zfs_
  
  illumos/illumos-gate@e914ace2e9d9bf2dbf9a1f1ce81cb776022096f5
  
https://github.com/illumos/illumos-gate/commit/e914ace2e9d9bf2dbf9a1f1ce81cb776022096f5
  
  https://www.illumos.org/issues/10343
On the openzfs feature/porting matrix, this is listed as:
prefix to refcount funcs/types
Having these changes will make it easier to share other work across the
different ZFS operating systems.
PR 7963 424fd7c3e Prefix all refcount functions with zfs_
PR 7885 & 7932 c13060e47 Linux 4.19-rc3+ compat: Remove refcount_t compat
PR 5823 & 5842 4859fe796 Linux 4.11 compat: avoid refcount_t name conflict
  
  Author: Tim Schumacher 
  Obtained from:illumos, ZoL
  MFC after:3 weeks

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/abd.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/refcount.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/rrwlock.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/abd.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_tx.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/refcount.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/rrwlock.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/sa_impl.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/abd.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/abd.c   Tue Oct 15 
14:51:22 2019(r353564)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/abd.c   Tue Oct 15 
15:09:36 2019(r353565)
@@ -304,7 +304,7 @@ abd_alloc(size_t size, boolean_t is_metadata)
}
abd->abd_size = size;
abd->abd_parent = NULL;
-   refcount_create(&abd->abd_children);
+   zfs_refcount_create(&abd->abd_children);
 
abd->abd_u.abd_scatter.abd_offset = 0;
abd->abd_u.abd_scatter.abd_chunk_size = zfs_abd_chunk_size;
@@ -331,7 +331,7 @@ abd_free_scatter(abd_t *abd)
abd_free_chunk(abd->abd_u.abd_scatter.abd_chunks[i]);
}
 
-   refcount_destroy(&abd->abd_children);
+   zfs_refcount_destroy(&abd->abd_children);
ABDSTAT_BUMPDOWN(abdstat_scatter_cnt);
ABDSTAT_INCR(abdstat_scatter_data_size, -(int)abd->abd_size);
ABDSTAT_INCR(abdstat_scatter_chunk_waste,
@@ -358,7 +358,7 @@ abd_alloc_linear(size_t size, boolean_t is_metadata)
}
abd->abd_size = size;
abd->abd_parent = NULL;
-   refcount_create(&abd->abd_children);
+   zfs_refcount_create(&abd->abd_children);
 
if (is_metadata) {
abd->abd_u.abd_linear.abd_buf = zio_buf_alloc(size);
@@ -381,7 +381,7 @@ abd_free_linear(abd_t *abd)
zio_data_buf_free(abd->abd_u.abd_linear.abd_buf, abd->abd_size);
}
 
-   refcount_destroy(&abd->abd_children);
+   zfs_refcount_destroy(&abd->abd_children);
ABDSTAT_BUMPDOWN(abdstat_linear_cnt);
ABDSTAT_INCR(abdstat_linear_data_size, -(int)abd->abd_size);
 
@@ -487,8 +487,8 @@ abd_get_offset(abd_t *sabd, size_t off)
 
abd->abd_size = sabd->abd_size - off;
abd->abd_parent = sabd;
-   refcount_create(&abd->abd_children);
-   (void) refcount_add_many(&sabd->abd_children, abd->abd_size, abd);
+   zfs_refcount_create(&abd->abd_children);
+   (void) zfs_refcount_add_many(&sabd->abd_children, abd->abd_size, abd);
 
return (abd);
 }
@@ -512,7 +512,7 @@ abd_get_from_buf(v

svn commit: r353566 - in head/sys: kern sys

2019-10-15 Thread Gleb Smirnoff
Author: glebius
Date: Tue Oct 15 15:40:03 2019
New Revision: 353566
URL: https://svnweb.freebsd.org/changeset/base/353566

Log:
  Remove pfctlinput2(). It came from KAME and had never ever been in use.

Modified:
  head/sys/kern/uipc_domain.c
  head/sys/sys/protosw.h

Modified: head/sys/kern/uipc_domain.c
==
--- head/sys/kern/uipc_domain.c Tue Oct 15 15:09:36 2019(r353565)
+++ head/sys/kern/uipc_domain.c Tue Oct 15 15:40:03 2019(r353566)
@@ -475,29 +475,6 @@ pfctlinput(int cmd, struct sockaddr *sa)
(*pr->pr_ctlinput)(cmd, sa, (void *)0);
 }
 
-void
-pfctlinput2(int cmd, struct sockaddr *sa, void *ctlparam)
-{
-   struct domain *dp;
-   struct protosw *pr;
-
-   if (!sa)
-   return;
-   for (dp = domains; dp; dp = dp->dom_next) {
-   /*
-* the check must be made by xx_ctlinput() anyways, to
-* make sure we use data item pointed to by ctlparam in
-* correct way.  the following check is made just for safety.
-*/
-   if (dp->dom_family != sa->sa_family)
-   continue;
-
-   for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++)
-   if (pr->pr_ctlinput)
-   (*pr->pr_ctlinput)(cmd, sa, ctlparam);
-   }
-}
-
 static void
 pfslowtimo(void *arg)
 {

Modified: head/sys/sys/protosw.h
==
--- head/sys/sys/protosw.h  Tue Oct 15 15:09:36 2019(r353565)
+++ head/sys/sys/protosw.h  Tue Oct 15 15:40:03 2019(r353566)
@@ -342,7 +342,6 @@ char*prcorequests[] = {
 
 #ifdef _KERNEL
 void   pfctlinput(int, struct sockaddr *);
-void   pfctlinput2(int, struct sockaddr *, void *);
 struct domain *pffinddomain(int family);
 struct protosw *pffindproto(int family, int protocol, int type);
 struct protosw *pffindtype(int family, int type);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r353568 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2019-10-15 Thread Andriy Gapon
Author: avg
Date: Tue Oct 15 15:52:01 2019
New Revision: 353568
URL: https://svnweb.freebsd.org/changeset/base/353568

Log:
  fix up r353565, somehow a few files did not get committed
  
  MFC after:3 weeks
  X-MFC with:   r353565

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf_stats.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf_stats.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf_stats.cTue Oct 
15 15:47:22 2019(r353567)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf_stats.cTue Oct 
15 15:52:01 2019(r353568)
@@ -90,7 +90,7 @@ __dbuf_stats_hash_table_data(char *buf, size_t size, d
(u_longlong_t)db->db.db_size,
!!dbuf_is_metadata(db),
db->db_state,
-   (ulong_t)refcount_count(&db->db_holds),
+   (ulong_t)zfs_refcount_count(&db->db_holds),
/* arc_buf_info_t */
abi.abi_state_type,
abi.abi_state_contents,
@@ -115,7 +115,7 @@ __dbuf_stats_hash_table_data(char *buf, size_t size, d
(ulong_t)doi.doi_metadata_block_size,
(u_longlong_t)doi.doi_bonus_size,
(ulong_t)doi.doi_indirection,
-   (ulong_t)refcount_count(&dn->dn_holds),
+   (ulong_t)zfs_refcount_count(&dn->dn_holds),
(u_longlong_t)doi.doi_fill_count,
(u_longlong_t)doi.doi_max_offset);
 buf[size] = '\0';

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c  Tue Oct 
15 15:47:22 2019(r353567)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c  Tue Oct 
15 15:52:01 2019(r353568)
@@ -318,7 +318,7 @@ struct dsl_scan_io_queue {
 
 /* private data for dsl_scan_prefetch_cb() */
 typedef struct scan_prefetch_ctx {
-   refcount_t spc_refcnt;  /* refcount for memory management */
+   zfs_refcount_t spc_refcnt;  /* refcount for memory management */
dsl_scan_t *spc_scn;/* dsl_scan_t for the pool */
boolean_t spc_root; /* is this prefetch for an objset? */
uint8_t spc_indblkshift;/* dn_indblkshift of current dnode */
@@ -1326,8 +1326,8 @@ scan_prefetch_queue_compare(const void *a, const void 
 static void
 scan_prefetch_ctx_rele(scan_prefetch_ctx_t *spc, void *tag)
 {
-   if (refcount_remove(&spc->spc_refcnt, tag) == 0) {
-   refcount_destroy(&spc->spc_refcnt);
+   if (zfs_refcount_remove(&spc->spc_refcnt, tag) == 0) {
+   zfs_refcount_destroy(&spc->spc_refcnt);
kmem_free(spc, sizeof (scan_prefetch_ctx_t));
}
 }
@@ -1338,8 +1338,8 @@ scan_prefetch_ctx_create(dsl_scan_t *scn, dnode_phys_t
scan_prefetch_ctx_t *spc;
 
spc = kmem_alloc(sizeof (scan_prefetch_ctx_t), KM_SLEEP);
-   refcount_create(&spc->spc_refcnt);
-   refcount_add(&spc->spc_refcnt, tag);
+   zfs_refcount_create(&spc->spc_refcnt);
+   zfs_refcount_add(&spc->spc_refcnt, tag);
spc->spc_scn = scn;
if (dnp != NULL) {
spc->spc_datablkszsec = dnp->dn_datablkszsec;
@@ -1357,7 +1357,7 @@ scan_prefetch_ctx_create(dsl_scan_t *scn, dnode_phys_t
 static void
 scan_prefetch_ctx_add_ref(scan_prefetch_ctx_t *spc, void *tag)
 {
-   refcount_add(&spc->spc_refcnt, tag);
+   zfs_refcount_add(&spc->spc_refcnt, tag);
 }
 
 static boolean_t

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h   Tue Oct 
15 15:47:22 2019(r353567)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h   Tue Oct 
15 15:52:01 2019(r353568)
@@ -86,7 +86,7 @@ struct arc_prune {
void*p_private;
uint64_tp_adjust;
list_node_t p_node;
-   refcount_t  p_refcnt;
+   zfs_refcount_t  p_refcnt;
 };
 
 typedef enum arc_strategy {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r353566 - in head/sys: kern sys

2019-10-15 Thread Gleb Smirnoff
On Tue, Oct 15, 2019 at 03:40:03PM +, Gleb Smirnoff wrote:
T> Author: glebius
T> Date: Tue Oct 15 15:40:03 2019
T> New Revision: 353566
T> URL: https://svnweb.freebsd.org/changeset/base/353566
T> 
T> Log:
T>   Remove pfctlinput2(). It came from KAME and had never ever been in use.

The commit message is wrong. It was used in FreeBSD 10 and before. My
fxr usage skills are weak.

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


Re: svn commit: r353565 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2019-10-15 Thread O. Hartmann
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Am Tue, 15 Oct 2019 15:09:36 + (UTC)
Andriy Gapon  schrieb:

> Author: avg
> Date: Tue Oct 15 15:09:36 2019
> New Revision: 353565
> URL: https://svnweb.freebsd.org/changeset/base/353565
> 
> Log:
>   MFV r353561: 10343 ZoL: Prefix all refcount functions with zfs_
>   
>   illumos/illumos-gate@e914ace2e9d9bf2dbf9a1f1ce81cb776022096f5
>   
> https://github.com/illumos/illumos-gate/commit/e914ace2e9d9bf2dbf9a1f1ce81cb776022096f5
>   
>   https://www.illumos.org/issues/10343
> On the openzfs feature/porting matrix, this is listed as:
> prefix to refcount funcs/types
> Having these changes will make it easier to share other work across the
> different ZFS operating systems.
> PR 7963 424fd7c3e Prefix all refcount functions with zfs_
> PR 7885 & 7932 c13060e47 Linux 4.19-rc3+ compat: Remove refcount_t compat
> PR 5823 & 5842 4859fe796 Linux 4.11 compat: avoid refcount_t name conflict
>   
>   Author: Tim Schumacher 
>   Obtained from:  illumos, ZoL
>   MFC after:  3 weeks
> 
> Modified:
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/abd.c
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/refcount.c
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/rrwlock.c
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/abd.h
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_tx.h
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/refcount.h
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/rrwlock.h
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/sa_impl.h
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap.h
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
> Directory Properties:
>   head/sys/cddl/contrib/opensolaris/   (props changed)
> 
> Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/abd.c
> ==
> --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/abd.c Tue Oct 15 
> 14:51:22
> 2019  (r353564) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/abd.c
> Tue Oct 15 15:09:36 2019  (r353565) @@ -304,7 +304,7 @@ abd_alloc(size_t 
> size,
> boolean_t is_metadata) }
>   abd->abd_size = size;
>   abd->abd_parent = NULL;
> - refcount_create(&abd->abd_children);
> + zfs_refcount_create(&abd->abd_children);
>  
>   abd->abd_u.abd_scatter.abd_offset = 0;
>   abd->abd_u.abd_scatter.abd_chunk_size = zfs_abd_chunk_size;
> @@ -331,7 +331,7 @@ abd_free_scatter(abd_t *abd)
>   abd_free_chunk(abd->abd_u.abd_scatter.abd_chunks[i]);
>   }
>  
> - refcount_destroy(&abd->abd_children);
> + zfs_refcount_destroy(&abd->abd_children);
>   ABDSTAT_BUMPDOWN(abdstat_scatter_cnt);
>   ABDSTAT_INCR(abdstat_scatter_data_size, -(int)abd->abd_size);
>   ABDSTAT_INCR(abdstat_scatter_chunk_waste,
> @@ -358,7 +358,7 @@ abd_alloc_linear(size_t size, boolean_t is_metadata)
>   }
>   abd->abd_size = size;
>   abd->abd_parent = NULL;
> - refcount_create(&abd->abd_children);
> + zfs_refcount_create(&abd->abd_children);
>  
>   if (is_metadata) {
>   abd->abd_u.abd_linear.abd_buf = zio_buf_alloc(size);
> @@ -381,7 +381,7 @@ abd_free_linear(abd_t *abd)
>   zio_data_buf_free(abd->abd_u.abd_linear.abd_buf, abd->abd_size);
>   }
>  
> - refcount_destroy(&abd->abd_children);
> + zfs_refcount_destroy(&abd->abd_children);
>   ABDSTAT_BUMPDOWN(abdstat_linear_cnt);
>   ABDSTAT_INCR(abdstat_linear_data_size, -(int)abd->abd_size);
>  
> @@ -487,8 +487,8 @@ abd_get_offset(abd_t *sabd, size_t off)
>  
>   abd->abd_size = sabd->abd_size - off;
>   abd->abd_parent = sabd;
> - refcount_create(&abd->abd_children);
> - (void) refcount_add_ma

Re: svn commit: r353565 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2019-10-15 Thread Andriy Gapon
On 15/10/2019 18:53, O. Hartmann wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA256
> 
> Am Tue, 15 Oct 2019 15:09:36 + (UTC)
> Andriy Gapon  schrieb:

Sorry, I got tired before I could scroll to your reply.

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


Re: svn commit: r353565 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2019-10-15 Thread Ian Lepore
On Tue, 2019-10-15 at 18:56 +0300, Andriy Gapon wrote:
> On 15/10/2019 18:53, O. Hartmann wrote:
> > -BEGIN PGP SIGNED MESSAGE-
> > Hash: SHA256
> > 
> > Am Tue, 15 Oct 2019 15:09:36 + (UTC)
> > Andriy Gapon  schrieb:
> 
> Sorry, I got tired before I could scroll to your reply.
> 

You break the build, a user reports it, and a smartass reply is the
best you can do?

-- Ian

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


Re: svn commit: r353565 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2019-10-15 Thread Andriy Gapon
On 15/10/2019 19:00, Ian Lepore wrote:
> On Tue, 2019-10-15 at 18:56 +0300, Andriy Gapon wrote:
>> On 15/10/2019 18:53, O. Hartmann wrote:
>>> -BEGIN PGP SIGNED MESSAGE-
>>> Hash: SHA256
>>>
>>> Am Tue, 15 Oct 2019 15:09:36 + (UTC)
>>> Andriy Gapon  schrieb:
>>
>> Sorry, I got tired before I could scroll to your reply.
>>
> 
> You break the build, a user reports it, and a smartass reply is the
> best you can do?

The best I could do, and did, was fixing the build.

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


svn commit: r353569 - head/usr.bin/rpcgen

2019-10-15 Thread Brooks Davis
Author: brooks
Date: Tue Oct 15 16:05:17 2019
New Revision: 353569
URL: https://svnweb.freebsd.org/changeset/base/353569

Log:
  rpcgen: make compiler arglist allocation dynamic
  
  Limit argmax to an absurdly large value prevent overflow (no overflow
  possible on FreeBSD due to ARG_MAX).
  
  In CheriBSD we exceed the 19 non-NULL arguments in the static array.  Add
  a simple size doubling allocator and increase the default to 32.
  
  GC remnants of support for fixed arguments.
  
  Reviewed by:  archardson (prior version), James Clarke (prior version)
  MFC after:1 week
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D21971

Modified:
  head/usr.bin/rpcgen/rpc_main.c

Modified: head/usr.bin/rpcgen/rpc_main.c
==
--- head/usr.bin/rpcgen/rpc_main.c  Tue Oct 15 15:52:01 2019
(r353568)
+++ head/usr.bin/rpcgen/rpc_main.c  Tue Oct 15 16:05:17 2019
(r353569)
@@ -93,19 +93,13 @@ static int allnc = nitems(allnv);
  */
 static void addarg(const char *);  /* add another argument to the list */
 static void insarg(int, const char *); /* insert arg at specified location */
-static void clear_args(void);  /* clear argument list */
 static void checkfiles(const char *, const char *);
/* check if out file already exists */
 
+static char **arglist;
+static int argcount = 0;
+static int argmax = 0;
 
-
-#defineARGLISTLEN  20
-#defineFIXEDARGS   0
-
-static char *arglist[ARGLISTLEN];
-static int argcount = FIXEDARGS;
-
-
 int nonfatalerrors;/* errors */
 int inetdflag = 0; /* Support for inetd is disabled by default, use -I */
 int pmflag = 0;/* Support for port monitors is disabled by 
default */
@@ -141,7 +135,6 @@ main(int argc, const char *argv[])
struct commandline cmd;
 
(void) memset((char *)&cmd, 0, sizeof (struct commandline));
-   clear_args();
if (!parseargs(argc, argv, &cmd))
usage();
/*
@@ -273,16 +266,6 @@ add_warning(void)
f_print(fout, " */\n\n");
 }
 
-/* clear list of arguments */
-static void
-clear_args(void)
-{
-   int i;
-   for (i = FIXEDARGS; i < ARGLISTLEN; i++)
-   arglist[i] = NULL;
-   argcount = FIXEDARGS;
-}
-
 /* prepend C-preprocessor and flags before arguments */
 static void
 prepend_cpp(void)
@@ -925,21 +908,40 @@ do_registers(int argc, const char *argv[])
 }
 
 /*
- * Add another argument to the arg list
+ * Extend the argument list
  */
 static void
-addarg(const char *cp)
+moreargs(void)
 {
-   if (argcount >= ARGLISTLEN) {
-   warnx("too many defines");
+   char **newarglist;
+
+   argmax = argmax == 0 ? 32 : argmax << 1;
+   if (argmax > INT_MAX / 4) {
+   warnx("refusing to allocate too many arguments");
crash();
-   /*NOTREACHED*/
}
+   newarglist = realloc(arglist, argmax * sizeof(*arglist));
+   if (newarglist == NULL) {
+   warnx("unable to allocate arglist");
+   crash();
+   }
+   free(arglist);
+   arglist = newarglist;
+}
+
+/*
+ * Add another argument to the arg list
+ */
+static void
+addarg(const char *cp)
+{
+   if (argcount >= argmax)
+   moreargs();
+
if (cp != NULL)
arglist[argcount++] = xstrdup(cp);
else
arglist[argcount++] = NULL;
-
 }
 
 /*
@@ -950,11 +952,8 @@ insarg(int place, const char *cp)
 {
int i;
 
-   if (argcount >= ARGLISTLEN) {
-   warnx("too many defines");
-   crash();
-   /*NOTREACHED*/
-   }
+   if (argcount >= argmax)
+   moreargs();
 
/* Move up existing arguments */
for (i = argcount - 1; i >= place; i--)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r353565 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2019-10-15 Thread O. Hartmann
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Am Tue, 15 Oct 2019 18:56:25 +0300
Andriy Gapon  schrieb:

> On 15/10/2019 18:53, O. Hartmann wrote:
> > -BEGIN PGP SIGNED MESSAGE-
> > Hash: SHA256
> > 
> > Am Tue, 15 Oct 2019 15:09:36 + (UTC)
> > Andriy Gapon  schrieb:  
> 
> Sorry, I got tired before I could scroll to your reply.
> 

happens somtimes when I'm tired ...
Didn't realize the length of the post.

oh

- -- 
O. Hartmann

Ich widerspreche der Nutzung oder Übermittlung meiner Daten für
Werbezwecke oder für die Markt- oder Meinungsforschung (§ 28 Abs. 4 BDSG).
-BEGIN PGP SIGNATURE-

iHUEARYIAB0WIQSy8IBxAPDkqVBaTJ44N1ZZPba5RwUCXaXvBQAKCRA4N1ZZPba5
R0O6AP945Vk7mCaJID0HcitJKDGgiKT5GUDXxp8TjJg3HPlTuQEAtnu0T+tRjNaN
eB91NBBd2PpwVZVTETGknJbnPiY=
=8u5T
-END PGP SIGNATURE-
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r353565 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2019-10-15 Thread Andriy Gapon
> Am Tue, 15 Oct 2019 18:56:25 +0300
> Andriy Gapon  schrieb:
> 
>> On 15/10/2019 18:53, O. Hartmann wrote:
>>> -BEGIN PGP SIGNED MESSAGE-
>>> Hash: SHA256
>>>
>>> Am Tue, 15 Oct 2019 15:09:36 + (UTC)
>>> Andriy Gapon  schrieb:  
> 
>> Sorry, I got tired before I could scroll to your reply.
> 
> 
> happens somtimes when I'm tired ...
> Didn't realize the length of the post.

No problem.  And I already had a very good guess about what I could find in your
email :)


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


svn commit: r353572 - in head/sys: conf mips/conf

2019-10-15 Thread John Baldwin
Author: jhb
Date: Tue Oct 15 17:11:42 2019
New Revision: 353572
URL: https://svnweb.freebsd.org/changeset/base/353572

Log:
  Update MIPS kernel builds to work with mips-gcc.
  
  - Use a default -march of mips64 on N64 and N32 kernels.
  - Set the endianness (via MIPS_ENDIAN) and ABI (via MIPS_ABI) in
CFLAGS from MACHINE_ARCH.  ARCH_FLAGS now only sets a different
-march value if needed.
  - TRAMP_ARCH_FLAGS inherits MIPS_ENDIAN from MACHINE_ARCH but does
not set the ABI since XLPN32 needs an N64 ABI for the trampoline
loader.  When TRAMP_ARCH_FLAGS is used it must set both -march
and -mabi.
  
  Reviewed by:  imp
  Differential Revision:https://reviews.freebsd.org/D22030

Modified:
  head/sys/conf/Makefile.mips
  head/sys/mips/conf/ERL
  head/sys/mips/conf/JZ4780
  head/sys/mips/conf/MALTA64
  head/sys/mips/conf/MALTA64EL
  head/sys/mips/conf/OCTEON1
  head/sys/mips/conf/X1000
  head/sys/mips/conf/XLP64
  head/sys/mips/conf/XLPN32
  head/sys/mips/conf/std.BERI

Modified: head/sys/conf/Makefile.mips
==
--- head/sys/conf/Makefile.mips Tue Oct 15 16:27:04 2019(r353571)
+++ head/sys/conf/Makefile.mips Tue Oct 15 17:11:42 2019(r353572)
@@ -39,10 +39,16 @@ KERNLOADADDR?=0x80001000
 # To be changed later
 TRAMPLOADADDR?=0x807963c0
 
-# We default to the MIPS32 ISA, if none specified in the
-# kernel configuration file.
+# We default to the MIPS32 ISA for O32 and MIPS64 ISA for N64 and N32
+# if none is specified in the kernel configuration file.
+.if ${MACHINE_ARCH:Mmips64*} != "" || ${MACHINE_ARCH:Mmipsn32*} != ""
+ARCH_FLAGS?=-march=mips64
+.else
 ARCH_FLAGS?=-march=mips32
+.endif
+ARCH_FLAGS+=-mabi=${MIPS_ABI}
 EXTRA_FLAGS=-fno-pic -mno-abicalls -G0 -DKERNLOADADDR=${KERNLOADADDR}
+EXTRA_FLAGS+=-${MIPS_ENDIAN}
 
 HACK_EXTRA_FLAGS=-shared
 

Modified: head/sys/mips/conf/ERL
==
--- head/sys/mips/conf/ERL  Tue Oct 15 16:27:04 2019(r353571)
+++ head/sys/mips/conf/ERL  Tue Oct 15 17:11:42 2019(r353572)
@@ -21,7 +21,7 @@
 
 ident  ERL
 
-makeoptionsARCH_FLAGS="-march=octeon+ -mabi=64"
+makeoptionsARCH_FLAGS="-march=octeon+"
 makeoptionsLDSCRIPT_NAME=ldscript.mips.octeon1
 
 makeoptionsKERNLOADADDR=0x8010

Modified: head/sys/mips/conf/JZ4780
==
--- head/sys/mips/conf/JZ4780   Tue Oct 15 16:27:04 2019(r353571)
+++ head/sys/mips/conf/JZ4780   Tue Oct 15 17:11:42 2019(r353572)
@@ -12,7 +12,7 @@ cpu   CPU_XBURST
 cpuCPU_MIPS4KC
 
 makeoptionsKERNLOADADDR=0x8002
-makeoptionsARCH_FLAGS="-EL -march=mips32r2"
+makeoptionsARCH_FLAGS="-march=mips32r2"
 
 # Don't build any modules yet.
 makeoptionsMODULES_OVERRIDE=""

Modified: head/sys/mips/conf/MALTA64
==
--- head/sys/mips/conf/MALTA64  Tue Oct 15 16:27:04 2019(r353571)
+++ head/sys/mips/conf/MALTA64  Tue Oct 15 17:11:42 2019(r353572)
@@ -8,8 +8,6 @@ include "std.MALTA"
  
 machinemips mips64
  
-makeoptionsARCH_FLAGS="-march=mips64 -mabi=64"
- 
 makeoptionsKERNLOADADDR=0x8010
 
 optionsCOMPAT_FREEBSD32# Compatible with o32 binaries

Modified: head/sys/mips/conf/MALTA64EL
==
--- head/sys/mips/conf/MALTA64ELTue Oct 15 16:27:04 2019
(r353571)
+++ head/sys/mips/conf/MALTA64ELTue Oct 15 17:11:42 2019
(r353572)
@@ -8,5 +8,4 @@ include "std.MALTA"
  
 machinemips mips64el
  
-makeoptionsARCH_FLAGS="-march=mips64 -mabi=64"
 makeoptionsKERNLOADADDR=0x8010

Modified: head/sys/mips/conf/OCTEON1
==
--- head/sys/mips/conf/OCTEON1  Tue Oct 15 16:27:04 2019(r353571)
+++ head/sys/mips/conf/OCTEON1  Tue Oct 15 17:11:42 2019(r353572)
@@ -20,7 +20,7 @@
 
 ident  OCTEON1
 
-makeoptionsARCH_FLAGS="-march=octeon -mabi=64"
+makeoptionsARCH_FLAGS="-march=octeon"
 makeoptionsLDSCRIPT_NAME=ldscript.mips.octeon1
 
 # Don't build any modules yet.

Modified: head/sys/mips/conf/X1000
==
--- head/sys/mips/conf/X1000Tue Oct 15 16:27:04 2019(r353571)
+++ head/sys/mips/conf/X1000Tue Oct 15 17:11:42 2019(r353572)
@@ -10,7 +10,7 @@ cpu   CPU_XBURST
 cpuCPU_MIPS4KC
 
 makeoptionsKERNLOADADDR=0x8002
-makeoptionsARCH_FLAGS="-EL -march=mips32r2"
+makeoptionsARCH_FLAGS="-march=mips32r2"
 
 # Don't build any modules yet.
 makeoptionsMODULES_OVERRIDE=""

Modified: head/sys/mips/conf/XLP64
=

svn commit: r353573 - head/sys/mips/nlm/dev/net/ucore

2019-10-15 Thread John Baldwin
Author: jhb
Date: Tue Oct 15 17:14:30 2019
New Revision: 353573
URL: https://svnweb.freebsd.org/changeset/base/353573

Log:
  Don't set the OUTPUT_FORMAT explicitly but let ld derive it.
  
  This fixes an error with modern ld.bfd and is inline with the changes in
  r215251 and r217612.
  
  Reviewed by:  imp
  Differential Revision:https://reviews.freebsd.org/D22031

Modified:
  head/sys/mips/nlm/dev/net/ucore/ld.ucore.S

Modified: head/sys/mips/nlm/dev/net/ucore/ld.ucore.S
==
--- head/sys/mips/nlm/dev/net/ucore/ld.ucore.S  Tue Oct 15 17:11:42 2019
(r353572)
+++ head/sys/mips/nlm/dev/net/ucore/ld.ucore.S  Tue Oct 15 17:14:30 2019
(r353573)
@@ -28,8 +28,8 @@
  * $FreeBSD$
  */
 
+OUTPUT_ARCH(mips)
 ENTRY(_start)
-OUTPUT_FORMAT(elf32-tradbigmips)
 __DYNAMIC  =  0;
 
 SECTIONS
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r353574 - head/sys/mips/nlm/dev/net/ucore

2019-10-15 Thread John Baldwin
Author: jhb
Date: Tue Oct 15 17:17:16 2019
New Revision: 353574
URL: https://svnweb.freebsd.org/changeset/base/353574

Log:
  Fix a write-only variable warning from external GCC.
  
  Reviewed by:  imp
  Differential Revision:https://reviews.freebsd.org/D22032

Modified:
  head/sys/mips/nlm/dev/net/ucore/ucore_app.c

Modified: head/sys/mips/nlm/dev/net/ucore/ucore_app.c
==
--- head/sys/mips/nlm/dev/net/ucore/ucore_app.c Tue Oct 15 17:14:30 2019
(r353573)
+++ head/sys/mips/nlm/dev/net/ucore/ucore_app.c Tue Oct 15 17:17:16 2019
(r353574)
@@ -34,13 +34,12 @@
 
 int main(void)
 {
-   unsigned int pktrdy;
int num_cachelines = 1518 / 64 ; /* pktsize / L3 cacheline size */
 
 
/* Spray packets to using distribution vector */
while (1) {
-   pktrdy = nlm_read_ucore_rxpktrdy();
+   (void)nlm_read_ucore_rxpktrdy();
nlm_ucore_setup_poepktdistr(FWD_DIST_VEC, 0, 0, 0, 0);
nlm_ucore_pkt_done(num_cachelines, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r353575 - head/sys/dev/mmc/host

2019-10-15 Thread Ruslan Bukin
Author: br
Date: Tue Oct 15 17:24:21 2019
New Revision: 353575
URL: https://svnweb.freebsd.org/changeset/base/353575

Log:
  Fix dwmmc(4) driver attachment when ext_resources are not present.
  
  Ignore only ENOENT (no DTS properties found) and ENODEV (driver not
  present) non-zero return values from ext_resources.
  
  Reviewed by:  manu
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D22043

Modified:
  head/sys/dev/mmc/host/dwmmc.c

Modified: head/sys/dev/mmc/host/dwmmc.c
==
--- head/sys/dev/mmc/host/dwmmc.c   Tue Oct 15 17:17:16 2019
(r353574)
+++ head/sys/dev/mmc/host/dwmmc.c   Tue Oct 15 17:24:21 2019
(r353575)
@@ -457,20 +457,32 @@ parse_fdt(struct dwmmc_softc *sc)
 
/* IP block reset is optional */
error = hwreset_get_by_ofw_name(sc->dev, 0, "reset", &sc->hwreset);
-   if (error != 0 && error != ENOENT)
+   if (error != 0 &&
+   error != ENOENT &&
+   error != ENODEV) {
device_printf(sc->dev, "Cannot get reset\n");
+   goto fail;
+   }
 
/* vmmc regulator is optional */
error = regulator_get_by_ofw_property(sc->dev, 0, "vmmc-supply",
 &sc->vmmc);
-   if (error != 0 && error != ENOENT)
+   if (error != 0 &&
+   error != ENOENT &&
+   error != ENODEV) {
device_printf(sc->dev, "Cannot get regulator 'vmmc-supply'\n");
+   goto fail;
+   }
 
/* vqmmc regulator is optional */
error = regulator_get_by_ofw_property(sc->dev, 0, "vqmmc-supply",
 &sc->vqmmc);
-   if (error != 0 && error != ENOENT)
+   if (error != 0 &&
+   error != ENOENT &&
+   error != ENODEV) {
device_printf(sc->dev, "Cannot get regulator 'vqmmc-supply'\n");
+   goto fail;
+   }
 
/* Assert reset first */
if (sc->hwreset != NULL) {
@@ -483,8 +495,12 @@ parse_fdt(struct dwmmc_softc *sc)
 
/* BIU (Bus Interface Unit clock) is optional */
error = clk_get_by_ofw_name(sc->dev, 0, "biu", &sc->biu);
-   if (error != 0 && error != ENOENT)
+   if (error != 0 &&
+   error != ENOENT &&
+   error != ENODEV) {
device_printf(sc->dev, "Cannot get 'biu' clock\n");
+   goto fail;
+   }
 
if (sc->biu) {
error = clk_enable(sc->biu);
@@ -499,8 +515,12 @@ parse_fdt(struct dwmmc_softc *sc)
 * if no clock-frequency property is given
 */
error = clk_get_by_ofw_name(sc->dev, 0, "ciu", &sc->ciu);
-   if (error != 0 && error != ENOENT)
+   if (error != 0 &&
+   error != ENOENT &&
+   error != ENODEV) {
device_printf(sc->dev, "Cannot get 'ciu' clock\n");
+   goto fail;
+   }
 
if (sc->ciu) {
if (bus_hz != 0) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r353576 - head/sys/mips/conf

2019-10-15 Thread John Baldwin
Author: jhb
Date: Tue Oct 15 17:28:26 2019
New Revision: 353576
URL: https://svnweb.freebsd.org/changeset/base/353576

Log:
  Use -march=octeon+ for OCTEON1.
  
  External binutils requires octeon+ for saa.
  
  Reviewed by:  imp
  Differential Revision:https://reviews.freebsd.org/D22033

Modified:
  head/sys/mips/conf/OCTEON1

Modified: head/sys/mips/conf/OCTEON1
==
--- head/sys/mips/conf/OCTEON1  Tue Oct 15 17:24:21 2019(r353575)
+++ head/sys/mips/conf/OCTEON1  Tue Oct 15 17:28:26 2019(r353576)
@@ -20,7 +20,7 @@
 
 ident  OCTEON1
 
-makeoptionsARCH_FLAGS="-march=octeon"
+makeoptionsARCH_FLAGS="-march=octeon+"
 makeoptionsLDSCRIPT_NAME=ldscript.mips.octeon1
 
 # Don't build any modules yet.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r353575 - head/sys/dev/mmc/host

2019-10-15 Thread Emmanuel Vadot
On Tue, 15 Oct 2019 17:24:22 + (UTC)
Ruslan Bukin  wrote:

> Author: br
> Date: Tue Oct 15 17:24:21 2019
> New Revision: 353575
> URL: https://svnweb.freebsd.org/changeset/base/353575
> 
> Log:
>   Fix dwmmc(4) driver attachment when ext_resources are not present.
>   
>   Ignore only ENOENT (no DTS properties found) and ENODEV (driver not
>   present) non-zero return values from ext_resources.
>   
>   Reviewed by:manu
>   Sponsored by:   DARPA, AFRL
>   Differential Revision:  https://reviews.freebsd.org/D22043
> 
> Modified:
>   head/sys/dev/mmc/host/dwmmc.c

 I've just realized that you are probably using the SOCFPGA kernel
configuration and it doesn't have option EXT_RESOURCES so how did you
got those errors ?

> Modified: head/sys/dev/mmc/host/dwmmc.c
> ==
> --- head/sys/dev/mmc/host/dwmmc.c Tue Oct 15 17:17:16 2019
> (r353574)
> +++ head/sys/dev/mmc/host/dwmmc.c Tue Oct 15 17:24:21 2019
> (r353575)
> @@ -457,20 +457,32 @@ parse_fdt(struct dwmmc_softc *sc)
>  
>   /* IP block reset is optional */
>   error = hwreset_get_by_ofw_name(sc->dev, 0, "reset", &sc->hwreset);
> - if (error != 0 && error != ENOENT)
> + if (error != 0 &&
> + error != ENOENT &&
> + error != ENODEV) {
>   device_printf(sc->dev, "Cannot get reset\n");
> + goto fail;
> + }
>  
>   /* vmmc regulator is optional */
>   error = regulator_get_by_ofw_property(sc->dev, 0, "vmmc-supply",
>&sc->vmmc);
> - if (error != 0 && error != ENOENT)
> + if (error != 0 &&
> + error != ENOENT &&
> + error != ENODEV) {
>   device_printf(sc->dev, "Cannot get regulator 'vmmc-supply'\n");
> + goto fail;
> + }
>  
>   /* vqmmc regulator is optional */
>   error = regulator_get_by_ofw_property(sc->dev, 0, "vqmmc-supply",
>&sc->vqmmc);
> - if (error != 0 && error != ENOENT)
> + if (error != 0 &&
> + error != ENOENT &&
> + error != ENODEV) {
>   device_printf(sc->dev, "Cannot get regulator 'vqmmc-supply'\n");
> + goto fail;
> + }
>  
>   /* Assert reset first */
>   if (sc->hwreset != NULL) {
> @@ -483,8 +495,12 @@ parse_fdt(struct dwmmc_softc *sc)
>  
>   /* BIU (Bus Interface Unit clock) is optional */
>   error = clk_get_by_ofw_name(sc->dev, 0, "biu", &sc->biu);
> - if (error != 0 && error != ENOENT)
> + if (error != 0 &&
> + error != ENOENT &&
> + error != ENODEV) {
>   device_printf(sc->dev, "Cannot get 'biu' clock\n");
> + goto fail;
> + }
>  
>   if (sc->biu) {
>   error = clk_enable(sc->biu);
> @@ -499,8 +515,12 @@ parse_fdt(struct dwmmc_softc *sc)
>* if no clock-frequency property is given
>*/
>   error = clk_get_by_ofw_name(sc->dev, 0, "ciu", &sc->ciu);
> - if (error != 0 && error != ENOENT)
> + if (error != 0 &&
> + error != ENOENT &&
> + error != ENODEV) {
>   device_printf(sc->dev, "Cannot get 'ciu' clock\n");
> + goto fail;
> + }
>  
>   if (sc->ciu) {
>   if (bus_hz != 0) {


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


svn commit: r353578 - head/sys/dev/cxgbe

2019-10-15 Thread Navdeep Parhar
Author: np
Date: Tue Oct 15 17:35:39 2019
New Revision: 353578
URL: https://svnweb.freebsd.org/changeset/base/353578

Log:
  cxgbe(4): An EQ update can be requested in a TX_PKTS2 work request.
  
  MFC after:1 week
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/t4_sge.c

Modified: head/sys/dev/cxgbe/t4_sge.c
==
--- head/sys/dev/cxgbe/t4_sge.c Tue Oct 15 17:30:12 2019(r353577)
+++ head/sys/dev/cxgbe/t4_sge.c Tue Oct 15 17:35:39 2019(r353578)
@@ -2849,6 +2849,7 @@ wr_can_update_eq(struct fw_eth_tx_pkts_wr *wr)
case FW_ULPTX_WR:
case FW_ETH_TX_PKT_WR:
case FW_ETH_TX_PKTS_WR:
+   case FW_ETH_TX_PKTS2_WR:
case FW_ETH_TX_PKT_VM_WR:
return (1);
default:
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r353575 - head/sys/dev/mmc/host

2019-10-15 Thread Ruslan Bukin
On Tue, Oct 15, 2019 at 07:34:51PM +0200, Emmanuel Vadot wrote:
> On Tue, 15 Oct 2019 17:24:22 + (UTC)
> Ruslan Bukin  wrote:
> 
> > Author: br
> > Date: Tue Oct 15 17:24:21 2019
> > New Revision: 353575
> > URL: https://svnweb.freebsd.org/changeset/base/353575
> > 
> > Log:
> >   Fix dwmmc(4) driver attachment when ext_resources are not present.
> >   
> >   Ignore only ENOENT (no DTS properties found) and ENODEV (driver not
> >   present) non-zero return values from ext_resources.
> >   
> >   Reviewed by:  manu
> >   Sponsored by: DARPA, AFRL
> >   Differential Revision:https://reviews.freebsd.org/D22043
> > 
> > Modified:
> >   head/sys/dev/mmc/host/dwmmc.c
> 
>  I've just realized that you are probably using the SOCFPGA kernel
> configuration and it doesn't have option EXT_RESOURCES so how did you
> got those errors ?

No, I'm using arm64 GENERIC kernel since Intel Stratix 10 is arm64/FPGA.

Ruslan

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


Re: svn commit: r353575 - head/sys/dev/mmc/host

2019-10-15 Thread Emmanuel Vadot
On Tue, 15 Oct 2019 18:37:57 +0100
Ruslan Bukin  wrote:

> On Tue, Oct 15, 2019 at 07:34:51PM +0200, Emmanuel Vadot wrote:
> > On Tue, 15 Oct 2019 17:24:22 + (UTC)
> > Ruslan Bukin  wrote:
> > 
> > > Author: br
> > > Date: Tue Oct 15 17:24:21 2019
> > > New Revision: 353575
> > > URL: https://svnweb.freebsd.org/changeset/base/353575
> > > 
> > > Log:
> > >   Fix dwmmc(4) driver attachment when ext_resources are not present.
> > >   
> > >   Ignore only ENOENT (no DTS properties found) and ENODEV (driver not
> > >   present) non-zero return values from ext_resources.
> > >   
> > >   Reviewed by:manu
> > >   Sponsored by:   DARPA, AFRL
> > >   Differential Revision:  https://reviews.freebsd.org/D22043
> > > 
> > > Modified:
> > >   head/sys/dev/mmc/host/dwmmc.c
> > 
> >  I've just realized that you are probably using the SOCFPGA kernel
> > configuration and it doesn't have option EXT_RESOURCES so how did you
> > got those errors ?
> 
> No, I'm using arm64 GENERIC kernel since Intel Stratix 10 is arm64/FPGA.
> 
> Ruslan

 Ah ok, I though this was the previous generation. Again I think that
would be good to spend a few days to properly support the ext resources
from this platform. This seems to be the only arm64 SoC that doesn't
support it.

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


svn commit: r353579 - head/contrib/libc++/include

2019-10-15 Thread John Baldwin
Author: jhb
Date: Tue Oct 15 18:16:10 2019
New Revision: 353579
URL: https://svnweb.freebsd.org/changeset/base/353579

Log:
  Use __FreeBSD_version to determine if gets() has been removed.
  
  GCC compilers set __FreeBSD__ statically to a build-time determined
  targeted version (which in ports always matches the build host's
  version).  This means that when building any version (12 or 13, etc.)
  of riscv or some other architecture via GCC on a 12.x host,
  __FreeBSD__ will always be set to 12.  As a result, __FreeBSD__ cannot
  be used to reliably detect the target FreeBSD version being built.
  Instead, __FreeBSD_version from either  (in the kernel)
  or  (in userland) should be used.
  
  This changes the gets() test in libc++ to use __FreeBSD_version from
  .
  
  Reported by:  jenkins (riscv64 and amd64-gcc)
  Reviewed by:  dim, imp
  Differential Revision:https://reviews.freebsd.org/D22034

Modified:
  head/contrib/libc++/include/__config

Modified: head/contrib/libc++/include/__config
==
--- head/contrib/libc++/include/__configTue Oct 15 17:35:39 2019
(r353578)
+++ head/contrib/libc++/include/__configTue Oct 15 18:16:10 2019
(r353579)
@@ -246,6 +246,7 @@
 
 #ifdef __FreeBSD__
 #  include 
+#  include 
 #  if _BYTE_ORDER == _LITTLE_ENDIAN
 #define _LIBCPP_LITTLE_ENDIAN
 #  else  // _BYTE_ORDER == _LITTLE_ENDIAN
@@ -1131,7 +1132,8 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_
 
 // Some systems do not provide gets() in their C library, for security reasons.
 #ifndef _LIBCPP_C_HAS_NO_GETS
-#  if defined(_LIBCPP_MSVCRT) || (defined(__FreeBSD__) && __FreeBSD__ >= 13)
+#  if defined(_LIBCPP_MSVCRT) || \
+  (defined(__FreeBSD__) && __FreeBSD_version >= 1300043)
 #define _LIBCPP_C_HAS_NO_GETS
 #  endif
 #endif
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r353585 - head/sys/dev/pci

2019-10-15 Thread John Baldwin
Author: jhb
Date: Tue Oct 15 18:58:01 2019
New Revision: 353585
URL: https://svnweb.freebsd.org/changeset/base/353585

Log:
  Export pci_attach() and pci_detach().
  
  Reviewed by:  imp
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D21948

Modified:
  head/sys/dev/pci/pci.c
  head/sys/dev/pci/pci_private.h

Modified: head/sys/dev/pci/pci.c
==
--- head/sys/dev/pci/pci.c  Tue Oct 15 18:47:06 2019(r353584)
+++ head/sys/dev/pci/pci.c  Tue Oct 15 18:58:01 2019(r353585)
@@ -100,8 +100,6 @@ static void pci_assign_interrupt(device_t bus, 
device
 static int pci_add_map(device_t bus, device_t dev, int reg,
struct resource_list *rl, int force, int prefetch);
 static int pci_probe(device_t dev);
-static int pci_attach(device_t dev);
-static int pci_detach(device_t dev);
 static voidpci_load_vendor_data(void);
 static int pci_describe_parse_line(char **ptr, int *vendor,
int *device, char **desc);
@@ -4373,7 +4371,7 @@ pci_attach_common(device_t dev)
return (0);
 }
 
-static int
+int
 pci_attach(device_t dev)
 {
int busno, domain, error;
@@ -4394,7 +4392,7 @@ pci_attach(device_t dev)
return (bus_generic_attach(dev));
 }
 
-static int
+int
 pci_detach(device_t dev)
 {
 #ifdef PCI_RES_BUS

Modified: head/sys/dev/pci/pci_private.h
==
--- head/sys/dev/pci/pci_private.h  Tue Oct 15 18:47:06 2019
(r353584)
+++ head/sys/dev/pci/pci_private.h  Tue Oct 15 18:58:01 2019
(r353585)
@@ -58,7 +58,9 @@ void  pci_add_resources(device_t bus, device_t dev, in
uint32_t prefetchmask);
 void   pci_add_resources_ea(device_t bus, device_t dev, int alloc_iov);
 struct pci_devinfo *pci_alloc_devinfo_method(device_t dev);
+intpci_attach(device_t dev);
 intpci_attach_common(device_t dev);
+intpci_detach(device_t dev);
 intpci_rescan_method(device_t dev);
 void   pci_driver_added(device_t dev, driver_t *driver);
 intpci_ea_is_enabled(device_t dev, int rid);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r353586 - head/sys/dev/acpica

2019-10-15 Thread John Baldwin
Author: jhb
Date: Tue Oct 15 19:04:39 2019
New Revision: 353586
URL: https://svnweb.freebsd.org/changeset/base/353586

Log:
  Support hot insertion and removal of PCI devices on EC2.
  
  Install ACPI notify handlers on PCI devices with an _EJ0 method.  This
  handler is invoked when devices are added or removed.
  
  - When an ACPI_NOTIFY_DEVICE_CHECK event posts, rescan the parent bus
device.  Note that strictly speaking we only need to rescan the
specified device, but BUS_RESCAN is what is available, so we rescan
the entire bus.
  - When an ACPI_NOTIFY_EJECT_REQUEST event posts, detach the device
associated with the ACPI handle, invoke the _EJ0 method, and then
delete the device.
  
  Eventually this might be changed to vector notify events to devd in
  userspace where devctl can be used instead to permit more complex
  actions such as graceful unmounting of filesystems.
  
  Tested by:cperciva
  Reviewed by:  cperciva, imp, scottl
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D21948

Modified:
  head/sys/dev/acpica/acpi_pci.c

Modified: head/sys/dev/acpica/acpi_pci.c
==
--- head/sys/dev/acpica/acpi_pci.c  Tue Oct 15 18:58:01 2019
(r353585)
+++ head/sys/dev/acpica/acpi_pci.c  Tue Oct 15 19:04:39 2019
(r353586)
@@ -71,9 +71,11 @@ CTASSERT(ACPI_STATE_D2 == PCI_POWERSTATE_D2);
 CTASSERT(ACPI_STATE_D3 == PCI_POWERSTATE_D3);
 
 static struct pci_devinfo *acpi_pci_alloc_devinfo(device_t dev);
+static int acpi_pci_attach(device_t dev);
 static voidacpi_pci_child_deleted(device_t dev, device_t child);
 static int acpi_pci_child_location_str_method(device_t cbdev,
device_t child, char *buf, size_t buflen);
+static int acpi_pci_detach(device_t dev);
 static int acpi_pci_probe(device_t dev);
 static int acpi_pci_read_ivar(device_t dev, device_t child, int which,
uintptr_t *result);
@@ -89,6 +91,8 @@ static bus_dma_tag_t acpi_pci_get_dma_tag(device_t bus
 static device_method_t acpi_pci_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, acpi_pci_probe),
+   DEVMETHOD(device_attach,acpi_pci_attach),
+   DEVMETHOD(device_detach,acpi_pci_detach),
 
/* Bus interface */
DEVMETHOD(bus_read_ivar,acpi_pci_read_ivar),
@@ -324,6 +328,108 @@ acpi_pci_probe(device_t dev)
return (ENXIO);
device_set_desc(dev, "ACPI PCI bus");
return (BUS_PROBE_DEFAULT);
+}
+
+static void
+acpi_pci_device_notify_handler(ACPI_HANDLE h, UINT32 notify, void *context)
+{
+   device_t child, dev;
+   ACPI_STATUS status;
+   int error;
+
+   dev = context;
+
+   switch (notify) {
+   case ACPI_NOTIFY_DEVICE_CHECK:
+   mtx_lock(&Giant);
+   BUS_RESCAN(dev);
+   mtx_unlock(&Giant);
+   break;
+   case ACPI_NOTIFY_EJECT_REQUEST:
+   child = acpi_get_device(h);
+   if (child == NULL) {
+   device_printf(dev, "no device to eject for %s\n",
+   acpi_name(h));
+   return;
+   }
+   mtx_lock(&Giant);
+   error = device_detach(child);
+   if (error) {
+   mtx_unlock(&Giant);
+   device_printf(dev, "failed to detach %s: %d\n",
+   device_get_nameunit(child), error);
+   return;
+   }
+   status = acpi_SetInteger(h, "_EJ0", 1);
+   if (ACPI_FAILURE(status)) {
+   mtx_unlock(&Giant);
+   device_printf(dev, "failed to eject %s: %s\n",
+   acpi_name(h), AcpiFormatException(status));
+   return;
+   }
+   BUS_RESCAN(dev);
+   mtx_unlock(&Giant);
+   break;
+   default:
+   device_printf(dev, "unknown notify %#x for %s\n", notify,
+   acpi_name(h));
+   break;
+   }
+}
+
+static ACPI_STATUS
+acpi_pci_install_device_notify_handler(ACPI_HANDLE handle, UINT32 level,
+void *context, void **status)
+{
+   ACPI_HANDLE h;
+
+   ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
+
+   if (ACPI_FAILURE(AcpiGetHandle(handle, "_EJ0", &h)))
+   return_ACPI_STATUS (AE_OK);
+
+   AcpiInstallNotifyHandler(handle, ACPI_SYSTEM_NOTIFY,
+   acpi_pci_device_notify_handler, context);
+   return_ACPI_STATUS (AE_OK);
+}
+
+static int
+acpi_pci_attach(device_t dev)
+{
+   int error;
+
+   error = pci_attach(dev);
+   if (error)
+   return (error);
+   AcpiWalkNamespace(ACPI_TYPE_DEVICE, acpi_get_handle(dev), 1,
+   acpi_pci_install_device_notify_handler, NULL, dev, NULL);
+  

svn commit: r353587 - head/sys/dev/acpica

2019-10-15 Thread John Baldwin
Author: jhb
Date: Tue Oct 15 19:12:09 2019
New Revision: 353587
URL: https://svnweb.freebsd.org/changeset/base/353587

Log:
  Install an ACPI PCI bus notify handler.
  
  Rescan a PCI bus when the ACPI_NOTIFY_BUS_CHECK event is posted to a
  PCI bus.
  
  Reviewed by:  scottl
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D21948

Modified:
  head/sys/dev/acpica/acpi_pci.c

Modified: head/sys/dev/acpica/acpi_pci.c
==
--- head/sys/dev/acpica/acpi_pci.c  Tue Oct 15 19:04:39 2019
(r353586)
+++ head/sys/dev/acpica/acpi_pci.c  Tue Oct 15 19:12:09 2019
(r353587)
@@ -331,6 +331,25 @@ acpi_pci_probe(device_t dev)
 }
 
 static void
+acpi_pci_bus_notify_handler(ACPI_HANDLE h, UINT32 notify, void *context)
+{
+   device_t dev;
+
+   dev = context;
+
+   switch (notify) {
+   case ACPI_NOTIFY_BUS_CHECK:
+   mtx_lock(&Giant);
+   BUS_RESCAN(dev);
+   mtx_unlock(&Giant);
+   break;
+   default:
+   device_printf(dev, "unknown notify %#x\n", notify);
+   break;
+   }
+}
+
+static void
 acpi_pci_device_notify_handler(ACPI_HANDLE h, UINT32 notify, void *context)
 {
device_t child, dev;
@@ -401,6 +420,8 @@ acpi_pci_attach(device_t dev)
error = pci_attach(dev);
if (error)
return (error);
+   AcpiInstallNotifyHandler(acpi_get_handle(dev), ACPI_SYSTEM_NOTIFY,
+   acpi_pci_bus_notify_handler, dev);
AcpiWalkNamespace(ACPI_TYPE_DEVICE, acpi_get_handle(dev), 1,
acpi_pci_install_device_notify_handler, NULL, dev, NULL);

@@ -429,6 +450,8 @@ acpi_pci_detach(device_t dev)
 
AcpiWalkNamespace(ACPI_TYPE_DEVICE, acpi_get_handle(dev), 1,
acpi_pci_remove_notify_handler, NULL, dev, NULL);
+   AcpiRemoveNotifyHandler(acpi_get_handle(dev), ACPI_SYSTEM_NOTIFY,
+   acpi_pci_bus_notify_handler);
return (pci_detach(dev));
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r353588 - in head: share/man/man3 sys/sys

2019-10-15 Thread Edward Tomasz Napierala
Author: trasz
Date: Tue Oct 15 19:44:43 2019
New Revision: 353588
URL: https://svnweb.freebsd.org/changeset/base/353588

Log:
  Add copyrights that I forgot to add when splitting arb.h off from tree.h.
  While here clean up the RCS tags.
  
  Suggested by: lstewart
  MFC after:2 weeks
  Sponsored by: Klara Inc, Netflix

Modified:
  head/share/man/man3/arb.3
  head/sys/sys/arb.h

Modified: head/share/man/man3/arb.3
==
--- head/share/man/man3/arb.3   Tue Oct 15 19:12:09 2019(r353587)
+++ head/share/man/man3/arb.3   Tue Oct 15 19:44:43 2019(r353588)
@@ -1,6 +1,7 @@
 .\"$OpenBSD: tree.3,v 1.7 2002/06/12 01:09:20 provos Exp $
 .\"
 .\" Copyright 2002 Niels Provos 
+.\" Copyright 2018-2019 Netflix, Inc.
 .\" All rights reserved.
 .\"
 .\" Redistribution and use in source and binary forms, with or without

Modified: head/sys/sys/arb.h
==
--- head/sys/sys/arb.h  Tue Oct 15 19:12:09 2019(r353587)
+++ head/sys/sys/arb.h  Tue Oct 15 19:44:43 2019(r353588)
@@ -1,11 +1,8 @@
-/* $NetBSD: tree.h,v 1.8 2004/03/28 19:38:30 provos Exp $  */
-/* $OpenBSD: tree.h,v 1.7 2002/10/17 21:51:54 art Exp $*/
-/* $FreeBSD$ */
-
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  *
  * Copyright 2002 Niels Provos 
+ * Copyright 2018-2019 Netflix, Inc.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -27,6 +24,8 @@
  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
  */
 
 #ifndef_SYS_ARB_H_
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r353539 - in head/sys: amd64/sgx cddl/contrib/opensolaris/uts/common/fs/zfs compat/linuxkpi/common/src dev/drm2/ttm dev/md dev/netmap dev/xen/gntdev dev/xen/privcmd fs/nfsclient fs/smb

2019-10-15 Thread Oliver Pinter
On Tuesday, October 15, 2019, Jeff Roberson  wrote:

> Author: jeff
> Date: Tue Oct 15 03:45:41 2019
> New Revision: 353539
> URL: https://svnweb.freebsd.org/changeset/base/353539
>
> Log:
>   (4/6) Protect page valid with the busy lock.
>
>   Atomics are used for page busy and valid state when the shared busy is
>   held.  The details of the locking protocol and valid and dirty
>   synchronization are in the updated vm_page.h comments.
>
>   Reviewed by:kib, markj
>   Tested by:  pho
>   Sponsored by:   Netflix, Intel
>   Differential Revision:https://reviews.freebsd.org/D21594
>
> Modified:
>   head/sys/amd64/sgx/sgx.c
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
>   head/sys/compat/linuxkpi/common/src/linux_compat.c
>   head/sys/dev/drm2/ttm/ttm_bo_vm.c
>   head/sys/dev/drm2/ttm/ttm_tt.c
>   head/sys/dev/md/md.c
>   head/sys/dev/netmap/netmap_freebsd.c
>   head/sys/dev/xen/gntdev/gntdev.c
>   head/sys/dev/xen/privcmd/privcmd.c
>   head/sys/fs/nfsclient/nfs_clbio.c
>   head/sys/fs/smbfs/smbfs_io.c
>   head/sys/fs/tmpfs/tmpfs_subr.c
>   head/sys/kern/kern_exec.c
>   head/sys/kern/uipc_shm.c
>   head/sys/kern/vfs_bio.c
>   head/sys/kern/vfs_cluster.c
>   head/sys/vm/device_pager.c
>   head/sys/vm/phys_pager.c
>   head/sys/vm/sg_pager.c
>   head/sys/vm/swap_pager.c
>   head/sys/vm/vm_fault.c
>   head/sys/vm/vm_map.c
>   head/sys/vm/vm_mmap.c
>   head/sys/vm/vm_object.c
>   head/sys/vm/vm_page.c
>   head/sys/vm/vm_page.h
>   head/sys/vm/vm_pageout.c
>   head/sys/vm/vm_swapout.c
>   head/sys/vm/vnode_pager.c
>
> Modified: head/sys/amd64/sgx/sgx.c
> 
> ==
> --- head/sys/amd64/sgx/sgx.cTue Oct 15 03:41:36 2019(r353538)
> +++ head/sys/amd64/sgx/sgx.cTue Oct 15 03:45:41 2019(r353539)
> @@ -220,8 +220,8 @@ sgx_va_slot_init_by_index(struct sgx_softc *sc, vm_obj
>
> page = PHYS_TO_VM_PAGE(epc->phys);
>
> -   vm_page_insert(page, object, idx);
> page->valid = VM_PAGE_BITS_ALL;


This wouldn't be vm_page_valid(page)?


> +   vm_page_insert(page, object, idx);
> }
>
> return (0);
> @@ -610,8 +610,8 @@ sgx_insert_epc_page_by_index(vm_page_t page, vm_object
>
> VM_OBJECT_ASSERT_WLOCKED(object);
>
> -   vm_page_insert(page, object, pidx);
> page->valid = VM_PAGE_BITS_ALL;


And here too?


> +   vm_page_insert(page, object, pidx);
>  }
>
>  static void
>
> Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
> 
> ==
> --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c   Tue Oct
> 15 03:41:36 2019(r353538)
> +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c   Tue Oct
> 15 03:45:41 2019(r353539)
> @@ -1731,11 +1731,13 @@ dmu_read_pages(objset_t *os, uint64_t object,
> vm_page_
> db = dbp[0];
> for (i = 0; i < *rbehind; i++) {
> m = vm_page_grab(vmobj, ma[0]->pindex - 1 - i,
> -   VM_ALLOC_NORMAL | VM_ALLOC_NOWAIT | VM_ALLOC_NOBUSY);
> +   VM_ALLOC_NORMAL | VM_ALLOC_NOWAIT |
> +   VM_ALLOC_SBUSY | VM_ALLOC_IGN_SBUSY);
> if (m == NULL)
> break;
> -   if (m->valid != 0) {
> +   if (!vm_page_none_valid(m)) {
> ASSERT3U(m->valid, ==, VM_PAGE_BITS_ALL);
> +   vm_page_sunbusy(m);
> break;
> }
> ASSERT(m->dirty == 0);
> @@ -1746,13 +1748,14 @@ dmu_read_pages(objset_t *os, uint64_t object,
> vm_page_
> va = zfs_map_page(m, &sf);
> bcopy((char *)db->db_data + bufoff, va, PAGESIZE);
> zfs_unmap_page(sf);
> -   m->valid = VM_PAGE_BITS_ALL;
> +   vm_page_valid(m);
> vm_page_lock(m);
> if ((m->busy_lock & VPB_BIT_WAITERS) != 0)
> vm_page_activate(m);
> else
> vm_page_deactivate(m);
> vm_page_unlock(m);
> +   vm_page_sunbusy(m);
> }
> *rbehind = i;
>
> @@ -1763,7 +1766,7 @@ dmu_read_pages(objset_t *os, uint64_t object,
> vm_page_
> m = ma[mi];
> if (m != bogus_page) {
> vm_page_assert_xbusied(m);
> -   ASSERT(m->valid == 0);
> +   ASSERT(vm_page_none_valid(m));
> ASSERT(m->dirty == 0);
> ASSERT(!pmap_page_is_mapped(m));
> va = zfs_map_page(m, &sf);
> @@ -1791,7 +1794,7 @@ dmu_read_pages(objset_t *os, uint64_t object,
> vm_page_
>

svn commit: r353592 - in head: . share/mk

2019-10-15 Thread Brooks Davis
Author: brooks
Date: Tue Oct 15 21:08:49 2019
New Revision: 353592
URL: https://svnweb.freebsd.org/changeset/base/353592

Log:
  Move the per-ARCH definitions to bsd.compat.mk.
  
  This is the first step if refactoring the definitions to allow programs
  to be selectively linked against libcompat libraries.
  
  Reviewed by:  bdrewery
  Sponsored by: DARPA, AFRL

Added:
  head/share/mk/bsd.compat.mk   (contents, props changed)
Modified:
  head/Makefile.libcompat

Modified: head/Makefile.libcompat
==
--- head/Makefile.libcompat Tue Oct 15 20:10:47 2019(r353591)
+++ head/Makefile.libcompat Tue Oct 15 21:08:49 2019(r353592)
@@ -6,101 +6,7 @@ __<${_this:T}>__:
 # Makefile for the compatibility libraries.
 # - 32-bit compat libraries on MIPS, PowerPC, and AMD64.
 
-# ---
-# 32 bit world
-.if ${TARGET_ARCH} == "amd64"
-.if empty(TARGET_CPUTYPE)
-LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2
-.else
-LIB32CPUFLAGS= -march=${TARGET_CPUTYPE}
-.endif
-.if ${WANT_COMPILER_TYPE} == gcc || \
-(defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc)
-.else
-LIB32CPUFLAGS+=-target x86_64-unknown-freebsd13.0
-.endif
-LIB32CPUFLAGS+=-m32
-LIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \
-   MACHINE_CPU="i686 mmx sse sse2"
-LIB32WMAKEFLAGS=   \
-   AS="${XAS} --32" \
-   LD="${XLD} -m elf_i386_fbsd -L${LIBCOMPATTMP}/usr/lib32"
-
-.elif ${TARGET_ARCH} == "powerpc64"
-.if empty(TARGET_CPUTYPE)
-LIB32CPUFLAGS= -mcpu=powerpc
-.else
-LIB32CPUFLAGS= -mcpu=${TARGET_CPUTYPE}
-.endif
-LIB32CPUFLAGS+=-m32
-LIB32WMAKEENV= MACHINE=powerpc MACHINE_ARCH=powerpc
-LIB32WMAKEFLAGS=   \
-   LD="${XLD} -m elf32ppc_fbsd"
-
-.elif ${TARGET_ARCH:Mmips64*} != ""
-.if ${WANT_COMPILER_TYPE} == gcc || \
-(defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc)
-.if empty(TARGET_CPUTYPE)
-LIB32CPUFLAGS= -march=mips3
-.else
-LIB32CPUFLAGS= -march=${TARGET_CPUTYPE}
-.endif
-.else
-.if ${TARGET_ARCH:Mmips64el*} != ""
-LIB32CPUFLAGS=  -target mipsel-unknown-freebsd13.0
-.else
-LIB32CPUFLAGS=  -target mips-unknown-freebsd13.0
-.endif
-.endif
-LIB32CPUFLAGS+= -mabi=32
-LIB32WMAKEENV= MACHINE=mips MACHINE_ARCH=mips
-.if ${TARGET_ARCH:Mmips64el*} != ""
-LIB32WMAKEFLAGS= LD="${XLD} -m elf32ltsmip_fbsd"
-.else
-LIB32WMAKEFLAGS= LD="${XLD} -m elf32btsmip_fbsd"
-.endif
-.endif
-
-LIB32WMAKEFLAGS+= NM="${XNM}"
-LIB32WMAKEFLAGS+= OBJCOPY="${XOBJCOPY}"
-
-LIB32CFLAGS=   -DCOMPAT_32BIT
-LIB32DTRACE=   ${DTRACE} -32
-LIB32WMAKEFLAGS+=  -DCOMPAT_32BIT
-
-# ---
-# soft-fp world
-.if ${TARGET_ARCH:Marmv[67]*} != ""
-LIBSOFTCFLAGS=-DCOMPAT_SOFTFP
-LIBSOFTCPUFLAGS= -mfloat-abi=softfp
-LIBSOFTWMAKEENV= CPUTYPE=soft MACHINE=arm MACHINE_ARCH=${TARGET_ARCH}
-LIBSOFTWMAKEFLAGS=-DCOMPAT_SOFTFP
-.endif
-
-# ---
-# Generic code for each type.
-# Set defaults based on type.
-libcompat= ${LIBCOMPAT:tl}
-_LIBCOMPAT_MAKEVARS=   _OBJTOP TMP CPUFLAGS CFLAGS CXXFLAGS WMAKEENV \
-   WMAKEFLAGS WMAKE
-.for _var in ${_LIBCOMPAT_MAKEVARS}
-.if !empty(LIB${LIBCOMPAT}${_var})
-LIBCOMPAT${_var}?= ${LIB${LIBCOMPAT}${_var}}
-.endif
-.endfor
-
-# Shared flags
-LIBCOMPAT_OBJTOP?= ${OBJTOP}/obj-lib${libcompat}
-LIBCOMPATTMP?= ${LIBCOMPAT_OBJTOP}/tmp
-
-LIBCOMPATCFLAGS+=  ${LIBCOMPATCPUFLAGS} \
-   -L${LIBCOMPATTMP}/usr/lib${libcompat} \
-   --sysroot=${LIBCOMPATTMP} \
-   ${BFLAGS}
-
-# -B is needed to find /usr/lib32/crti.o for GCC and /usr/libsoft/crti.o for
-# Clang/GCC.
-LIBCOMPATCFLAGS+=  -B${LIBCOMPATTMP}/usr/lib${libcompat}
+.include 
 
 # Yes, the flags are redundant.
 LIBCOMPATWMAKEENV+= \

Added: head/share/mk/bsd.compat.mk
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/mk/bsd.compat.mk Tue Oct 15 21:08:49 2019(r353592)
@@ -0,0 +1,106 @@
+# $FreeBSD$
+
+.if !targets(__<${_this:T}>__)
+__<${_this:T}>__:
+
+# Makefile for the compatibility libraries.
+# - 32-bit compat libraries on MIPS, PowerPC, and AMD64.
+
+# ---
+# 32 bit world
+.if ${TARGET_ARCH} == "amd64"
+.if empty(TARGET_CPUTYPE)
+LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2
+.else
+LIB32CPUFLAGS= -march=${TARGET_CPUTYPE}
+.endif
+.if ${WANT_COMPILER_TYPE} == gcc || \
+(defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc)
+.else
+LIB32CPUFLAGS+=-target x86_64-unknown-freebsd13.0
+.endif
+LIB32CPUFLAGS+=-m32
+LIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \
+   MACHINE_CPU="i686 mmx sse sse2"
+LIB32WMAKEFLAGS=   \
+

svn commit: r353593 - in head: . share/mk

2019-10-15 Thread Brooks Davis
Author: brooks
Date: Tue Oct 15 21:11:22 2019
New Revision: 353593
URL: https://svnweb.freebsd.org/changeset/base/353593

Log:
  Rename top-level LIBCOMPAT to _LIBCOMPAT.
  
  This avoids a conflict with LIBCOMPAT defined in bsd.libnames.mk.
  
  Reviewed by:  bdrewery
  Sponsored by: DARPA, AFRL

Modified:
  head/Makefile.inc1
  head/share/mk/bsd.compat.mk

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Tue Oct 15 21:08:49 2019(r353592)
+++ head/Makefile.inc1  Tue Oct 15 21:11:22 2019(r353593)
@@ -804,10 +804,10 @@ XCFLAGS+= ${BFLAGS}
 
 .if ${MK_LIB32} != "no" && (${TARGET_ARCH} == "amd64" || \
 ${TARGET_ARCH} == "powerpc64" || ${TARGET_ARCH:Mmips64*} != "")
-LIBCOMPAT= 32
+_LIBCOMPAT= 32
 .include "Makefile.libcompat"
 .elif ${MK_LIBSOFT} != "no" && ${TARGET_ARCH:Marmv[67]*} != ""
-LIBCOMPAT= SOFT
+_LIBCOMPAT= SOFT
 .include "Makefile.libcompat"
 .endif
 
@@ -968,7 +968,7 @@ _cleanobj_fast_depend_hack: .PHONY
echo "Removing stale dependencies for memchr"; \
rm -f ${OBJTOP}/lib/libc/.depend.${f}.*; \
fi
-.if defined(LIBCOMPAT)
+.if defined(_LIBCOMPAT)
@if [ -e "${LIBCOMPAT_OBJTOP}/lib/libc/.depend.${f}.o" ] && \
egrep -qw 'i386/string/memchr\.S' 
${LIBCOMPAT_OBJTOP}/lib/libc/.depend.${f}.o; then \
echo "Removing stale dependencies for memchr"; \
@@ -983,7 +983,7 @@ _cleanobj_fast_depend_hack: .PHONY
egrep -qw '${f}\.[sS]' ${OBJTOP}/lib/libc/.depend.${f}.o; then \
echo "Removing stale dependencies for ${f} syscall wrappers"; \
rm -f ${OBJTOP}/lib/libc/.depend.${f}.* \
-  ${LIBCOMPAT:D${LIBCOMPAT_OBJTOP}/lib/libc/.depend.${f}.*}; \
+  ${_LIBCOMPAT:D${LIBCOMPAT_OBJTOP}/lib/libc/.depend.${f}.*}; \
fi
 .endfor
 # 20181013  r339348  bcopy reimplemented as .c
@@ -992,7 +992,7 @@ _cleanobj_fast_depend_hack: .PHONY
egrep -qw 'bcopy\.[sS]' ${OBJTOP}/lib/libc/.depend.${f}.o; then \
echo "Removing stale dependencies for bcopy"; \
rm -f ${OBJTOP}/lib/libc/.depend.${f}.* \
-  ${LIBCOMPAT:D${LIBCOMPAT_OBJTOP}/lib/libc/.depend.${f}.*}; \
+  ${_LIBCOMPAT:D${LIBCOMPAT_OBJTOP}/lib/libc/.depend.${f}.*}; \
fi
 .endfor
 # 20181115  r340463  bzero reimplemented as .c
@@ -1000,7 +1000,7 @@ _cleanobj_fast_depend_hack: .PHONY
egrep -qw 'bzero\.[sS]' ${OBJTOP}/lib/libc/.depend.bzero.o; then \
echo "Removing stale dependencies for bzero"; \
rm -f ${OBJTOP}/lib/libc/.depend.bzero.* \
-  ${LIBCOMPAT:D${LIBCOMPAT_OBJTOP}/lib/libc/.depend.bzero.*}; \
+  ${_LIBCOMPAT:D${LIBCOMPAT_OBJTOP}/lib/libc/.depend.bzero.*}; 
\
fi
 # 20181009 track migration from ntp's embedded libevent to updated one
@if [ -e 
"${OBJTOP}/usr.sbin/ntp/libntpevent/.depend.bufferevent_openssl.o" ] && \
@@ -1094,7 +1094,7 @@ _cleanobj:
# Avoid including bsd.compiler.mk in clean and obj with 
_NO_INCLUDE_COMPILERMK
# since the restricted $PATH might not contain a valid cc binary
${_+_}cd ${.CURDIR}; ${WMAKE} _NO_INCLUDE_COMPILERMK=t ${CLEANDIR}
-.if defined(LIBCOMPAT)
+.if defined(_LIBCOMPAT)
${_+_}cd ${.CURDIR}; ${LIBCOMPATWMAKE} _NO_INCLUDE_COMPILERMK=t -f 
Makefile.inc1 ${CLEANDIR}
 .endif
 .else
@@ -1172,7 +1172,7 @@ WMAKE_TGTS+=  _includes
 WMAKE_TGTS+=   _libraries
 .endif
 WMAKE_TGTS+=   everything
-.if defined(LIBCOMPAT) && empty(SUBDIR_OVERRIDE)
+.if defined(_LIBCOMPAT) && empty(SUBDIR_OVERRIDE)
 WMAKE_TGTS+=   build${libcompat}
 .endif
 
@@ -1345,7 +1345,7 @@ ITOOLS+=makewhatis
 
 # Non-base distributions produced by the base system
 EXTRA_DISTRIBUTIONS=
-.if defined(LIBCOMPAT)
+.if defined(_LIBCOMPAT)
 EXTRA_DISTRIBUTIONS+=  lib${libcompat}
 .endif
 .if ${MK_TESTS} != "no"
@@ -1398,7 +1398,7 @@ distributeworld installworld stageworld: _installcheck
${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
-p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib >/dev/null
 .endif
-.if defined(LIBCOMPAT)
+.if defined(_LIBCOMPAT)
${DESTDIR_MTREE} -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \
-p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null
 .if ${MK_DEBUG_FILES} != "no"
@@ -1422,7 +1422,7 @@ distributeworld installworld stageworld: _installcheck
sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG}
${IMAKEENV} ${MTREE} -C -f ${.CURDIR}/etc/mtree/BSD.include.dist | \
sed -e 's#^\./#./${dist}/usr/include/#' >> ${METALOG}
-.if defined(LIBCOMPAT)
+.if defined(_LIBCOMPAT)
${IMAKEENV} ${MTREE} -C -f 
${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist | \
sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG}
 .endif
@@ -1533,7 +1533,7 @@ restage reinstall: .MAKE .PHONY
@echo ">>> Installing everything started on `LC_ALL=C date`"
   

svn commit: r353594 - head/share/mk

2019-10-15 Thread Brooks Davis
Author: brooks
Date: Tue Oct 15 21:15:03 2019
New Revision: 353594
URL: https://svnweb.freebsd.org/changeset/base/353594

Log:
  Allow OBJDIR to be overridden for LIB*DIR variables.
  
  This will allow us to link against internal libraries when building
  programs for the system's LIBCOMPAT ABI.
  
  Reviewed by:  bdrewery
  Obtained from:CheriBSD
  Sponsored by: DARPA, AFRL

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

Modified: head/share/mk/src.libnames.mk
==
--- head/share/mk/src.libnames.mk   Tue Oct 15 21:11:22 2019
(r353593)
+++ head/share/mk/src.libnames.mk   Tue Oct 15 21:15:03 2019
(r353594)
@@ -462,76 +462,77 @@ DPADD+=   ${DPADD_${_l}}
 LDADD+=${LDADD_${_l}}
 .endfor
 
+_LIB_OBJTOP?=  ${OBJTOP}
 # INTERNALLIB definitions.
-LIBELFTCDIR=   ${OBJTOP}/lib/libelftc
+LIBELFTCDIR=   ${_LIB_OBJTOP}/lib/libelftc
 LIBELFTC?= ${LIBELFTCDIR}/libelftc${PIE_SUFFIX}.a
 
-LIBPEDIR=  ${OBJTOP}/lib/libpe
+LIBPEDIR=  ${_LIB_OBJTOP}/lib/libpe
 LIBPE?=${LIBPEDIR}/libpe${PIE_SUFFIX}.a
 
-LIBOPENBSDDIR= ${OBJTOP}/lib/libopenbsd
+LIBOPENBSDDIR= ${_LIB_OBJTOP}/lib/libopenbsd
 LIBOPENBSD?=   ${LIBOPENBSDDIR}/libopenbsd${PIE_SUFFIX}.a
 
-LIBSMDIR=  ${OBJTOP}/lib/libsm
+LIBSMDIR=  ${_LIB_OBJTOP}/lib/libsm
 LIBSM?=${LIBSMDIR}/libsm${PIE_SUFFIX}.a
 
-LIBSMDBDIR=${OBJTOP}/lib/libsmdb
+LIBSMDBDIR=${_LIB_OBJTOP}/lib/libsmdb
 LIBSMDB?=  ${LIBSMDBDIR}/libsmdb${PIE_SUFFIX}.a
 
-LIBSMUTILDIR=  ${OBJTOP}/lib/libsmutil
+LIBSMUTILDIR=  ${_LIB_OBJTOP}/lib/libsmutil
 LIBSMUTIL?=${LIBSMUTILDIR}/libsmutil${PIE_SUFFIX}.a
 
-LIBNETBSDDIR?= ${OBJTOP}/lib/libnetbsd
+LIBNETBSDDIR?= ${_LIB_OBJTOP}/lib/libnetbsd
 LIBNETBSD?=${LIBNETBSDDIR}/libnetbsd${PIE_SUFFIX}.a
 
-LIBVERSDIR?=   ${OBJTOP}/kerberos5/lib/libvers
+LIBVERSDIR?=   ${_LIB_OBJTOP}/kerberos5/lib/libvers
 LIBVERS?=  ${LIBVERSDIR}/libvers${PIE_SUFFIX}.a
 
-LIBSLDIR=  ${OBJTOP}/kerberos5/lib/libsl
+LIBSLDIR=  ${_LIB_OBJTOP}/kerberos5/lib/libsl
 LIBSL?=${LIBSLDIR}/libsl${PIE_SUFFIX}.a
 
-LIBIFCONFIGDIR=${OBJTOP}/lib/libifconfig
+LIBIFCONFIGDIR=${_LIB_OBJTOP}/lib/libifconfig
 LIBIFCONFIG?=  ${LIBIFCONFIGDIR}/libifconfig${PIE_SUFFIX}.a
 
-LIBIPFDIR= ${OBJTOP}/sbin/ipf/libipf
+LIBIPFDIR= ${_LIB_OBJTOP}/sbin/ipf/libipf
 LIBIPF?=   ${LIBIPFDIR}/libipf${PIE_SUFFIX}.a
 
-LIBTELNETDIR=  ${OBJTOP}/lib/libtelnet
+LIBTELNETDIR=  ${_LIB_OBJTOP}/lib/libtelnet
 LIBTELNET?=${LIBTELNETDIR}/libtelnet${PIE_SUFFIX}.a
 
-LIBCRONDIR=${OBJTOP}/usr.sbin/cron/lib
+LIBCRONDIR=${_LIB_OBJTOP}/usr.sbin/cron/lib
 LIBCRON?=  ${LIBCRONDIR}/libcron${PIE_SUFFIX}.a
 
-LIBNTPDIR= ${OBJTOP}/usr.sbin/ntp/libntp
+LIBNTPDIR= ${_LIB_OBJTOP}/usr.sbin/ntp/libntp
 LIBNTP?=   ${LIBNTPDIR}/libntp${PIE_SUFFIX}.a
 
-LIBNTPEVENTDIR=${OBJTOP}/usr.sbin/ntp/libntpevent
+LIBNTPEVENTDIR=${_LIB_OBJTOP}/usr.sbin/ntp/libntpevent
 LIBNTPEVENT?=  ${LIBNTPEVENTDIR}/libntpevent${PIE_SUFFIX}.a
 
-LIBOPTSDIR=${OBJTOP}/usr.sbin/ntp/libopts
+LIBOPTSDIR=${_LIB_OBJTOP}/usr.sbin/ntp/libopts
 LIBOPTS?=  ${LIBOPTSDIR}/libopts${PIE_SUFFIX}.a
 
-LIBPARSEDIR=   ${OBJTOP}/usr.sbin/ntp/libparse
+LIBPARSEDIR=   ${_LIB_OBJTOP}/usr.sbin/ntp/libparse
 LIBPARSE?= ${LIBPARSEDIR}/libparse${PIE_SUFFIX}.a
 
-LIBLPRDIR= ${OBJTOP}/usr.sbin/lpr/common_source
+LIBLPRDIR= ${_LIB_OBJTOP}/usr.sbin/lpr/common_source
 LIBLPR?=   ${LIBLPRDIR}/liblpr${PIE_SUFFIX}.a
 
-LIBFIFOLOGDIR= ${OBJTOP}/usr.sbin/fifolog/lib
+LIBFIFOLOGDIR= ${_LIB_OBJTOP}/usr.sbin/fifolog/lib
 LIBFIFOLOG?=   ${LIBFIFOLOGDIR}/libfifolog${PIE_SUFFIX}.a
 
-LIBBSNMPTOOLSDIR=  ${OBJTOP}/usr.sbin/bsnmpd/tools/libbsnmptools
+LIBBSNMPTOOLSDIR=  ${_LIB_OBJTOP}/usr.sbin/bsnmpd/tools/libbsnmptools
 LIBBSNMPTOOLS?=${LIBBSNMPTOOLSDIR}/libbsnmptools${PIE_SUFFIX}.a
 
-LIBAMUDIR= ${OBJTOP}/usr.sbin/amd/libamu
+LIBAMUDIR= ${_LIB_OBJTOP}/usr.sbin/amd/libamu
 LIBAMU?=   ${LIBAMUDIR}/libamu${PIE_SUFFIX}.a
 
 LIBBE?=${LIBBEDIR}/libbe${PIE_SUFFIX}.a
 
-LIBPMCSTATDIR= ${OBJTOP}/lib/libpmcstat
+LIBPMCSTATDIR= ${_LIB_OBJTOP}/lib/libpmcstat
 LIBPMCSTAT?=   ${LIBPMCSTATDIR}/libpmcstat${PIE_SUFFIX}.a
 
-LIBC_NOSSP_PICDIR= ${OBJTOP}/lib/libc
+LIBC_NOSSP_PICDIR= ${_LIB_OBJTOP}/lib/libc
 LIBC_NOSSP_PIC?=   ${LIBC_NOSSP_PICDIR}/libc_nossp_pic.a
 
 # Define a directory for each library.  This is useful for adding -L in when
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r353595 - head

2019-10-15 Thread Brooks Davis
Author: brooks
Date: Tue Oct 15 21:22:13 2019
New Revision: 353595
URL: https://svnweb.freebsd.org/changeset/base/353595

Log:
  Build compat libraries before "everything".
  
  This is required for us to link programs against compat versions of
  libraries.
  
  Reviewed by:  bdrewery, jhb
  Sponsored by: DARPA, AFRL

Modified:
  head/Makefile.inc1
  head/Makefile.libcompat

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Tue Oct 15 21:15:03 2019(r353594)
+++ head/Makefile.inc1  Tue Oct 15 21:22:13 2019(r353595)
@@ -1150,7 +1150,7 @@ _libraries:
 everything: .PHONY
@echo
@echo "--"
-   @echo ">>> stage 4.3: building everything"
+   @echo ">>> stage 4.4: building everything"
@echo "--"
${_+_}cd ${.CURDIR}; _PARALLEL_SUBDIR_OK=1 ${WMAKE} all
 
@@ -1171,10 +1171,10 @@ WMAKE_TGTS+=_includes
 .if !defined(NO_LIBS)
 WMAKE_TGTS+=   _libraries
 .endif
-WMAKE_TGTS+=   everything
 .if defined(_LIBCOMPAT) && empty(SUBDIR_OVERRIDE)
 WMAKE_TGTS+=   build${libcompat}
 .endif
+WMAKE_TGTS+=   everything
 
 # record buildworld time in seconds
 .if make(buildworld)

Modified: head/Makefile.libcompat
==
--- head/Makefile.libcompat Tue Oct 15 21:15:03 2019(r353594)
+++ head/Makefile.libcompat Tue Oct 15 21:22:13 2019(r353595)
@@ -61,7 +61,7 @@ _jevents= lib/libpmc/pmu-events
 build${libcompat}: .PHONY
@echo
@echo "--"
-   @echo ">>> stage 5.1: building lib${libcompat} shim libraries"
+   @echo ">>> stage 4.3: building lib${libcompat} shim libraries"
@echo "--"
 .if !defined(NO_CLEAN)
rm -rf ${LIBCOMPATTMP}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r353596 - in head/sys: kern sys

2019-10-15 Thread Gleb Smirnoff
Author: glebius
Date: Tue Oct 15 21:24:25 2019
New Revision: 353596
URL: https://svnweb.freebsd.org/changeset/base/353596

Log:
  When assertion for a thread not being in an epoch fails also print all
  entered epochs. Works with EPOCH_TRACE only.
  
  Reviewed by:  hselasky
  Differential Revision:https://reviews.freebsd.org/D22017

Modified:
  head/sys/kern/kern_malloc.c
  head/sys/kern/kern_synch.c
  head/sys/kern/subr_epoch.c
  head/sys/kern/subr_trap.c
  head/sys/sys/epoch.h

Modified: head/sys/kern/kern_malloc.c
==
--- head/sys/kern/kern_malloc.c Tue Oct 15 21:22:13 2019(r353595)
+++ head/sys/kern/kern_malloc.c Tue Oct 15 21:24:25 2019(r353596)
@@ -520,6 +520,10 @@ malloc_dbg(caddr_t *vap, size_t *sizep, struct malloc_
if (flags & M_WAITOK) {
KASSERT(curthread->td_intr_nesting_level == 0,
   ("malloc(M_WAITOK) in interrupt context"));
+#ifdef EPOCH_TRACE
+   if (__predict_false(curthread->td_epochnest > 0))
+   epoch_trace_list(curthread);
+#endif
KASSERT(curthread->td_epochnest == 0,
("malloc(M_WAITOK) in epoch context")); 
}

Modified: head/sys/kern/kern_synch.c
==
--- head/sys/kern/kern_synch.c  Tue Oct 15 21:22:13 2019(r353595)
+++ head/sys/kern/kern_synch.c  Tue Oct 15 21:24:25 2019(r353596)
@@ -148,6 +148,10 @@ _sleep(void *ident, struct lock_object *lock, int prio
("sleeping without a lock"));
KASSERT(ident != NULL, ("_sleep: NULL ident"));
KASSERT(TD_IS_RUNNING(td), ("_sleep: curthread not running"));
+#ifdef EPOCH_TRACE
+   if (__predict_false(curthread->td_epochnest > 0))
+   epoch_trace_list(curthread);
+#endif
KASSERT(td->td_epochnest == 0, ("sleeping in an epoch section"));
if (priority & PDROP)
KASSERT(lock != NULL && lock != &Giant.lock_object,

Modified: head/sys/kern/subr_epoch.c
==
--- head/sys/kern/subr_epoch.c  Tue Oct 15 21:22:13 2019(r353595)
+++ head/sys/kern/subr_epoch.c  Tue Oct 15 21:24:25 2019(r353596)
@@ -234,6 +234,17 @@ epoch_trace_exit(struct thread *td, epoch_t epoch, epo
} else
SLIST_REMOVE_HEAD(&td->td_epochs, et_tlink);
 }
+
+/* Used by assertions that check thread state before going to sleep. */
+void
+epoch_trace_list(struct thread *td)
+{
+   epoch_tracker_t iet;
+
+   SLIST_FOREACH(iet, &td->td_epochs, et_tlink)
+   printf("Epoch %s entered at %s:%d\n", iet->et_epoch->e_name,
+   iet->et_file, iet->et_line);
+}
 #endif /* EPOCH_TRACE */
 
 static void

Modified: head/sys/kern/subr_trap.c
==
--- head/sys/kern/subr_trap.c   Tue Oct 15 21:22:13 2019(r353595)
+++ head/sys/kern/subr_trap.c   Tue Oct 15 21:24:25 2019(r353596)
@@ -166,6 +166,10 @@ userret(struct thread *td, struct trapframe *frame)
WITNESS_WARN(WARN_PANIC, NULL, "userret: returning");
KASSERT(td->td_critnest == 0,
("userret: Returning in a critical section"));
+#ifdef EPOCH_TRACE
+   if (__predict_false(curthread->td_epochnest > 0))
+   epoch_trace_list(curthread);
+#endif
KASSERT(td->td_epochnest == 0,
("userret: Returning in an epoch section"));
KASSERT(td->td_locks == 0,

Modified: head/sys/sys/epoch.h
==
--- head/sys/sys/epoch.hTue Oct 15 21:22:13 2019(r353595)
+++ head/sys/sys/epoch.hTue Oct 15 21:24:25 2019(r353596)
@@ -83,6 +83,7 @@ DPCPU_DECLARE(struct grouptask, epoch_cb_task);
 void _epoch_enter_preempt(epoch_t epoch, epoch_tracker_t et EPOCH_FILE_LINE);
 void _epoch_exit_preempt(epoch_t epoch, epoch_tracker_t et EPOCH_FILE_LINE);
 #ifdef EPOCH_TRACE
+void epoch_trace_list(struct thread *);
 #defineepoch_enter_preempt(epoch, et)  _epoch_enter_preempt(epoch, et, 
__FILE__, __LINE__)
 #defineepoch_exit_preempt(epoch, et)   _epoch_exit_preempt(epoch, et, 
__FILE__, __LINE__)
 #else
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r353597 - head/share/mk

2019-10-15 Thread Brooks Davis
Author: brooks
Date: Tue Oct 15 21:27:06 2019
New Revision: 353597
URL: https://svnweb.freebsd.org/changeset/base/353597

Log:
  Add the ability to link programs against a compat ABI.
  
  Linkage is controlled by two make knobs:
WANT_COMPAT - Prefer to link against the compat ABI.
NEED_COMPAT - Link against the compat ABI or fail to build.
  
  Supported values are "32", "soft", and "any".  The latter meaning pick
  the first[0] supported compat ABI.
  
  This can be used to provide test binaries for compat ABIs or to link
  ABI-specific programs.
  
  [0] We currently support only one compat ABI at a time, but this may
  change in the future and some code in this commit is structured to ease
  that change.
  
  Reviewed by:  bdrewery, jhb
  Obtained from:CheriBSD (in concept)
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D22023

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

Modified: head/share/mk/bsd.README
==
--- head/share/mk/bsd.READMETue Oct 15 21:24:25 2019(r353596)
+++ head/share/mk/bsd.READMETue Oct 15 21:27:06 2019(r353597)
@@ -17,6 +17,7 @@ files.  In most cases it is only interesting to includ
 bsd.lib.mk.
 
 bsd.arch.inc.mk- includes arch-specific Makefile.$arch
+bsd.compat.mk  - definitions for building programs against compat ABIs
 bsd.compiler.mk- defined based on current compiler
 bsd.confs.mk   - install of configuration files
 bsd.cpu.mk - sets CPU/arch-related variables (included from sys.mk)
@@ -378,6 +379,10 @@ LINKMODE   Mode of links created with LINKS [${BINMODE}]
 MANManual pages.  If no MAN variable is defined,
"MAN=${PROG}.1" is assumed. See bsd.man.mk for more details.
 
+NEED_COMPATBuild and link targeting a compatability ABI or fail if it
+   is not available.  Supported values are "32", "soft", and
+   "any" being a wildcard.
+
 PROG   The name of the program to build.  If not supplied, nothing
is built.
 
@@ -439,6 +444,9 @@ STRIP   The flag passed to the install program 
to cause
 SUBDIR A list of subdirectories that should be built as well.
Each of the targets will execute the same target in the
subdirectories.
+
+WANT_COMPATSimilar to NEED_COMPAT, but build with the base ABI if
+   the specified ABI is not available.
 
 The include file  includes the file named "../Makefile.inc"
 if it exists, as well as the include file .

Modified: head/share/mk/bsd.compat.mk
==
--- head/share/mk/bsd.compat.mk Tue Oct 15 21:24:25 2019(r353596)
+++ head/share/mk/bsd.compat.mk Tue Oct 15 21:27:06 2019(r353597)
@@ -3,18 +3,16 @@
 .if !targets(__<${_this:T}>__)
 __<${_this:T}>__:
 
-# Makefile for the compatibility libraries.
-# - 32-bit compat libraries on MIPS, PowerPC, and AMD64.
-
 # ---
 # 32 bit world
 .if ${TARGET_ARCH} == "amd64"
+HAS_COMPAT=32
 .if empty(TARGET_CPUTYPE)
 LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2
 .else
 LIB32CPUFLAGS= -march=${TARGET_CPUTYPE}
 .endif
-.if ${WANT_COMPILER_TYPE} == gcc || \
+.if (defined(WANT_COMPILER_TYPE) && ${WANT_COMPILER_TYPE} == gcc) || \
 (defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc)
 .else
 LIB32CPUFLAGS+=-target x86_64-unknown-freebsd13.0
@@ -27,6 +25,7 @@ LIB32WMAKEFLAGS=  \
LD="${XLD} -m elf_i386_fbsd -L${LIBCOMPATTMP}/usr/lib32"
 
 .elif ${TARGET_ARCH} == "powerpc64"
+HAS_COMPAT=32
 .if empty(TARGET_CPUTYPE)
 LIB32CPUFLAGS= -mcpu=powerpc
 .else
@@ -38,6 +37,7 @@ LIB32WMAKEFLAGS=  \
LD="${XLD} -m elf32ppc_fbsd"
 
 .elif ${TARGET_ARCH:Mmips64*} != ""
+HAS_COMPAT=32
 .if ${WANT_COMPILER_TYPE} == gcc || \
 (defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc)
 .if empty(TARGET_CPUTYPE)
@@ -71,13 +71,37 @@ LIB32WMAKEFLAGS+=   -DCOMPAT_32BIT
 # ---
 # soft-fp world
 .if ${TARGET_ARCH:Marmv[67]*} != ""
+HAS_COMPAT=SOFT
 LIBSOFTCFLAGS=-DCOMPAT_SOFTFP
 LIBSOFTCPUFLAGS= -mfloat-abi=softfp
 LIBSOFTWMAKEENV= CPUTYPE=soft MACHINE=arm MACHINE_ARCH=${TARGET_ARCH}
 LIBSOFTWMAKEFLAGS=-DCOMPAT_SOFTFP
 .endif
 
+# ---
+# In the program linking case, select LIBCOMPAT
+.if defined(NEED_COMPAT)
+.ifndef HAS_COMPAT
+.error NEED_COMPAT defined, but no LIBCOMPAT is available
+.elif !${HAS_COMPAT:M${NEED_COMPAT}} && ${NEED_COMPAT} != "any"
+.error NEED_COMPAT (${NEED_COMPAT}) defined, but not in HAS_COMPAT 
($HAS_COMPAT)
+.elif ${NEED_COMPAT} == "any"
+.endif
+.ifdef WANT_COMPAT
+.

svn commit: r353598 - head/sys/kern

2019-10-15 Thread Gleb Smirnoff
Author: glebius
Date: Tue Oct 15 21:32:38 2019
New Revision: 353598
URL: https://svnweb.freebsd.org/changeset/base/353598

Log:
  Missing from r353596.

Modified:
  head/sys/kern/kern_malloc.c
  head/sys/kern/kern_synch.c

Modified: head/sys/kern/kern_malloc.c
==
--- head/sys/kern/kern_malloc.c Tue Oct 15 21:27:06 2019(r353597)
+++ head/sys/kern/kern_malloc.c Tue Oct 15 21:32:38 2019(r353598)
@@ -65,6 +65,9 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#ifdef EPOCH_TRACE
+#include 
+#endif
 
 #include 
 #include 

Modified: head/sys/kern/kern_synch.c
==
--- head/sys/kern/kern_synch.c  Tue Oct 15 21:27:06 2019(r353597)
+++ head/sys/kern/kern_synch.c  Tue Oct 15 21:32:38 2019(r353598)
@@ -66,6 +66,9 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #endif
+#ifdef EPOCH_TRACE
+#include 
+#endif
 
 #include 
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2019-10-15 Thread Brooks Davis
On Tue, Oct 15, 2019 at 09:27:07PM +, Brooks Davis wrote:
> Author: brooks
> Date: Tue Oct 15 21:27:06 2019
> New Revision: 353597
> URL: https://svnweb.freebsd.org/changeset/base/353597
> 
> Log:
>   Add the ability to link programs against a compat ABI.
>   
>   Linkage is controlled by two make knobs:
>   WANT_COMPAT - Prefer to link against the compat ABI.
>   NEED_COMPAT - Link against the compat ABI or fail to build.
>   
>   Supported values are "32", "soft", and "any".  The latter meaning pick
>   the first[0] supported compat ABI.
>   
>   This can be used to provide test binaries for compat ABIs or to link
>   ABI-specific programs.
>   
>   [0] We currently support only one compat ABI at a time, but this may
>   change in the future and some code in this commit is structured to ease
>   that change.
>   
>   Reviewed by:bdrewery, jhb
>   Obtained from:  CheriBSD (in concept)
>   Sponsored by:   DARPA, AFRL
>   Differential Revision:  https://reviews.freebsd.org/D22023

This allows simple programs to build/link per the description.  More
work will be required to build programs that depend on things like
MACHINE_ARCH, but this gets the basics working.

-- Brooks


signature.asc
Description: PGP signature


Re: svn commit: r353539 - in head/sys: amd64/sgx cddl/contrib/opensolaris/uts/common/fs/zfs compat/linuxkpi/common/src dev/drm2/ttm dev/md dev/netmap dev/xen/gntdev dev/xen/privcmd fs/nfsclient fs/smb

2019-10-15 Thread Jeff Roberson

On Tue, 15 Oct 2019, Oliver Pinter wrote:




On Tuesday, October 15, 2019, Jeff Roberson  wrote:
  Author: jeff
  Date: Tue Oct 15 03:45:41 2019
  New Revision: 353539
  URL: https://svnweb.freebsd.org/changeset/base/353539

  Log:
  ? (4/6) Protect page valid with the busy lock.

  ? Atomics are used for page busy and valid state when the shared
  busy is
  ? held.? The details of the locking protocol and valid and dirty
  ? synchronization are in the updated vm_page.h comments.

  ? Reviewed by:? ? kib, markj
  ? Tested by:? ? ? pho
  ? Sponsored by:? ?Netflix, Intel
  ? Differential Revision:? ? ? ? https://reviews.freebsd.org/D21594

  Modified:
  ? head/sys/amd64/sgx/sgx.c
  ? head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
  ? head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
  ? head/sys/compat/linuxkpi/common/src/linux_compat.c
  ? head/sys/dev/drm2/ttm/ttm_bo_vm.c
  ? head/sys/dev/drm2/ttm/ttm_tt.c
  ? head/sys/dev/md/md.c
  ? head/sys/dev/netmap/netmap_freebsd.c
  ? head/sys/dev/xen/gntdev/gntdev.c
  ? head/sys/dev/xen/privcmd/privcmd.c
  ? head/sys/fs/nfsclient/nfs_clbio.c
  ? head/sys/fs/smbfs/smbfs_io.c
  ? head/sys/fs/tmpfs/tmpfs_subr.c
  ? head/sys/kern/kern_exec.c
  ? head/sys/kern/uipc_shm.c
  ? head/sys/kern/vfs_bio.c
  ? head/sys/kern/vfs_cluster.c
  ? head/sys/vm/device_pager.c
  ? head/sys/vm/phys_pager.c
  ? head/sys/vm/sg_pager.c
  ? head/sys/vm/swap_pager.c
  ? head/sys/vm/vm_fault.c
  ? head/sys/vm/vm_map.c
  ? head/sys/vm/vm_mmap.c
  ? head/sys/vm/vm_object.c
  ? head/sys/vm/vm_page.c
  ? head/sys/vm/vm_page.h
  ? head/sys/vm/vm_pageout.c
  ? head/sys/vm/vm_swapout.c
  ? head/sys/vm/vnode_pager.c

  Modified: head/sys/amd64/sgx/sgx.c
===
  ===
  --- head/sys/amd64/sgx/sgx.c? ? Tue Oct 15 03:41:36 2019? ? ? ? (r353538)
  +++ head/sys/amd64/sgx/sgx.c? ? Tue Oct 15 03:45:41 2019? ? ? ? (r353539)
  @@ -220,8 +220,8 @@ sgx_va_slot_init_by_index(struct sgx_softc
  *sc, vm_obj

  ? ? ? ? ? ? ? ? page = PHYS_TO_VM_PAGE(epc->phys);

  -?? ? ? ? ? ? ?vm_page_insert(page, object, idx);
  ? ? ? ? ? ? ? ? page->valid = VM_PAGE_BITS_ALL;


This wouldn't be vm_page_valid(page)??
?


I didn't change places that were not using normal synchronization.  This 
relies on the page being only visible in the current scope to protect 
valid as it does not acquire the busy field.


Jeff


  +?? ? ? ? ? ? ?vm_page_insert(page, object, idx);
  ? ? ? ? }

  ? ? ? ? return (0);
  @@ -610,8 +610,8 @@ sgx_insert_epc_page_by_index(vm_page_t page,
  vm_object

  ? ? ? ? VM_OBJECT_ASSERT_WLOCKED(object);

  -?? ? ?vm_page_insert(page, object, pidx);
  ? ? ? ? page->valid = VM_PAGE_BITS_ALL;


And here too??
?
  +?? ? ?vm_page_insert(page, object, pidx);


  ?}?static void

  Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
===
  ===
  --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c? ?Tue
  Oct 15 03:41:36 2019? ? ? ? (r353538)
  +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c? ?Tue
  Oct 15 03:45:41 2019? ? ? ? (r353539)
  @@ -1731,11 +1731,13 @@ dmu_read_pages(objset_t *os, uint64_t
  object, vm_page_
  ? ? ? ? db = dbp[0];
  ? ? ? ? for (i = 0; i < *rbehind; i++) {
  ? ? ? ? ? ? ? ? m = vm_page_grab(vmobj, ma[0]->pindex - 1 - i,
  -?? ? ? ? ? ? ? ? ?VM_ALLOC_NORMAL | VM_ALLOC_NOWAIT | VM_ALLOC_NOBUSY);
  +?? ? ? ? ? ? ? ? ?VM_ALLOC_NORMAL | VM_ALLOC_NOWAIT |
  +?? ? ? ? ? ? ? ? ?VM_ALLOC_SBUSY | VM_ALLOC_IGN_SBUSY);
  ? ? ? ? ? ? ? ? if (m == NULL)
  ? ? ? ? ? ? ? ? ? ? ? ? break;
  -?? ? ? ? ? ? ?if (m->valid != 0) {
  +?? ? ? ? ? ? ?if (!vm_page_none_valid(m)) {
  ? ? ? ? ? ? ? ? ? ? ? ? ASSERT3U(m->valid, ==, VM_PAGE_BITS_ALL);
  +?? ? ? ? ? ? ? ? ? ? ?vm_page_sunbusy(m);
  ? ? ? ? ? ? ? ? ? ? ? ? break;
  ? ? ? ? ? ? ? ? }
  ? ? ? ? ? ? ? ? ASSERT(m->dirty == 0);
  @@ -1746,13 +1748,14 @@ dmu_read_pages(objset_t *os, uint64_t
  object, vm_page_
  ? ? ? ? ? ? ? ? va = zfs_map_page(m, &sf);
  ? ? ? ? ? ? ? ? bcopy((char *)db->db_data + bufoff, va, PAGESIZE);
  ? ? ? ? ? ? ? ? zfs_unmap_page(sf);
  -?? ? ? ? ? ? ?m->valid = VM_PAGE_BITS_ALL;
  +?? ? ? ? ? ? ?vm_page_valid(m);
  ? ? ? ? ? ? ? ? vm_page_lock(m);
  ? ? ? ? ? ? ? ? if ((m->busy_lock & VPB_BIT_WAITERS) != 0)
  ? ? ? ? ? ? ? ? ? ? ? ? vm_page_activate(m);
  ? ? ? ? ? ? ? ? else
  ? ? ? ? ? ? ? ? ? ? ? ? vm_page_deactivate(m);
  ? ? ? ? ? ? ? ? vm_page_unlock(m);
  +?? ? ? ? ? ? ?vm_page_sunbusy(m);
  ? ? ? ? }
  ? ? ? ? *rbehind

svn commit: r353599 - head/sys/dev/ixgbe

2019-10-15 Thread Eric Joyner
Author: erj
Date: Tue Oct 15 21:56:19 2019
New Revision: 353599
URL: https://svnweb.freebsd.org/changeset/base/353599

Log:
  ixgbe: Disable EEE for backplane X550EM_X
  
  From Zach:
  Intel documentation indicates that backplane X550EM_X KR devices do not
  support Energy Efficient Ethernet. Prior to this patch, X552 devices
  (device ID 0x15AB) will crash the system when transitioning EEE state
  via sysctl.
  
  Signed-off-by: Zach Vargas 
  
  PR:   240320
  Submitted by: Zach Vargas 
  Reviewed by:  erj@
  MFC after:3 days
  Differential Revision:https://reviews.freebsd.org/D21673

Modified:
  head/sys/dev/ixgbe/if_ix.c

Modified: head/sys/dev/ixgbe/if_ix.c
==
--- head/sys/dev/ixgbe/if_ix.c  Tue Oct 15 21:32:38 2019(r353598)
+++ head/sys/dev/ixgbe/if_ix.c  Tue Oct 15 21:56:19 2019(r353599)
@@ -4414,7 +4414,7 @@ ixgbe_sysctl_eee_state(SYSCTL_HANDLER_ARGS)
if ((new_eee < 0) || (new_eee > 1))
return (EINVAL);
 
-   retval = adapter->hw.mac.ops.setup_eee(&adapter->hw, new_eee);
+   retval = ixgbe_setup_eee(&adapter->hw, new_eee);
if (retval) {
device_printf(dev, "Error in EEE setup: 0x%08X\n", retval);
return (EINVAL);
@@ -4467,8 +4467,6 @@ ixgbe_init_device_features(struct adapter *adapter)
case ixgbe_mac_X550EM_x:
adapter->feat_cap |= IXGBE_FEATURE_SRIOV;
adapter->feat_cap |= IXGBE_FEATURE_FDIR;
-   if (adapter->hw.device_id == IXGBE_DEV_ID_X550EM_X_KR)
-   adapter->feat_cap |= IXGBE_FEATURE_EEE;
break;
case ixgbe_mac_X550EM_a:
adapter->feat_cap |= IXGBE_FEATURE_SRIOV;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r353600 - in head/sys: kern sys

2019-10-15 Thread Kristof Provost
Author: kp
Date: Tue Oct 15 23:21:52 2019
New Revision: 353600
URL: https://svnweb.freebsd.org/changeset/base/353600

Log:
  Generalize ARM specific comments in devmap
  
  The comments in devmap are very ARM specific, this generalizes them for other
  architectures.
  
  Submitted by: Nicholas O'Brien 
  Reviewed by:  manu, philip
  Sponsored by: Axiado
  Differential Revision:https://reviews.freebsd.org/D22035

Modified:
  head/sys/kern/subr_devmap.c
  head/sys/sys/devmap.h

Modified: head/sys/kern/subr_devmap.c
==
--- head/sys/kern/subr_devmap.c Tue Oct 15 21:56:19 2019(r353599)
+++ head/sys/kern/subr_devmap.c Tue Oct 15 23:21:52 2019(r353600)
@@ -46,7 +46,7 @@ static boolean_t devmap_bootstrap_done = false;
  * The allocated-kva (akva) devmap table and metadata.  Platforms can call
  * devmap_add_entry() to add static device mappings to this table using
  * automatically allocated virtual addresses carved out of the top of kva 
space.
- * Allocation begins immediately below the ARM_VECTORS_HIGH address.
+ * Allocation begins immediately below the max kernel virtual address.
  */
 #defineAKVA_DEVMAP_MAX_ENTRIES 32
 static struct devmap_entry akva_devmap_entries[AKVA_DEVMAP_MAX_ENTRIES];
@@ -115,8 +115,8 @@ devmap_lastaddr()
  * physical address and size and a virtual address allocated from the top of
  * kva.  This automatically registers the akva table on the first call, so all 
a
  * platform has to do is call this routine to install as many mappings as it
- * needs and when initarm() calls devmap_bootstrap() it will pick up all the
- * entries in the akva table automatically.
+ * needs and when the platform-specific init function calls devmap_bootstrap()
+ * it will pick up all the entries in the akva table automatically.
  */
 void
 devmap_add_entry(vm_paddr_t pa, vm_size_t sz)
@@ -132,13 +132,13 @@ devmap_add_entry(vm_paddr_t pa, vm_size_t sz)
if (akva_devmap_idx == 0)
devmap_register_table(akva_devmap_entries);
 
+/* Allocate virtual address space from the top of kva downwards. */
+#ifdef __arm__
/*
-* Allocate virtual address space from the top of kva downwards.  If the
-* range being mapped is aligned and sized to 1MB boundaries then also
-* align the virtual address to the next-lower 1MB boundary so that we
-* end up with a nice efficient section mapping.
+* If the range being mapped is aligned and sized to 1MB boundaries then
+* also align the virtual address to the next-lower 1MB boundary so that
+* we end with a nice efficient section mapping.
 */
-#ifdef __arm__
if ((pa & 0x000f) == 0 && (sz & 0x000f) == 0) {
akva_devmap_vaddr = trunc_1mpage(akva_devmap_vaddr - sz);
} else
@@ -170,7 +170,8 @@ devmap_register_table(const struct devmap_entry *table
  * the previously-registered table is used.  This smooths transition from 
legacy
  * code that fills in a local table then calls this function passing that 
table,
  * and newer code that uses devmap_register_table() in platform-specific
- * code, then lets the common initarm() call this function with a NULL pointer.
+ * code, then lets the common platform-specific init function call this 
function
+ * with a NULL pointer.
  */
 void
 devmap_bootstrap(vm_offset_t l1pt, const struct devmap_entry *table)

Modified: head/sys/sys/devmap.h
==
--- head/sys/sys/devmap.h   Tue Oct 15 21:56:19 2019(r353599)
+++ head/sys/sys/devmap.h   Tue Oct 15 23:21:52 2019(r353600)
@@ -63,16 +63,18 @@ void devmap_add_entry(vm_paddr_t pa, vm_size_t sz);
 
 /*
  * Register a platform-local table to be bootstrapped by the generic
- * initarm() in arm/machdep.c.  This is used by newer code that allocates and
- * fills in its own local table but does not have its own initarm() routine.
+ * platform-specific init function in /machdep.c.  This is used by newer
+ * code that allocates and fills in its own local table but does not have its
+ * own platform-specific init routine.
  */
 void devmap_register_table(const struct devmap_entry * _table);
 
 /*
  * Establish mappings for all the entries in the table.  This is called
- * automatically from the common initarm() in arm/machdep.c, and also from the
- * custom initarm() routines in older code.  If the table pointer is NULL, this
- * will use the table installed previously by devmap_register_table().
+ * automatically from the common platform-specific init function in
+ * /machdep.c, and also from the custom platform-specific init routines
+ * in older code.  If the table pointer is NULL, this will use the table
+ * installed previously by devmap_register_table().
  */
 void devmap_bootstrap(vm_offset_t _l1pt,
 const struct devmap_entry *_table);
_

svn commit: r353601 - head/share/mk

2019-10-15 Thread Brooks Davis
Author: brooks
Date: Tue Oct 15 23:54:51 2019
New Revision: 353601
URL: https://svnweb.freebsd.org/changeset/base/353601

Log:
  Fix including bsd.compat.mk outside Makefile.libcompat on mips64.
  
  Reported by:  jhb, jenkins

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

Modified: head/share/mk/bsd.compat.mk
==
--- head/share/mk/bsd.compat.mk Tue Oct 15 23:21:52 2019(r353600)
+++ head/share/mk/bsd.compat.mk Tue Oct 15 23:54:51 2019(r353601)
@@ -38,7 +38,7 @@ LIB32WMAKEFLAGS=  \
 
 .elif ${TARGET_ARCH:Mmips64*} != ""
 HAS_COMPAT=32
-.if ${WANT_COMPILER_TYPE} == gcc || \
+.if (defined(WANT_COMPILER_TYPE) && ${WANT_COMPILER_TYPE} == gcc) || \
 (defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc)
 .if empty(TARGET_CPUTYPE)
 LIB32CPUFLAGS= -march=mips3
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r353603 - in head/sys: conf powerpc/amigaone

2019-10-15 Thread Justin Hibbits
Author: jhibbits
Date: Wed Oct 16 00:38:50 2019
New Revision: 353603
URL: https://svnweb.freebsd.org/changeset/base/353603

Log:
  powerpc: Add AmigaOne platform, a subclass of MPC85xx
  
  Summary:
  The AmigaOne platform, encompassing the X5000 and A1222 at this time, is
  based on the mpc85xx platform, but includes some things not listed in
  the device tree.  Some custom devices, like CPLD, could be added to the
  device tree with an overlay, or other means.  However, some cannot
  easily be done, such as the power button interrupt.
  
  The directory will also become a location to add AmigaOne platform drivers,
  such as the aforementioned CPLD, and its children.
  
  Reviewed by:  bdragon
  Differential Revision:https://reviews.freebsd.org/D21829

Added:
  head/sys/powerpc/amigaone/
  head/sys/powerpc/amigaone/platform_amigaone.c   (contents, props changed)
Modified:
  head/sys/conf/files.powerpc
  head/sys/conf/options.powerpc

Modified: head/sys/conf/files.powerpc
==
--- head/sys/conf/files.powerpc Wed Oct 16 00:13:27 2019(r353602)
+++ head/sys/conf/files.powerpc Wed Oct 16 00:38:50 2019(r353603)
@@ -107,6 +107,7 @@ powerpc/aim/moea64_if.m optionalaim
 powerpc/aim/moea64_native.coptionalaim
 powerpc/aim/mp_cpudep.coptionalaim
 powerpc/aim/slb.c  optionalaim powerpc64
+powerpc/amigaone/platform_amigaone.c   optionalamigaone
 powerpc/booke/locore.S optionalbooke no-obj
 powerpc/booke/booke_machdep.c  optionalbooke
 powerpc/booke/machdep_e500.c   optionalbooke_e500

Modified: head/sys/conf/options.powerpc
==
--- head/sys/conf/options.powerpc   Wed Oct 16 00:13:27 2019
(r353602)
+++ head/sys/conf/options.powerpc   Wed Oct 16 00:38:50 2019
(r353603)
@@ -20,6 +20,8 @@ GFB_NO_FONT_LOADING   opt_gfb.h
 GFB_NO_MODE_CHANGE opt_gfb.h
 
 MOEA64_STATS   opt_pmap.h
+AMIGAONE   opt_platform.h
+MIKROTIK   opt_platform.h
 MPC85XXopt_platform.h
 POWERMAC   opt_platform.h
 PS3opt_platform.h
@@ -35,4 +37,3 @@ OFWCONS_POLL_HZ   opt_ofw.h
 # AGP debugging support
 AGP_DEBUG  opt_agp.h
 
-MIKROTIK

Added: head/sys/powerpc/amigaone/platform_amigaone.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/powerpc/amigaone/platform_amigaone.c   Wed Oct 16 00:38:50 
2019(r353603)
@@ -0,0 +1,123 @@
+/*-
+ * Copyright (c) 2019 Justin Hibbits
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 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 ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+
+#include "platform_if.h"
+
+static void aeon_pbutton_intr(void *_unused);
+static void aeon_setup_intr(void *unused);
+
+static int aeon_probe(platform_t);
+static int aeon_attach(platform_t);
+
+static platform_method_t aeon_methods[] = {
+   PLATFORMMETHOD(platform_probe,  aeon_probe),
+   PLATFORMMETHOD(platform_attach, aeon_attach),
+   PLATFORMMETHOD_END
+};
+
+DEFINE_CLASS_1(aeon, aeon_platform, aeon_methods, 0, mpc85xx_platform);
+
+PLATFORM_DEF(aeon_platform);
+
+static bool is_aeon;
+
+static int
+aeon_probe(platform_t plat)
+{
+   phandle_t rootnode;
+   char model[32];
+
+   rootnode = OF_finddevice("/");
+
+   if (OF_getprop(rootnode, "model", model, sizeof(model)

svn commit: r353604 - head/sys/powerpc/mpc85xx

2019-10-15 Thread Justin Hibbits
Author: jhibbits
Date: Wed Oct 16 03:03:59 2019
New Revision: 353604
URL: https://svnweb.freebsd.org/changeset/base/353604

Log:
  powerpc/mpc85xx: Fix function type for fsl_pcib_error_intr()
  
  Since it's only called as an interrupt handler, fsl_pcib_eror_intr() should 
just
  match the driver_intr_t type.
  
  Reported by:  bdragon

Modified:
  head/sys/powerpc/mpc85xx/pci_mpc85xx.c

Modified: head/sys/powerpc/mpc85xx/pci_mpc85xx.c
==
--- head/sys/powerpc/mpc85xx/pci_mpc85xx.c  Wed Oct 16 00:38:50 2019
(r353603)
+++ head/sys/powerpc/mpc85xx/pci_mpc85xx.c  Wed Oct 16 03:03:59 2019
(r353604)
@@ -228,7 +228,7 @@ DEFINE_CLASS_1(pcib, fsl_pcib_driver, fsl_pcib_methods
 EARLY_DRIVER_MODULE(pcib, ofwbus, fsl_pcib_driver, fsl_pcib_devclass, 0, 0,
 BUS_PASS_BUS);
 
-static int
+static void
 fsl_pcib_err_intr(void *v)
 {
struct fsl_pcib_softc *sc;
@@ -253,8 +253,6 @@ fsl_pcib_err_intr(void *v)
 
/* Clear pending errors */
bus_space_write_4(sc->sc_bst, sc->sc_bsh, REG_PEX_ERR_DR, clear_reg);
-
-   return (0);
 }
 
 static int
@@ -380,7 +378,7 @@ fsl_pcib_attach(device_t dev)
 
/* Setup interrupt handler */
error = bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_MISC | 
INTR_MPSAFE,
-   NULL, (driver_intr_t *)fsl_pcib_err_intr, dev, &sc->sc_ih);
+   NULL, fsl_pcib_err_intr, dev, &sc->sc_ih);
if (error != 0) {
device_printf(dev, "Could not setup irq, %d\n", error);
sc->sc_ih = NULL;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r353607 - head/cddl/contrib/opensolaris/cmd/zfs

2019-10-15 Thread Andriy Gapon
Author: avg
Date: Wed Oct 16 06:05:18 2019
New Revision: 353607
URL: https://svnweb.freebsd.org/changeset/base/353607

Log:
  MFV r353606: 10067 Miscellaneous man page typos
  
  https://www.illumos.org/issues/10067
fileystem - man1m/zfs.1m man1m/boot.1m
  
  Author: Peter Tribble 
  Obtained from:illumos
  MFC after:1 week

Modified:
  head/cddl/contrib/opensolaris/cmd/zfs/zfs.8
Directory Properties:
  head/cddl/contrib/opensolaris/   (props changed)

Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8
==
--- head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Wed Oct 16 06:02:07 2019
(r353606)
+++ head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Wed Oct 16 06:05:18 2019
(r353607)
@@ -2338,7 +2338,7 @@ option was not specified.
 .Ar filesystem Ns | Ns Ar volume
 .Xc
 .Pp
-Remap the indirect blocks in the given fileystem or volume so that they no
+Remap the indirect blocks in the given filesystem or volume so that they no
 longer reference blocks on previously removed vdevs and we can eventually
 shrink the size of the indirect mapping objects for the previously removed
 vdevs. Note that remapping all blocks might not be possible and that
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r353609 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2019-10-15 Thread Andriy Gapon
Author: avg
Date: Wed Oct 16 06:09:00 2019
New Revision: 353609
URL: https://svnweb.freebsd.org/changeset/base/353609

Log:
  MFV r353608: 10165 libzpool: passing argument 1 to restrict-qualified 
parameter
  
  illumos/illumos-gate@f91fcf59ac2fd04f1816f3dcbc69a46d44276a65
  
https://github.com/illumos/illumos-gate/commit/f91fcf59ac2fd04f1816f3dcbc69a46d44276a65
  
  https://www.illumos.org/issues/10165
  
  Author: Toomas Soome 
  MFC after:10 days

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c   Wed Oct 
16 06:07:21 2019(r353608)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c   Wed Oct 
16 06:09:00 2019(r353609)
@@ -2196,7 +2196,10 @@ dsl_get_mountpoint(dsl_dataset_t *ds, const char *dsna
return (error);
}
 
-   /* Process the dsname and source to find the full mountpoint string */
+   /*
+* Process the dsname and source to find the full mountpoint string.
+* Can be skipped for 'legacy' or 'none'.
+*/
if (value[0] == '/') {
char *buf = kmem_alloc(ZAP_MAXVALUELEN, KM_SLEEP);
char *root = buf;
@@ -2247,10 +2250,8 @@ dsl_get_mountpoint(dsl_dataset_t *ds, const char *dsna
relpath);
}
kmem_free(buf, ZAP_MAXVALUELEN);
-   } else {
-   /* 'legacy' or 'none' */
-   (void) snprintf(value, ZAP_MAXVALUELEN, "%s", value);
}
+
return (0);
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r353612 - in head: cddl/contrib/opensolaris/cmd/zdb sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys

2019-10-15 Thread Andriy Gapon
Author: avg
Date: Wed Oct 16 06:26:51 2019
New Revision: 353612
URL: https://svnweb.freebsd.org/changeset/base/353612

Log:
  MFC r353611: 10330 merge recent ZoL vdev and metaslab changes
  
  illumos/illumos-gate@a0b03b161c4df3cfc54fbc741db09b3bdc23ffba
  
https://github.com/illumos/illumos-gate/commit/a0b03b161c4df3cfc54fbc741db09b3bdc23ffba
  
  https://www.illumos.org/issues/10330
3 recent ZoL changes in the vdev and metaslab code which we can pull over:
PR 8324 c853f382db 8324 Change target size of metaslabs from 256GB to 16GB
PR 8290 b194fab0fb 8290 Factor metaslab_load_wait() in metaslab_load()
PR 8286 419ba59145 8286 Update vdev_is_spacemap_addressable() for new 
spacemap
encoding
  
  Author: Serapheim Dimitropoulos 
  Obtained from:illumos, ZoL
  MFC after:2 weeks

Modified:
  head/cddl/contrib/opensolaris/cmd/zdb/zdb.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_initialize.c
Directory Properties:
  head/cddl/contrib/opensolaris/   (props changed)
  head/cddl/contrib/opensolaris/cmd/zdb/   (props changed)
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c
==
--- head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Wed Oct 16 06:18:37 2019
(r353611)
+++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Wed Oct 16 06:26:51 2019
(r353612)
@@ -901,11 +901,8 @@ dump_metaslab(metaslab_t *msp)
 
if (dump_opt['m'] > 2 && !dump_opt['L']) {
mutex_enter(&msp->ms_lock);
-   metaslab_load_wait(msp);
-   if (!msp->ms_loaded) {
-   VERIFY0(metaslab_load(msp));
-   range_tree_stat_verify(msp->ms_allocatable);
-   }
+   VERIFY0(metaslab_load(msp));
+   range_tree_stat_verify(msp->ms_allocatable);
dump_metaslab_stats(msp);
metaslab_unload(msp);
mutex_exit(&msp->ms_lock);

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c  Wed Oct 
16 06:18:37 2019(r353611)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c  Wed Oct 
16 06:26:51 2019(r353612)
@@ -1468,7 +1468,7 @@ metaslab_ops_t *zfs_metaslab_ops = &metaslab_df_ops;
 /*
  * Wait for any in-progress metaslab loads to complete.
  */
-void
+static void
 metaslab_load_wait(metaslab_t *msp)
 {
ASSERT(MUTEX_HELD(&msp->ms_lock));
@@ -1479,20 +1479,17 @@ metaslab_load_wait(metaslab_t *msp)
}
 }
 
-int
-metaslab_load(metaslab_t *msp)
+static int
+metaslab_load_impl(metaslab_t *msp)
 {
int error = 0;
-   boolean_t success = B_FALSE;
 
ASSERT(MUTEX_HELD(&msp->ms_lock));
-   ASSERT(!msp->ms_loaded);
-   ASSERT(!msp->ms_loading);
+   ASSERT(msp->ms_loading);
 
-   msp->ms_loading = B_TRUE;
/*
 * Nobody else can manipulate a loading metaslab, so it's now safe
-* to drop the lock.  This way we don't have to hold the lock while
+* to drop the lock. This way we don't have to hold the lock while
 * reading the spacemap from disk.
 */
mutex_exit(&msp->ms_lock);
@@ -1509,29 +1506,49 @@ metaslab_load(metaslab_t *msp)
msp->ms_start, msp->ms_size);
}
 
-   success = (error == 0);
-
mutex_enter(&msp->ms_lock);
-   msp->ms_loading = B_FALSE;
 
-   if (success) {
-   ASSERT3P(msp->ms_group, !=, NULL);
-   msp->ms_loaded = B_TRUE;
+   if (error != 0)
+   return (error);
 
-   /*
-* If the metaslab already has a spacemap, then we need to
-* remove all segments from the defer tree; otherwise, the
-* metaslab is completely empty and we can skip this.
-*/
-   if (msp->ms_sm != NULL) {
-   for (int t = 0; t < TXG_DEFER_SIZE; t++) {
-   range_tree_walk(msp->ms_defer[t],
-   range_tree_remove, msp->ms_allocatable);
-   }
+   ASSERT3P(msp->ms_group, !=, NULL);
+   msp->ms_loaded = B_TRUE;
+
+   /*
+* If the metaslab already has a spacemap, then we need to
+* remove all segments from the defer tree; otherwise, the
+* metaslab is completely empty and we can skip this.
+*/
+   if (msp->ms_sm != NULL) {
+   for (int t = 0; t < TXG_DEFER_SIZE; t++) {
+

svn commit: r353614 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2019-10-15 Thread Andriy Gapon
Author: avg
Date: Wed Oct 16 06:38:05 2019
New Revision: 353614
URL: https://svnweb.freebsd.org/changeset/base/353614

Log:
  MFV r353613: 10731 zfs: NULL pointer errors
  
  FreeBSD already had these changes locally.
  This commit removes a small formatting difference.
  
  MFC after:1 week

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c  Wed Oct 
16 06:34:58 2019(r353613)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c  Wed Oct 
16 06:38:05 2019(r353614)
@@ -1249,8 +1249,7 @@ int
 dsl_pool_user_release(dsl_pool_t *dp, uint64_t dsobj, const char *tag,
 dmu_tx_t *tx)
 {
-   return (dsl_pool_user_hold_rele_impl(dp, dsobj, tag, 0,
-   tx, B_FALSE));
+   return (dsl_pool_user_hold_rele_impl(dp, dsobj, tag, 0, tx, B_FALSE));
 }
 
 /*
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r353616 - in head: cddl/contrib/opensolaris/cmd/ztest sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2019-10-15 Thread Andriy Gapon
Author: avg
Date: Wed Oct 16 06:43:22 2019
New Revision: 353616
URL: https://svnweb.freebsd.org/changeset/base/353616

Log:
  MFV r353615: 9485 Optimize possible split block search space
  
  illumos/illumos-gate@a21fe349793c3805ec504bbe5e9acf06c2d63d7a
  
https://github.com/illumos/illumos-gate/commit/a21fe349793c3805ec504bbe5e9acf06c2d63d7a
  
  https://www.illumos.org/issues/9485
Port this commit from ZoL:

https://github.com/zfsonlinux/zfs/commit/4589f3ae4c1bb435777da8640eb915f3c713b14d
  
  Author: Brian Behlendorf 
  Obtained from:illumos, ZoL
  MFC after:3 weeks

Modified:
  head/cddl/contrib/opensolaris/cmd/ztest/ztest.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c
Directory Properties:
  head/cddl/contrib/opensolaris/   (props changed)
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/cddl/contrib/opensolaris/cmd/ztest/ztest.c
==
--- head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Wed Oct 16 06:40:47 
2019(r353615)
+++ head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Wed Oct 16 06:43:22 
2019(r353616)
@@ -198,6 +198,7 @@ extern boolean_t zfs_compressed_arc_enabled;
 extern boolean_t zfs_abd_scatter_enabled;
 extern int dmu_object_alloc_chunk_shift;
 extern boolean_t zfs_force_some_double_word_sm_entries;
+extern unsigned long zfs_reconstruct_indirect_damage_fraction;
 
 static ztest_shared_opts_t *ztest_shared_opts;
 static ztest_shared_opts_t ztest_opts;
@@ -5696,7 +5697,8 @@ ztest_run_zdb(char *pool)
isa = strdup(isa);
/* LINTED */
(void) sprintf(bin,
-   "/usr/sbin%.*s/zdb -bcc%s%s -G -d -U %s %s",
+   "/usr/sbin%.*s/zdb -bcc%s%s -G -d -U %s "
+   "-o zfs_reconstruct_indirect_combinations_max=65536 %s",
isalen,
isa,
ztest_opts.zo_verbose >= 3 ? "s" : "",
@@ -6652,6 +6654,13 @@ main(int argc, char **argv)
 * of them so the feature get tested.
 */
zfs_force_some_double_word_sm_entries = B_TRUE;
+
+   /*
+* Verify that even extensively damaged split blocks with many
+* segments can be reconstructed in a reasonable amount of time
+* when reconstruction is known to be possible.
+*/
+   zfs_reconstruct_indirect_damage_fraction = 4;
 
ztest_fd_rand = open("/dev/urandom", O_RDONLY);
ASSERT3S(ztest_fd_rand, >=, 0);

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c Wed Oct 
16 06:40:47 2019(r353615)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c Wed Oct 
16 06:43:22 2019(r353616)
@@ -206,19 +206,23 @@ uint64_t zfs_condense_min_mapping_bytes = 128 * 1024;
 int zfs_condense_indirect_commit_entry_delay_ticks = 0;
 
 /*
- * If a split block contains more than this many segments, consider it too
- * computationally expensive to check all (2^num_segments) possible
- * combinations. Instead, try at most 2^_segments_max randomly-selected
- * combinations.
- *
- * This is reasonable if only a few segment copies are damaged and the
- * majority of segment copies are good. This allows all the segment copies to
- * participate fairly in the reconstruction and prevents the repeated use of
- * one bad copy.
+ * If an indirect split block contains more than this many possible unique
+ * combinations when being reconstructed, consider it too computationally
+ * expensive to check them all. Instead, try at most 100 randomly-selected
+ * combinations each time the block is accessed.  This allows all segment
+ * copies to participate fairly in the reconstruction when all combinations
+ * cannot be checked and prevents repeated use of one bad copy.
  */
-int zfs_reconstruct_indirect_segments_max = 10;
+int zfs_reconstruct_indirect_combinations_max = 256;
 
+
 /*
+ * Enable to simulate damaged segments and validate reconstruction.
+ * Used by ztest
+ */
+unsigned long zfs_reconstruct_indirect_damage_fraction = 0;
+
+/*
  * The indirect_child_t represents the vdev that we will read from, when we
  * need to read all copies of the data (e.g. for scrub or reconstruction).
  * For plain (non-mirror) top-level vdevs (i.e. is_vdev is not a mirror),
@@ -228,6 +232,13 @@ int zfs_reconstruct_indirect_segments_max = 10;
 typedef struct indirect_child {
abd_t *ic_data;
vdev_t *ic_vdev;
+
+   /*
+* ic_duplicate is NULL when the ic_data contents are unique, when it
+* is determined to be a duplicate it references the primary child.
+*/
+   struct indirect_child *ic_duplicate;
+   list_node_t ic_node; /* node on is_unique_child */
 } indirect_child_t;
 
 /*
@@ -249,12 +260,14 @@ typedef struct indirect_split {
uint64_t is_target_offset; /*