svn commit: r292399 - head/usr.bin/calendar/calendars

2015-12-17 Thread Christian Brueffer
Author: brueffer
Date: Thu Dec 17 10:37:11 2015
New Revision: 292399
URL: https://svnweb.freebsd.org/changeset/base/292399

Log:
  RIP Juergen Lock (n...@freebsd.org), you and your contributions won't be 
forgotten.

Modified:
  head/usr.bin/calendar/calendars/calendar.freebsd

Modified: head/usr.bin/calendar/calendars/calendar.freebsd
==
--- head/usr.bin/calendar/calendars/calendar.freebsdThu Dec 17 07:01:45 
2015(r292398)
+++ head/usr.bin/calendar/calendars/calendar.freebsdThu Dec 17 10:37:11 
2015(r292399)
@@ -260,6 +260,7 @@
 08/06  Damjan Marion  born in Rijeka, Croatia, 1978
 08/07  Jonathan Mini  born in San Mateo, California, United 
States, 1979
 08/08  Mikolaj Golub  born in Kharkov, USSR, 1977
+08/08  Juergen Lock  died in Bremen, Germany, 2015
 08/09  Stefan Farfeleder  died in Wien, Austria, 2015
 08/10  Julio Merino  born in Barcelona, Spain, 1984
 08/10  Peter Pentchev  born in Sofia, Bulgaria, 1977
___
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: r292379 - in head/sys: netinet netinet6

2015-12-17 Thread Steven Hartland

Hey Gleb, sorry I didn't wait for your review, but I did ask around on what
the timeout for this would be and was informed 2 weeks and as it had been
over a month, with quite a bit of feedback from others in the area, all 
of which

had been addressed I thought that was reasonable.

A simple reply of "I do intend to review but don't have time yet so 
please wait"
I think would be useful in these types of situations, as I know 
everyone's busy

but its impossible to know what others are thinking.

Clearly the MTU think was just a silly mistake, which I backed out 
instantly so

lets not be to harsh on that one ;-)

With regards MAINTAINERS, is there any sort of automation which could alert
on this (pre-commit) hook maybe as I'm sure that would be helpful as a
reminder.

I would definitely like to understand more about your concerns and learn 
from
your knowledge in this area, so thanks for that offer, and while it does 
sound

unforgiving I totally understand where you're coming from.

Hopefully together we can bring this to a satisfactory conclusion as I 
would hate

for both carp and lagg to stay as broken, 2 years is long enough :D

Regards
Steve

On 17/12/2015 00:38, Gleb Smirnoff wrote:

   Steven,

   I'm sorry that wasn't able to review D4111 in time, but I have
very strong concerns against r292275. And r292379 doesn't
improve situation. I am asking you to back out both patches,
and then we can get together back to the problem. The 156226
bug was sitting for 2 years in the bugzilla for a reason. It
is a not "low hanging fruit" like koobs@ says.

I'm sorry if I sound unforgiving, but you got a very bad commit
record in this area. You committed r290403 to ip_carp.c which
"added MTU support to carp interfaces", and that was after 4 YEARS
of carp(4) being not an interface. So, I assume you doesn't
have a good understanding of the current state of the stack,
direction it is developed and things that can be done and
can not (including DELAY() in callout(9).

Note, that the MAINTAINERS file still lists me for ip_carp.c,
and you didn't wait for my review. yet another reason to ask
for backout.

I understand that you got a product at work that needs to
have problem fixed. I'm glad that you got a patch that works
it around. But that doesn't mean the patch should immeditely
be dumped in head with a threat of soon MFC.



___
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: r292402 - in head/sys: net netinet netinet6

2015-12-17 Thread Steven Hartland
Author: smh
Date: Thu Dec 17 14:41:30 2015
New Revision: 292402
URL: https://svnweb.freebsd.org/changeset/base/292402

Log:
  Revert r292275 & r292379
  
  glebius has concerns about these changes so reverting those can be discussed
  and addressed.
  
  Sponsored by: Multiplay

Modified:
  head/sys/net/if.c
  head/sys/net/if_lagg.c
  head/sys/net/if_lagg.h
  head/sys/net/if_var.h
  head/sys/netinet/if_ether.c
  head/sys/netinet/if_ether.h
  head/sys/netinet/in_var.h
  head/sys/netinet/ip_carp.c
  head/sys/netinet6/in6.c
  head/sys/netinet6/in6_var.h
  head/sys/netinet6/nd6.c
  head/sys/netinet6/nd6.h
  head/sys/netinet6/nd6_nbr.c

Modified: head/sys/net/if.c
==
--- head/sys/net/if.c   Thu Dec 17 12:35:40 2015(r292401)
+++ head/sys/net/if.c   Thu Dec 17 14:41:30 2015(r292402)
@@ -126,7 +126,7 @@ SX_SYSINIT(ifdescr_sx, &ifdescr_sx, "ifn
 
 void   (*bridge_linkstate_p)(struct ifnet *ifp);
 void   (*ng_ether_link_state_p)(struct ifnet *ifp, int state);
-void   (*lagg_linkstate_p)(struct ifnet *ifp);
+void   (*lagg_linkstate_p)(struct ifnet *ifp, int state);
 /* These are external hooks for CARP. */
 void   (*carp_linkstate_p)(struct ifnet *ifp);
 void   (*carp_demote_adj_p)(int, char *);
@@ -1984,8 +1984,6 @@ if_unroute(struct ifnet *ifp, int flag, 
 
if (ifp->if_carp)
(*carp_linkstate_p)(ifp);
-   if (ifp->if_lagg)
-   (*lagg_linkstate_p)(ifp);
rt_ifmsg(ifp);
 }
 
@@ -2007,8 +2005,6 @@ if_route(struct ifnet *ifp, int flag, in
pfctlinput(PRC_IFUP, ifa->ifa_addr);
if (ifp->if_carp)
(*carp_linkstate_p)(ifp);
-   if (ifp->if_lagg)
-   (*lagg_linkstate_p)(ifp);
rt_ifmsg(ifp);
 #ifdef INET6
in6_if_up(ifp);
@@ -2023,27 +2019,17 @@ int (*vlan_tag_p)(struct ifnet *, uint16
 int(*vlan_setcookie_p)(struct ifnet *, void *);
 void   *(*vlan_cookie_p)(struct ifnet *);
 
-void
-if_link_state_change(struct ifnet *ifp, int link_state)
-{
-
-   return if_link_state_change_cond(ifp, link_state, 0);
-}
-
 /*
  * Handle a change in the interface link state. To avoid LORs
  * between driver lock and upper layer locks, as well as possible
  * recursions, we post event to taskqueue, and all job
  * is done in static do_link_state_change().
- *
- * If the current link state matches link_state and force isn't
- * specified no action is taken.
  */
 void
-if_link_state_change_cond(struct ifnet *ifp, int link_state, int force)
+if_link_state_change(struct ifnet *ifp, int link_state)
 {
-
-   if (ifp->if_link_state == link_state && !force)
+   /* Return if state hasn't changed. */
+   if (ifp->if_link_state == link_state)
return;
 
ifp->if_link_state = link_state;
@@ -2071,7 +2057,7 @@ do_link_state_change(void *arg, int pend
if (ifp->if_bridge)
(*bridge_linkstate_p)(ifp);
if (ifp->if_lagg)
-   (*lagg_linkstate_p)(ifp);
+   (*lagg_linkstate_p)(ifp, link_state);
 
if (IS_DEFAULT_VNET(curvnet))
devctl_notify("IFNET", ifp->if_xname,

Modified: head/sys/net/if_lagg.c
==
--- head/sys/net/if_lagg.c  Thu Dec 17 12:35:40 2015(r292401)
+++ head/sys/net/if_lagg.c  Thu Dec 17 14:41:30 2015(r292402)
@@ -106,7 +106,7 @@ static int  lagg_port_create(struct lagg_
 static int lagg_port_destroy(struct lagg_port *, int);
 static struct mbuf *lagg_input(struct ifnet *, struct mbuf *);
 static voidlagg_linkstate(struct lagg_softc *);
-static voidlagg_port_state(struct ifnet *);
+static voidlagg_port_state(struct ifnet *, int);
 static int lagg_port_ioctl(struct ifnet *, u_long, caddr_t);
 static int lagg_port_output(struct ifnet *, struct mbuf *,
const struct sockaddr *, struct route *);
@@ -1774,12 +1774,7 @@ lagg_linkstate(struct lagg_softc *sc)
break;
}
}
-
-   /*
-* Force state change to ensure ifnet_link_event is generated allowing
-* protocols to notify other nodes of potential address move.
-*/
-   if_link_state_change_cond(sc->sc_ifp, new_link, 1);
+   if_link_state_change(sc->sc_ifp, new_link);
 
/* Update if_baudrate to reflect the max possible speed */
switch (sc->sc_proto) {
@@ -1802,7 +1797,7 @@ lagg_linkstate(struct lagg_softc *sc)
 }
 
 static void
-lagg_port_state(struct ifnet *ifp)
+lagg_port_state(struct ifnet *ifp, int state)
 {
struct lagg_port *lp = (struct lagg_port *)ifp->if_lagg;
struct lagg_softc *sc = NULL;
@@ -1818,7 +1813,7 @@ lagg_port_state(struct ifnet *ifp)
LAGG_WUNLOCK(sc);
 }
 
-static struct lagg_port *
+struct lagg_port *
 lagg_link_active(struct lagg_softc *sc, struct lagg_port *lp)
 {
struct lagg_port *lp_n

svn commit: r292405 - in head/sys: arm64/include dev/ofw

2015-12-17 Thread Andrew Turner
Author: andrew
Date: Thu Dec 17 17:00:04 2015
New Revision: 292405
URL: https://svnweb.freebsd.org/changeset/base/292405

Log:
  Support the variant of the interrupt-map property where the parent bus has
  the #address-cells property set. For this we need to read more data before
  the parent interrupt description.
  
  this is only enabled on arm64 for now as it's not quite compliant with the
  ePAPR spec. We should use a default of 2 where the #address-cells property
  is missing, however this will need further testing across architectures.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: SoftIron Inc
  Differential Revision:https://reviews.freebsd.org/D4518

Modified:
  head/sys/arm64/include/ofw_machdep.h
  head/sys/dev/ofw/ofw_bus_subr.c

Modified: head/sys/arm64/include/ofw_machdep.h
==
--- head/sys/arm64/include/ofw_machdep.hThu Dec 17 16:09:15 2015
(r292404)
+++ head/sys/arm64/include/ofw_machdep.hThu Dec 17 17:00:04 2015
(r292405)
@@ -41,4 +41,7 @@ struct mem_region {
vm_size_t   mr_size;
 };
 
+/* FDT follows ePAPR */
+#defineOFW_EPAPR
+
 #endif /* _MACHINE_OFW_MACHDEP_H_ */

Modified: head/sys/dev/ofw/ofw_bus_subr.c
==
--- head/sys/dev/ofw/ofw_bus_subr.c Thu Dec 17 16:09:15 2015
(r292404)
+++ head/sys/dev/ofw/ofw_bus_subr.c Thu Dec 17 17:00:04 2015
(r292405)
@@ -341,6 +341,7 @@ ofw_bus_search_intrmap(void *intr, int i
uint8_t *uiregs = regs;
uint8_t *uiimapmsk = imapmsk;
uint8_t *mptr;
+   pcell_t paddrsz;
pcell_t pintrsz;
int i, rsz, tsz;
 
@@ -357,19 +358,31 @@ ofw_bus_search_intrmap(void *intr, int i
 
mptr = imap;
i = imapsz;
+   paddrsz = 0;
while (i > 0) {
bcopy(mptr + physsz + intrsz, &parent, sizeof(parent));
+#ifdef OFW_EPAPR
+   /*
+* Find if we need to read the parent address data. Sparc64
+* uses a different encoding that doesn't include this data.
+*/
+   if (OF_getencprop(OF_node_from_xref(parent),
+   "#address-cells", &paddrsz, sizeof(paddrsz)) == -1)
+   paddrsz = 0;/* default */
+   paddrsz *= sizeof(pcell_t);
+#endif
+
if (OF_searchencprop(OF_node_from_xref(parent),
"#interrupt-cells", &pintrsz, sizeof(pintrsz)) == -1)
pintrsz = 1;/* default */
pintrsz *= sizeof(pcell_t);
 
/* Compute the map stride size. */
-   tsz = physsz + intrsz + sizeof(phandle_t) + pintrsz;
+   tsz = physsz + intrsz + sizeof(phandle_t) + paddrsz + pintrsz;
KASSERT(i >= tsz, ("ofw_bus_search_intrmap: truncated map"));
 
if (bcmp(ref, mptr, physsz + intrsz) == 0) {
-   bcopy(mptr + physsz + intrsz + sizeof(parent),
+   bcopy(mptr + physsz + intrsz + sizeof(parent) + paddrsz,
result, MIN(rintrsz, pintrsz));
 
if (iparent != 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"


Re: svn commit: r292405 - in head/sys: arm64/include dev/ofw

2015-12-17 Thread Nathan Whitehorn
I don't really like the #ifdef here. If it contradicts ePAPR, switching 
on the behavior through a #define OFW_EPAPR is at best misleading. And, 
aside from the default value of 2, this *is* compliant with the ePAPR 
spec, as well as with CHRP and PAPR (which is where ePAPR got it from). 
Do we have any in-the-wild CHRP-ish device trees for which 
#address-cells is unspecified to even worry about the default anyway?


In any event, I'd much prefer that it be explicitly disabled on SPARC, 
which is the odd man out on our platforms, rather than opt-in on all 
other platforms, which use CHRP-heritage bindings, and that the #define 
be something more descriptive/correct like #define 
OFW_IMAP_NO_INTERRUPT_PARENT.

-Nathan

On 12/17/15 09:00, Andrew Turner wrote:

Author: andrew
Date: Thu Dec 17 17:00:04 2015
New Revision: 292405
URL: https://svnweb.freebsd.org/changeset/base/292405

Log:
   Support the variant of the interrupt-map property where the parent bus has
   the #address-cells property set. For this we need to read more data before
   the parent interrupt description.
   
   this is only enabled on arm64 for now as it's not quite compliant with the

   ePAPR spec. We should use a default of 2 where the #address-cells property
   is missing, however this will need further testing across architectures.
   
   Obtained from:	ABT Systems Ltd

   Sponsored by:SoftIron Inc
   Differential Revision:   https://reviews.freebsd.org/D4518

Modified:
   head/sys/arm64/include/ofw_machdep.h
   head/sys/dev/ofw/ofw_bus_subr.c

Modified: head/sys/arm64/include/ofw_machdep.h
==
--- head/sys/arm64/include/ofw_machdep.hThu Dec 17 16:09:15 2015
(r292404)
+++ head/sys/arm64/include/ofw_machdep.hThu Dec 17 17:00:04 2015
(r292405)
@@ -41,4 +41,7 @@ struct mem_region {
vm_size_t   mr_size;
  };
  
+/* FDT follows ePAPR */

+#defineOFW_EPAPR
+
  #endif /* _MACHINE_OFW_MACHDEP_H_ */

Modified: head/sys/dev/ofw/ofw_bus_subr.c
==
--- head/sys/dev/ofw/ofw_bus_subr.c Thu Dec 17 16:09:15 2015
(r292404)
+++ head/sys/dev/ofw/ofw_bus_subr.c Thu Dec 17 17:00:04 2015
(r292405)
@@ -341,6 +341,7 @@ ofw_bus_search_intrmap(void *intr, int i
uint8_t *uiregs = regs;
uint8_t *uiimapmsk = imapmsk;
uint8_t *mptr;
+   pcell_t paddrsz;
pcell_t pintrsz;
int i, rsz, tsz;
  
@@ -357,19 +358,31 @@ ofw_bus_search_intrmap(void *intr, int i
  
  	mptr = imap;

i = imapsz;
+   paddrsz = 0;
while (i > 0) {
bcopy(mptr + physsz + intrsz, &parent, sizeof(parent));
+#ifdef OFW_EPAPR
+   /*
+* Find if we need to read the parent address data. Sparc64
+* uses a different encoding that doesn't include this data.
+*/
+   if (OF_getencprop(OF_node_from_xref(parent),
+   "#address-cells", &paddrsz, sizeof(paddrsz)) == -1)
+   paddrsz = 0;/* default */
+   paddrsz *= sizeof(pcell_t);
+#endif
+
if (OF_searchencprop(OF_node_from_xref(parent),
"#interrupt-cells", &pintrsz, sizeof(pintrsz)) == -1)
pintrsz = 1;/* default */
pintrsz *= sizeof(pcell_t);
  
  		/* Compute the map stride size. */

-   tsz = physsz + intrsz + sizeof(phandle_t) + pintrsz;
+   tsz = physsz + intrsz + sizeof(phandle_t) + paddrsz + pintrsz;
KASSERT(i >= tsz, ("ofw_bus_search_intrmap: truncated map"));
  
  		if (bcmp(ref, mptr, physsz + intrsz) == 0) {

-   bcopy(mptr + physsz + intrsz + sizeof(parent),
+   bcopy(mptr + physsz + intrsz + sizeof(parent) + paddrsz,
result, MIN(rintrsz, pintrsz));
  
  			if (iparent != 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: r292406 - head/sys/vm

2015-12-17 Thread Conrad E. Meyer
Author: cem
Date: Thu Dec 17 17:48:57 2015
New Revision: 292406
URL: https://svnweb.freebsd.org/changeset/base/292406

Log:
  vm_page_replace: add wrapper to KASSERT about old page
  
  It turns out the callers of vm_page_replace know exactly which page they are
  replacing and would like to assert about it.  Change those from hard panics to
  KASSERTs, and provide them with a wrapper so they don't have to deal with
  warnings from an INVARIANTS-dependent dead store of the return value of
  vm_page_replace.
  
  Submitted by: Ryan Libby 
  Reviewed by:  alc, kib (earlier version)
  Sponsored by: EMC / Isilon Storage Division
  Differential Revision:https://reviews.freebsd.org/D4497

Modified:
  head/sys/vm/device_pager.c
  head/sys/vm/sg_pager.c
  head/sys/vm/vm_page.h

Modified: head/sys/vm/device_pager.c
==
--- head/sys/vm/device_pager.c  Thu Dec 17 17:00:04 2015(r292405)
+++ head/sys/vm/device_pager.c  Thu Dec 17 17:48:57 2015(r292406)
@@ -347,8 +347,7 @@ old_dev_pager_fault(vm_object_t object, 
 */
page = vm_page_getfake(paddr, memattr);
VM_OBJECT_WLOCK(object);
-   if (vm_page_replace(page, object, (*mres)->pindex) != *mres)
-   panic("old_dev_pager_fault: invalid page replacement");
+   vm_page_replace_checked(page, object, (*mres)->pindex, *mres);
vm_page_lock(*mres);
vm_page_free(*mres);
vm_page_unlock(*mres);

Modified: head/sys/vm/sg_pager.c
==
--- head/sys/vm/sg_pager.c  Thu Dec 17 17:00:04 2015(r292405)
+++ head/sys/vm/sg_pager.c  Thu Dec 17 17:48:57 2015(r292406)
@@ -188,8 +188,7 @@ sg_pager_getpages(vm_object_t object, vm
page = vm_page_getfake(paddr, memattr);
VM_OBJECT_WLOCK(object);
TAILQ_INSERT_TAIL(&object->un_pager.sgp.sgp_pglist, page, plinks.q);
-   if (vm_page_replace(page, object, offset) != m[0])
-   panic("sg_pager_getpages: invalid place replacement");
+   vm_page_replace_checked(page, object, offset, m[0]);
m[0] = page;
page->valid = VM_PAGE_BITS_ALL;
 

Modified: head/sys/vm/vm_page.h
==
--- head/sys/vm/vm_page.h   Thu Dec 17 17:00:04 2015(r292405)
+++ head/sys/vm/vm_page.h   Thu Dec 17 17:48:57 2015(r292406)
@@ -678,5 +678,20 @@ vm_page_undirty(vm_page_t m)
m->dirty = 0;
 }
 
+static inline void
+vm_page_replace_checked(vm_page_t mnew, vm_object_t object, vm_pindex_t pindex,
+vm_page_t mold)
+{
+   vm_page_t mret;
+
+   mret = vm_page_replace(mnew, object, pindex);
+   KASSERT(mret == mold,
+   ("invalid page replacement, mold=%p, mret=%p", mold, mret));
+
+   /* Unused if !INVARIANTS. */
+   (void)mold;
+   (void)mret;
+}
+
 #endif /* _KERNEL */
 #endif /* !_VM_PAGE_ */
___
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: r292407 - in head/sys/riscv: . include

2015-12-17 Thread Ruslan Bukin
Author: br
Date: Thu Dec 17 18:44:30 2015
New Revision: 292407
URL: https://svnweb.freebsd.org/changeset/base/292407

Log:
  Import RISC-V machine headers. This is a minimal set required to compile
  kernel and userland.
  
  Reviewed by:  andrew, imp, kib
  Sponsored by: DARPA, AFRL
  Sponsored by: HEIF5
  Differential Revision:https://reviews.freebsd.org/D4554

Added:
  head/sys/riscv/
  head/sys/riscv/include/
  head/sys/riscv/include/_align.h   (contents, props changed)
  head/sys/riscv/include/_bus.h   (contents, props changed)
  head/sys/riscv/include/_inttypes.h   (contents, props changed)
  head/sys/riscv/include/_limits.h   (contents, props changed)
  head/sys/riscv/include/_stdint.h   (contents, props changed)
  head/sys/riscv/include/_types.h   (contents, props changed)
  head/sys/riscv/include/asm.h   (contents, props changed)
  head/sys/riscv/include/atomic.h   (contents, props changed)
  head/sys/riscv/include/bus.h   (contents, props changed)
  head/sys/riscv/include/bus_dma.h   (contents, props changed)
  head/sys/riscv/include/clock.h   (contents, props changed)
  head/sys/riscv/include/counter.h   (contents, props changed)
  head/sys/riscv/include/cpu.h   (contents, props changed)
  head/sys/riscv/include/cpufunc.h   (contents, props changed)
  head/sys/riscv/include/db_machdep.h   (contents, props changed)
  head/sys/riscv/include/dump.h   (contents, props changed)
  head/sys/riscv/include/elf.h   (contents, props changed)
  head/sys/riscv/include/endian.h   (contents, props changed)
  head/sys/riscv/include/exec.h   (contents, props changed)
  head/sys/riscv/include/float.h   (contents, props changed)
  head/sys/riscv/include/floatingpoint.h   (contents, props changed)
  head/sys/riscv/include/frame.h   (contents, props changed)
  head/sys/riscv/include/ieeefp.h   (contents, props changed)
  head/sys/riscv/include/in_cksum.h   (contents, props changed)
  head/sys/riscv/include/intr.h   (contents, props changed)
  head/sys/riscv/include/kdb.h   (contents, props changed)
  head/sys/riscv/include/machdep.h   (contents, props changed)
  head/sys/riscv/include/md_var.h   (contents, props changed)
  head/sys/riscv/include/memdev.h   (contents, props changed)
  head/sys/riscv/include/minidump.h   (contents, props changed)
  head/sys/riscv/include/ofw_machdep.h   (contents, props changed)
  head/sys/riscv/include/param.h   (contents, props changed)
  head/sys/riscv/include/pcb.h   (contents, props changed)
  head/sys/riscv/include/pcpu.h   (contents, props changed)
  head/sys/riscv/include/pmap.h   (contents, props changed)
  head/sys/riscv/include/pmc_mdep.h   (contents, props changed)
  head/sys/riscv/include/proc.h   (contents, props changed)
  head/sys/riscv/include/profile.h   (contents, props changed)
  head/sys/riscv/include/psl.h   (contents, props changed)
  head/sys/riscv/include/pte.h   (contents, props changed)
  head/sys/riscv/include/ptrace.h   (contents, props changed)
  head/sys/riscv/include/reg.h   (contents, props changed)
  head/sys/riscv/include/reloc.h   (contents, props changed)
  head/sys/riscv/include/resource.h   (contents, props changed)
  head/sys/riscv/include/riscvreg.h   (contents, props changed)
  head/sys/riscv/include/runq.h   (contents, props changed)
  head/sys/riscv/include/setjmp.h   (contents, props changed)
  head/sys/riscv/include/sf_buf.h   (contents, props changed)
  head/sys/riscv/include/signal.h   (contents, props changed)
  head/sys/riscv/include/smp.h   (contents, props changed)
  head/sys/riscv/include/stdarg.h   (contents, props changed)
  head/sys/riscv/include/sysarch.h   (contents, props changed)
  head/sys/riscv/include/trap.h   (contents, props changed)
  head/sys/riscv/include/ucontext.h   (contents, props changed)
  head/sys/riscv/include/vdso.h   (contents, props changed)
  head/sys/riscv/include/vm.h   (contents, props changed)
  head/sys/riscv/include/vmparam.h   (contents, props changed)

Added: head/sys/riscv/include/_align.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/riscv/include/_align.h Thu Dec 17 18:44:30 2015
(r292407)
@@ -0,0 +1,44 @@
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * William Jolitz.
+ *
+ * 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 REGENTS AND CONTRIBU

Re: svn commit: r292379 - in head/sys: netinet netinet6

2015-12-17 Thread Gleb Smirnoff
  Steven,

On Thu, Dec 17, 2015 at 02:29:02PM +, Steven Hartland wrote:
S> Hey Gleb, sorry I didn't wait for your review, but I did ask around on what
S> the timeout for this would be and was informed 2 weeks and as it had been
S> over a month, with quite a bit of feedback from others in the area, all 
S> of which
S> had been addressed I thought that was reasonable.
S> 
S> A simple reply of "I do intend to review but don't have time yet so 
S> please wait"
S> I think would be useful in these types of situations, as I know 
S> everyone's busy
S> but its impossible to know what others are thinking.

Of course it is my fault that I don't review everything phabricator sends
to me, which is a lot. Because it is so easy to add a bunch of subscribers
to a revision. However, in the good old pre-phabricator times, people used to
send email directly to each other. Those email arrive to my regular mailbox,
which I check as often as I can. You could ping me via email.

-- 
Totus tuus, Glebius.
___
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: r292379 - in head/sys: netinet netinet6

2015-12-17 Thread Gleb Smirnoff
  Steven,

On Thu, Dec 17, 2015 at 02:29:02PM +, Steven Hartland wrote:
S> I would definitely like to understand more about your concerns and learn 
S> from
S> your knowledge in this area, so thanks for that offer, and while it does 
S> sound
S> unforgiving I totally understand where you're coming from.
S> 
S> Hopefully together we can bring this to a satisfactory conclusion as I 
S> would hate
S> for both carp and lagg to stay as broken, 2 years is long enough :D

Ok, let's get technical. CARP and LAGG were not broken for 2 years. They
were working very well in the way they were designed to work. The setup
in the bug 156226 was broken initially.

The "link aggregation" itself refers to an aggregation of links between
two logical devices. If you build lagg(4) interface on top of two ports
that are plugged into different switches, you are calling for trouble.

All comments in the 156226 from Eugene Grosbein are valid. I would not
repeat them, but ask you to reread them in bugzilla. There was a good
reason why for 2 years committers stayed away from this "bug" and related
patch.

Nevertheless, someone wants to give a kick to this initially broken
network design and run it somehow. And this "somehow" implies Layer2
upcalling into upper layers to do something, since there is no
established standard layer2 heartbeat packet. I have chatted with
networking gurus at my job, and they said, that they don't know
any decent network equipment that supports such setup. However, they
noticed that Windows is capable for such failover. I haven't yet
learned on how Windows solves the problem. Actually, those who
pushed committing 156226 should have done these investigations.
Probably Windows does exactly the same, sends gratutious ARP or
its IPv6 analog. Or may be does something better like sending
useless L2 datagram, but with a proper source hardware address.

Okay, what if we want same in FreeBSD as in Windows? Should we do the
following list of evil things:

- put DELAY in context of callout(or in context of any network processing)
- introduce new notions of a link state, or new KPI for link handling
  Note that link handling KPI was stable for iver 10 years and satisfied
  all the different types of interfaces we support
- create new interface methods
- call into address families supplying an ifnet that doesn't have this AF
  instantiated, and then to fix immediate panic putting there a kludge
  of "if (foo == NULL) return;"
- etc...

Sorry, I'm putting "etc" here, because tires on details. You would agree
that the whole process of fixing the "bug" was overcoming the problems
that the network stack is not designed for the things that you are
willing to do. Won't you agree?

Or should we just write a tiny program, that would observe state of
networking ports, and if a port changes state then send a tiny packet
as a bpf(4) write?

-- 
Totus tuus, Glebius.
___
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: r292379 - in head/sys: netinet netinet6

2015-12-17 Thread Gleb Smirnoff
  Steven,

another feasible solution for the design described in the 156226
would be to run STP on the switches, and if_bridge(4) instead of
if_lagg(4) on FreeBSD, also with STP enabled. Would work perfectly.

Of course, if switches are dumb and cheap, and can't do STP,
then a tiny bpf-writer is the right solution.

P.S. When I was running network in my university dormitory, we
used a lot of cheap solutions, and a lot of dirty workarounds,
but none of the latter made its way to FreeBSD kernel. You can
also ask Eugene Grosbein, he also has huge experience of living
on not so pleasant workarounds, but not pushing them agrressively
into the kernel.

-- 
Totus tuus, Glebius.
___
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: r292408 - head/crypto/openssh

2015-12-17 Thread Dag-Erling Smørgrav
Author: des
Date: Thu Dec 17 19:36:25 2015
New Revision: 292408
URL: https://svnweb.freebsd.org/changeset/base/292408

Log:
  Incorrect length in calloc() call, already fixed upstream.
  
  PR:   204769
  Submitted by: David Binderman 
  MFC after:1 week

Modified:
  head/crypto/openssh/digest-libc.c

Modified: head/crypto/openssh/digest-libc.c
==
--- head/crypto/openssh/digest-libc.c   Thu Dec 17 18:44:30 2015
(r292407)
+++ head/crypto/openssh/digest-libc.c   Thu Dec 17 19:36:25 2015
(r292408)
@@ -147,7 +147,7 @@ ssh_digest_start(int alg)
const struct ssh_digest *digest = ssh_digest_by_alg(alg);
struct ssh_digest_ctx *ret;
 
-   if (digest == NULL || (ret = calloc(1, sizeof(ret))) == NULL)
+   if (digest == NULL || (ret = calloc(1, sizeof(*ret))) == NULL)
return NULL;
if ((ret->mdctx = calloc(1, digest->ctx_len)) == NULL) {
free(ret);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r292409 - head/sys/dev/drm2/i915

2015-12-17 Thread John Baldwin
Author: jhb
Date: Thu Dec 17 20:33:20 2015
New Revision: 292409
URL: https://svnweb.freebsd.org/changeset/base/292409

Log:
  t seems certain Intel GPUs use GPIO bitbanging over a child device
  instead of GMBUS access for I2C transfers.  The GMBUS driver falls back
  to this mode when a transfer times out.  However, the first transfer to
  timeout was sending the request back to itself resulting in an panic due
  to recursing on a lock.  Fix it to forward the request on to the proper
  device.  This appears to have been accidentally changed in r277487.
  
  Reported by:  Joe Maloney 
  Reviewed by:  adrian, dumbbell, imp
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D4599

Modified:
  head/sys/dev/drm2/i915/intel_iic.c

Modified: head/sys/dev/drm2/i915/intel_iic.c
==
--- head/sys/dev/drm2/i915/intel_iic.c  Thu Dec 17 19:36:25 2015
(r292408)
+++ head/sys/dev/drm2/i915/intel_iic.c  Thu Dec 17 20:33:20 2015
(r292409)
@@ -456,7 +456,7 @@ timeout:
 
/* Hardware may not support GMBUS over these pins? Try GPIO bitbanging 
instead. */
sc->force_bit_dev = true;
-   error = -IICBUS_TRANSFER(adapter, msgs, num);
+   error = -IICBUS_TRANSFER(dev_priv->bbbus[unit], msgs, num);
 
 out:
sx_xunlock(&dev_priv->gmbus_sx);
___
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: r292410 - head/usr.sbin/boot0cfg

2015-12-17 Thread John Baldwin
Author: jhb
Date: Thu Dec 17 20:42:05 2015
New Revision: 292410
URL: https://svnweb.freebsd.org/changeset/base/292410

Log:
  Exit cleanly if malloc() fails to allocate a buffer for a copy of the
  current MBR.
  
  PR:   205322
  Submitted by: Alexander Kuleshov 
  MFC after:1 week

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

Modified: head/usr.sbin/boot0cfg/boot0cfg.c
==
--- head/usr.sbin/boot0cfg/boot0cfg.c   Thu Dec 17 20:33:20 2015
(r292409)
+++ head/usr.sbin/boot0cfg/boot0cfg.c   Thu Dec 17 20:42:05 2015
(r292410)
@@ -337,6 +337,8 @@ read_mbr(const char *disk, u_int8_t **mb
return (mbr_size);
 }
 *mbr = malloc(sizeof(buf));
+if (mbr == NULL)
+   errx(1, "%s: unable to allocate MBR buffer", disk);
 memcpy(*mbr, buf, sizeof(buf));
 close(fd);
 
___
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: r292411 - head/sys/dev/if_ndis

2015-12-17 Thread Gleb Smirnoff
Author: glebius
Date: Thu Dec 17 21:01:19 2015
New Revision: 292411
URL: https://svnweb.freebsd.org/changeset/base/292411

Log:
  Fix regression in if_ndis in r280347.
  
  Submitted by: avos
  Reported by:  Ev Bogdanov 
  Tested by:Ivan Kormachev 
  MFC after:3 days

Modified:
  head/sys/dev/if_ndis/if_ndis_pci.c

Modified: head/sys/dev/if_ndis/if_ndis_pci.c
==
--- head/sys/dev/if_ndis/if_ndis_pci.c  Thu Dec 17 20:42:05 2015
(r292410)
+++ head/sys/dev/if_ndis/if_ndis_pci.c  Thu Dec 17 21:01:19 2015
(r292411)
@@ -298,8 +298,7 @@ ndis_attach_pci(dev)
BUS_SPACE_MAXADDR_32BIT,/* lowaddr */
 BUS_SPACE_MAXADDR, /* highaddr */
NULL, NULL, /* filter, filterarg */
-   BUS_SPACE_MAXSIZE_32BIT, /* maxsize */
-   NDIS_NSEG_NEW,  /* nsegments */
+   DFLTPHYS, NDIS_NSEG_NEW,/* maxsize, nsegments */
BUS_SPACE_MAXSIZE_32BIT,/* maxsegsize */
BUS_DMA_ALLOCNOW,   /* flags */
NULL, NULL, /* lockfunc, lockarg */
___
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: r292379 - in head/sys: netinet netinet6

2015-12-17 Thread John Baldwin
On Thursday, December 17, 2015 02:29:02 PM Steven Hartland wrote:
> With regards MAINTAINERS, is there any sort of automation which could alert
> on this (pre-commit) hook maybe as I'm sure that would be helpful as a
> reminder.

To this point (and this point only): I would encourage anyone who with a
MAINTAINERS entry to setup a herald rule in phabricator to auto-subscribe
to changes that affect files you care about.  Uploading diffs to phab will
then work as a sort of pre-commit hook.

-- 
John Baldwin
___
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: r292379 - in head/sys: netinet netinet6

2015-12-17 Thread Steven Hartland



On 17/12/2015 18:57, Gleb Smirnoff wrote:

   Steven,

On Thu, Dec 17, 2015 at 02:29:02PM +, Steven Hartland wrote:
S> Hey Gleb, sorry I didn't wait for your review, but I did ask around on what
S> the timeout for this would be and was informed 2 weeks and as it had been
S> over a month, with quite a bit of feedback from others in the area, all
S> of which
S> had been addressed I thought that was reasonable.
S>
S> A simple reply of "I do intend to review but don't have time yet so
S> please wait"
S> I think would be useful in these types of situations, as I know
S> everyone's busy
S> but its impossible to know what others are thinking.

Of course it is my fault that I don't review everything phabricator sends
to me, which is a lot. Because it is so easy to add a bunch of subscribers
to a revision. However, in the good old pre-phabricator times, people used to
send email directly to each other. Those email arrive to my regular mailbox,
which I check as often as I can. You could ping me via email.
Ooo, do you not get the chase emails done in phabricator then, as that's 
what I used?


My apologies if that's the case.

___
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: r292379 - in head/sys: netinet netinet6

2015-12-17 Thread Steven Hartland

On 17/12/2015 19:20, Gleb Smirnoff wrote:

   Steven,

another feasible solution for the design described in the 156226
would be to run STP on the switches, and if_bridge(4) instead of
if_lagg(4) on FreeBSD, also with STP enabled. Would work perfectly.

Of course, if switches are dumb and cheap, and can't do STP,
then a tiny bpf-writer is the right solution.

P.S. When I was running network in my university dormitory, we
used a lot of cheap solutions, and a lot of dirty workarounds,
but none of the latter made its way to FreeBSD kernel. You can
also ask Eugene Grosbein, he also has huge experience of living
on not so pleasant workarounds, but not pushing them agrressively
into the kernel.

Last time I heard STP is a bad word in networking, so I'm sure they 
network team
would have me crucified for even suggesting it and start shouting MLAG 
for the

rest of the day ;-)

Regards
Steve
___
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: r292413 - in head: share/man/man4 sys/dev/ioat

2015-12-17 Thread Conrad E. Meyer
Author: cem
Date: Thu Dec 17 23:21:37 2015
New Revision: 292413
URL: https://svnweb.freebsd.org/changeset/base/292413

Log:
  ioat(4): Add an API to get HW revision
  
  Different revisions support different operations.  Refer to Intel
  External Design Specifications to figure out what your hardware
  supports.
  
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/share/man/man4/ioat.4
  head/sys/dev/ioat/ioat.c
  head/sys/dev/ioat/ioat.h
  head/sys/dev/ioat/ioat_hw.h

Modified: head/share/man/man4/ioat.4
==
--- head/share/man/man4/ioat.4  Thu Dec 17 23:13:04 2015(r292412)
+++ head/share/man/man4/ioat.4  Thu Dec 17 23:21:37 2015(r292413)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 14, 2015
+.Dd December 17, 2015
 .Dt IOAT 4
 .Os
 .Sh NAME
@@ -64,6 +64,8 @@ In
 .Ft void
 .Fn ioat_put_dmaengine "bus_dmaengine_t dmaengine"
 .Ft int
+.Fn ioat_get_hwversion "bus_dmaengine_t dmaengine"
+.Ft int
 .Fn ioat_set_interrupt_coalesce "bus_dmaengine_t dmaengine" "uint16_t delay"
 .Ft uint16_t
 .Fn ioat_get_max_coalesce_period "bus_dmaengine_t dmaengine"

Modified: head/sys/dev/ioat/ioat.c
==
--- head/sys/dev/ioat/ioat.cThu Dec 17 23:13:04 2015(r292412)
+++ head/sys/dev/ioat/ioat.cThu Dec 17 23:21:37 2015(r292413)
@@ -736,6 +736,15 @@ ioat_put_dmaengine(bus_dmaengine_t dmaen
 }
 
 int
+ioat_get_hwversion(bus_dmaengine_t dmaengine)
+{
+   struct ioat_softc *ioat;
+
+   ioat = to_ioat_softc(dmaengine);
+   return (ioat->version);
+}
+
+int
 ioat_set_interrupt_coalesce(bus_dmaengine_t dmaengine, uint16_t delay)
 {
struct ioat_softc *ioat;

Modified: head/sys/dev/ioat/ioat.h
==
--- head/sys/dev/ioat/ioat.hThu Dec 17 23:13:04 2015(r292412)
+++ head/sys/dev/ioat/ioat.hThu Dec 17 23:21:37 2015(r292413)
@@ -48,6 +48,14 @@ __FBSDID("$FreeBSD$");
 #defineDMA_NO_WAIT 0x2
 #defineDMA_ALL_FLAGS   (DMA_INT_EN | DMA_NO_WAIT)
 
+/*
+ * Hardware revision number.  Different hardware revisions support different
+ * features.  For example, 3.2 cannot read from MMIO space, while 3.3 can.
+ */
+#defineIOAT_VER_3_00x30
+#defineIOAT_VER_3_20x32
+#defineIOAT_VER_3_30x33
+
 typedef void *bus_dmaengine_t;
 struct bus_dmadesc;
 typedef void (*bus_dmaengine_callback_t)(void *arg, int error);
@@ -60,6 +68,9 @@ bus_dmaengine_t ioat_get_dmaengine(uint3
 /* Release the DMA channel */
 void ioat_put_dmaengine(bus_dmaengine_t dmaengine);
 
+/* Check the DMA engine's HW version */
+int ioat_get_hwversion(bus_dmaengine_t dmaengine);
+
 /*
  * Set interrupt coalescing on a DMA channel.
  *

Modified: head/sys/dev/ioat/ioat_hw.h
==
--- head/sys/dev/ioat/ioat_hw.h Thu Dec 17 23:13:04 2015(r292412)
+++ head/sys/dev/ioat/ioat_hw.h Thu Dec 17 23:21:37 2015(r292413)
@@ -46,9 +46,6 @@ __FBSDID("$FreeBSD$");
 
 #defineIOAT_CBVER_OFFSET   0x08
 
-#defineIOAT_VER_3_00x30
-#defineIOAT_VER_3_30x33
-
 #defineIOAT_INTRDELAY_OFFSET   0x0C
 #defineIOAT_INTRDELAY_SUPPORTED(1 << 15)
 /* Reserved.   (1 << 14) */
___
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: r292379 - in head/sys: netinet netinet6

2015-12-17 Thread Steven Hartland

On 17/12/2015 19:16, Gleb Smirnoff wrote:

   Steven,

On Thu, Dec 17, 2015 at 02:29:02PM +, Steven Hartland wrote:
S> I would definitely like to understand more about your concerns and learn
S> from
S> your knowledge in this area, so thanks for that offer, and while it does
S> sound
S> unforgiving I totally understand where you're coming from.
S>
S> Hopefully together we can bring this to a satisfactory conclusion as I
S> would hate
S> for both carp and lagg to stay as broken, 2 years is long enough :D

Ok, let's get technical. CARP and LAGG were not broken for 2 years. They
were working very well in the way they were designed to work. The setup
in the bug 156226 was broken initially.
You may have not read all the detail in the review so you might not have 
noticed that I

identified that carp IPv6 NA was broken by r251584 which was committed 2 1/2
years ago. I'm guessing not may people use it for IPv6.

The "link aggregation" itself refers to an aggregation of links between
two logical devices. If you build lagg(4) interface on top of two ports
that are plugged into different switches, you are calling for trouble.


While multiple switches complicates the matter its not the only issue as 
you can
reproduce this with a single switch and two nics in LAGG failover mode 
with a simple
ifconfig  down. At this point any traffic entering the switch for 
LAGG member

will back-whole instead of being received by the other nic.

It is much more common in networking now to have multiple physical switches
configured as part of bigger logical devices using protocols such as 
MLAG, which is

what we're using with Cisco's and Arista's, so not some cheepo network ;-)


All comments in the 156226 from Eugene Grosbein are valid. I would not
repeat them, but ask you to reread them in bugzilla. There was a good
reason why for 2 years committers stayed away from this "bug" and related
patch.
Yes but not confuse the different types, we're talking specifically 
about failover mode
here which has no special configuration hence its reliant on the OS 
implementation

only.

Nevertheless, someone wants to give a kick to this initially broken
network design and run it somehow. And this "somehow" implies Layer2
upcalling into upper layers to do something, since there is no
established standard layer2 heartbeat packet. I have chatted with
networking gurus at my job, and they said, that they don't know
any decent network equipment that supports such setup. However, they
noticed that Windows is capable for such failover. I haven't yet
learned on how Windows solves the problem. Actually, those who
pushed committing 156226 should have done these investigations.
Probably Windows does exactly the same, sends gratutious ARP or
its IPv6 analog. Or may be does something better like sending
useless L2 datagram, but with a proper source hardware address.
Actually our testing here showed both Windows and Linux worked as 
expected and
from my reading doing the GARP / UNA is actually expected in this 
situation, for this

very reason.

Okay, what if we want same in FreeBSD as in Windows? Should we do the
following list of evil things:

- put DELAY in context of callout(or in context of any network processing)
- introduce new notions of a link state, or new KPI for link handling
   Note that link handling KPI was stable for iver 10 years and satisfied
   all the different types of interfaces we support
- create new interface methods
- call into address families supplying an ifnet that doesn't have this AF
   instantiated, and then to fix immediate panic putting there a kludge
   of "if (foo == NULL) return;"
- etc...

Sorry, I'm putting "etc" here, because tires on details. You would agree
that the whole process of fixing the "bug" was overcoming the problems
that the network stack is not designed for the things that you are
willing to do. Won't you agree?


I am indeed trying to produce feature parity, to prevent the powers that 
be throwing
FreeBSD out as the only OS which fails to work as expected in failover 
mode, even in the

simple case as described above.

Yes we could apply user land work around but then everyone has to be 
aware its need

and to set it up which doesn't sound like the best solution.


Or should we just write a tiny program, that would observe state of
networking ports, and if a port changes state then send a tiny packet
as a bpf(4) write?
This could be done but still means our lagg failover doesn't do what 
people would expect.


I'd like to step back for a second and get you feedback on the changes 
that where
reverted, which didn't have the DELAY in the callout. What where the 
issues as you
saw them? So we don't spam people any more I've reopened the review so 
we can

take this there: https://reviews.freebsd.org/D4111

Apologies if these are very obvious to others but clearly those involved 
with this

didn't spot them so it would be really nice to learn from this.

Regards
Steve
__

Re: svn commit: r292379 - in head/sys: netinet netinet6

2015-12-17 Thread Gleb Smirnoff
On Thu, Dec 17, 2015 at 11:26:52PM +, Steven Hartland wrote:
S> You may have not read all the detail in the review so you might not have 
S> noticed that I
S> identified that carp IPv6 NA was broken by r251584 which was committed 2 1/2
S> years ago. I'm guessing not may people use it for IPv6.

My suggestion is to look at this regression separated from the lagg failover
and fix it separately.

S> > The "link aggregation" itself refers to an aggregation of links between
S> > two logical devices. If you build lagg(4) interface on top of two ports
S> > that are plugged into different switches, you are calling for trouble.
S> 
S> While multiple switches complicates the matter its not the only issue as 
S> you can
S> reproduce this with a single switch and two nics in LAGG failover mode 
S> with a simple
S> ifconfig  down. At this point any traffic entering the switch for 
S> LAGG member
S> will back-whole instead of being received by the other nic.
S> 
S> It is much more common in networking now to have multiple physical switches
S> configured as part of bigger logical devices using protocols such as 
S> MLAG, which is
S> what we're using with Cisco's and Arista's, so not some cheepo network ;-)

Right, you are confirming what I said above. Multiple physical devices, but
still one logical on each side of lagg.

S> > Nevertheless, someone wants to give a kick to this initially broken
S> > network design and run it somehow. And this "somehow" implies Layer2
S> > upcalling into upper layers to do something, since there is no
S> > established standard layer2 heartbeat packet. I have chatted with
S> > networking gurus at my job, and they said, that they don't know
S> > any decent network equipment that supports such setup. However, they
S> > noticed that Windows is capable for such failover. I haven't yet
S> > learned on how Windows solves the problem. Actually, those who
S> > pushed committing 156226 should have done these investigations.
S> > Probably Windows does exactly the same, sends gratutious ARP or
S> > its IPv6 analog. Or may be does something better like sending
S> > useless L2 datagram, but with a proper source hardware address.
S> Actually our testing here showed both Windows and Linux worked as 
S> expected and
S> from my reading doing the GARP / UNA is actually expected in this 
S> situation, for this very reason.

Is it possible for you to sniff the traffic and see what actually happens
in there? My expectations are the same, but want to be sure.

S> I'd like to step back for a second and get you feedback on the changes 
S> that where
S> reverted, which didn't have the DELAY in the callout. What where the 
S> issues as you
S> saw them? So we don't spam people any more I've reopened the review so 
S> we can
S> take this there: https://reviews.freebsd.org/D4111

Before going into implementation, can we first settle on the protocol?
Could be that GARP/NA is the only solution there, but let's be sure first.

-- 
Totus tuus, Glebius.
___
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: r292419 - head/sys/arm/freescale/imx

2015-12-17 Thread Ian Lepore
Author: ian
Date: Fri Dec 18 01:25:30 2015
New Revision: 292419
URL: https://svnweb.freebsd.org/changeset/base/292419

Log:
  Fix the clock divisor calc for imx6 sdcard bus speed.
  
  I don't know what alternate universe I was inhabiting when I wrote it
  originally, but apparently the basic workings of mathematics were different
  than in this universe.  I also can't explain how it ever worked, except "by
  accident", because completely bogus values were being written into the
  divisor register.

Modified:
  head/sys/arm/freescale/imx/imx_sdhci.c

Modified: head/sys/arm/freescale/imx/imx_sdhci.c
==
--- head/sys/arm/freescale/imx/imx_sdhci.c  Fri Dec 18 01:03:34 2015
(r292418)
+++ head/sys/arm/freescale/imx/imx_sdhci.c  Fri Dec 18 01:25:30 2015
(r292419)
@@ -522,12 +522,19 @@ imx_sdhc_set_clock(struct imx_sdhci_soft
else
freq = sc->baseclk_hz / (2 * divisor);
 
-   for (prescale = 2; prescale < freq / prescale / 16;)
+   for (prescale = 2; freq < sc->baseclk_hz / (prescale * 16);)
prescale <<= 1;
 
-   for (divisor = 1; freq < freq / prescale / divisor;)
+   for (divisor = 1; freq < sc->baseclk_hz / (prescale * divisor);)
++divisor;
 
+#ifdef DEBUG   
+   device_printf(sc->dev,
+   "desired SD freq: %d, actual: %d; base %d prescale %d divisor %d\n",
+   freq, sc->baseclk_hz / (prescale * divisor), sc->baseclk_hz, 
+   prescale, divisor);
+#endif 
+
prescale >>= 1;
divisor -= 1;
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r292420 - head/sys/dev/mmc

2015-12-17 Thread Ian Lepore
Author: ian
Date: Fri Dec 18 01:32:43 2015
New Revision: 292420
URL: https://svnweb.freebsd.org/changeset/base/292420

Log:
  Flag sysctl hw.mmc.debug as a tunable, since often you want to debug the
  bus probing during system startup.

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

Modified: head/sys/dev/mmc/mmc.c
==
--- head/sys/dev/mmc/mmc.c  Fri Dec 18 01:25:30 2015(r292419)
+++ head/sys/dev/mmc/mmc.c  Fri Dec 18 01:32:43 2015(r292420)
@@ -118,7 +118,7 @@ struct mmc_ivars {
 static SYSCTL_NODE(_hw, OID_AUTO, mmc, CTLFLAG_RD, NULL, "mmc driver");
 
 static int mmc_debug;
-SYSCTL_INT(_hw_mmc, OID_AUTO, debug, CTLFLAG_RW, &mmc_debug, 0, "Debug level");
+SYSCTL_INT(_hw_mmc, OID_AUTO, debug, CTLFLAG_RWTUN, &mmc_debug, 0, "Debug 
level");
 
 /* bus entry points */
 static int mmc_acquire_bus(device_t busdev, device_t 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: r292424 - in head/sys: arm/ti dev/ofw

2015-12-17 Thread Warner Losh
Author: imp
Date: Fri Dec 18 05:29:22 2015
New Revision: 292424
URL: https://svnweb.freebsd.org/changeset/base/292424

Log:
  Create a simplebus PNP info wrapper.
  
  Differential Review: https://reviews.freebsd.org/D4517

Modified:
  head/sys/arm/ti/aintc.c
  head/sys/dev/ofw/ofw_bus_subr.h

Modified: head/sys/arm/ti/aintc.c
==
--- head/sys/arm/ti/aintc.c Fri Dec 18 03:06:39 2015(r292423)
+++ head/sys/arm/ti/aintc.c Fri Dec 18 05:29:22 2015(r292424)
@@ -158,6 +158,7 @@ static devclass_t ti_aintc_devclass;
 
 EARLY_DRIVER_MODULE(aintc, simplebus, ti_aintc_driver, ti_aintc_devclass,
 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE);
+SIMPLEBUS_PNP_INFO(compat_data);
 
 int
 arm_get_next_irq(int last_irq)

Modified: head/sys/dev/ofw/ofw_bus_subr.h
==
--- head/sys/dev/ofw/ofw_bus_subr.h Fri Dec 18 03:06:39 2015
(r292423)
+++ head/sys/dev/ofw/ofw_bus_subr.h Fri Dec 18 05:29:22 2015
(r292424)
@@ -52,6 +52,10 @@ struct ofw_compat_data {
uintptr_tocd_data;
 };
 
+#define SIMPLEBUS_PNP_DESCR "Z:compat;P:private;"
+#define SIMPLEBUS_PNP_INFO(t) \
+   MODULE_PNP_INFO(SIMPLEBUS_PNP_DESCR, simplebus, t, t, sizeof(t[0]), 
sizeof(t) / sizeof(t[0]));
+
 /* Generic implementation of ofw_bus_if.m methods and helper routines */
 intofw_bus_gen_setup_devinfo(struct ofw_bus_devinfo *, phandle_t);
 void   ofw_bus_gen_destroy_devinfo(struct ofw_bus_devinfo *);
___
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: r292410 - head/usr.sbin/boot0cfg

2015-12-17 Thread luke
On Fri, Dec 18, 2015 at 4:42 AM, John Baldwin  wrote:

> Author: jhb
> Date: Thu Dec 17 20:42:05 2015
> New Revision: 292410
> URL: https://svnweb.freebsd.org/changeset/base/292410
>
> Log:
>   Exit cleanly if malloc() fails to allocate a buffer for a copy of the
>   current MBR.
>
>   PR:   205322
>   Submitted by: Alexander Kuleshov 
>   MFC after:1 week
>
> Modified:
>   head/usr.sbin/boot0cfg/boot0cfg.c
>
> Modified: head/usr.sbin/boot0cfg/boot0cfg.c
>
> ==
> --- head/usr.sbin/boot0cfg/boot0cfg.c   Thu Dec 17 20:33:20 2015
> (r292409)
> +++ head/usr.sbin/boot0cfg/boot0cfg.c   Thu Dec 17 20:42:05 2015
> (r292410)
> @@ -337,6 +337,8 @@ read_mbr(const char *disk, u_int8_t **mb
> return (mbr_size);
>  }
>  *mbr = malloc(sizeof(buf));
> +if (mbr == NULL)
> +   errx(1, "%s: unable to allocate MBR buffer", disk);
>  memcpy(*mbr, buf, sizeof(buf));
>  close(fd);
>
> ___
> 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"
>


Hi,

Should the check be against *mbr  ?
+if (*mbr == NULL)
+   errx(1, "%s: unable to allocate MBR buffer", disk);


--
Luke Chang-Hsien Tsai
___
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: r292425 - in head/sys: geom/sched modules/geom/geom_sched modules/geom/geom_sched/gsched_delay

2015-12-17 Thread Warner Losh
Author: imp
Date: Fri Dec 18 05:39:25 2015
New Revision: 292425
URL: https://svnweb.freebsd.org/changeset/base/292425

Log:
  Scheduling module to introduce a fixed delay into the I/O path.

Added:
  head/sys/geom/sched/gs_delay.c   (contents, props changed)
  head/sys/modules/geom/geom_sched/gsched_delay/
  head/sys/modules/geom/geom_sched/gsched_delay/Makefile   (contents, props 
changed)
Modified:
  head/sys/modules/geom/geom_sched/Makefile

Added: head/sys/geom/sched/gs_delay.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/geom/sched/gs_delay.c  Fri Dec 18 05:39:25 2015
(r292425)
@@ -0,0 +1,265 @@
+/*-
+ * Copyright (c) 2015 Netflix, Inc.
+ *
+ * Derived from gs_rr.c:
+ * Copyright (c) 2009-2010 Fabio Checconi
+ * Copyright (c) 2009-2010 Luigi Rizzo, Universita` di Pisa
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * $Id$
+ * $FreeBSD$
+ *
+ * A simple scheduler that just delays certain transactions by a certain
+ * amount. We collect all the transactions that are 'done' and put them on
+ * a queue. The queue is run through every so often and the transactions that
+ * have taken longer than the threshold delay are completed.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "gs_scheduler.h"
+
+/* Useful constants */
+#define BTFRAC_1US 18446744073709ULL   /* 2^64 / 100 */
+
+/* list of scheduler instances */
+LIST_HEAD(g_scheds, g_delay_softc);
+
+/*
+ * Per device descriptor, holding the Round Robin list of queues
+ * accessing the disk, a reference to the geom, and the timer.
+ */
+struct g_delay_softc {
+   struct g_geom   *sc_geom;
+
+   struct bio_queue_head sc_bioq;  /* queue of pending requests */
+   struct callout  sc_wait;/* timer for completing with delays */
+
+   /* Statistics */
+   int sc_in_flight;   /* requests in the driver */
+};
+
+/*
+ * parameters, config and stats
+ */
+struct g_delay_params {
+   uint64_t io;
+   int bypass; /* bypass scheduling */
+   int units;  /* how many instances */
+   int latency;/* How big a latncy are hoping for */
+};
+
+static struct g_delay_params me = {
+   .bypass = 0,
+   .units = 0,
+   .latency = 0,
+   .io = 0,
+};
+struct g_delay_params *gs_delay_me = &me;
+
+SYSCTL_DECL(_kern_geom_sched);
+static SYSCTL_NODE(_kern_geom_sched, OID_AUTO, delay, CTLFLAG_RW, 0,
+"GEOM_SCHED DELAY stuff");
+SYSCTL_INT(_kern_geom_sched_delay, OID_AUTO, bypass, CTLFLAG_RD,
+&me.bypass, 0, "Scheduler bypass");
+SYSCTL_INT(_kern_geom_sched_delay, OID_AUTO, units, CTLFLAG_RD,
+&me.units, 0, "Scheduler instances");
+SYSCTL_INT(_kern_geom_sched_delay, OID_AUTO, latency, CTLFLAG_RW,
+&me.latency, 0, "Minimum latency for requests, in microseconds (1/hz 
resolution)");
+SYSCTL_QUAD(_kern_geom_sched_delay, OID_AUTO, io, CTLFLAG_RW,
+&me.io, 0, "I/Os delayed\n");
+
+static int
+g_delay_init_class(void *data, void *priv)
+{
+   return (0);
+}
+
+static void
+g_delay_fini_class(void *data, void *priv)
+{
+}
+
+/*
+ * Called on a request arrival, timeout or completion.
+ * Try to serve a request among those queued.
+ */
+static struct bio *
+g_delay_next(void *data, int force)
+{
+   struct g_delay_softc *sc = data;
+   struct bio *bp;
+   struct bintime bt;
+
+   bp = bioq_first(&sc->sc_bioq);
+   if (bp == NULL)
+   return (NULL);
+
+   /*
+* If the time isn't yet ripe for this bp to be let

svn commit: r292426 - in head/sys: arm/allwinner/a20 arm/altera/socfpga arm/amlogic/aml8726 arm/annapurna/alpine arm/arm arm/freescale/imx arm/include arm/qemu arm/rockchip arm/samsung/exynos arm/t...

2015-12-17 Thread Adrian Chadd
Author: adrian
Date: Fri Dec 18 05:43:59 2015
New Revision: 292426
URL: https://svnweb.freebsd.org/changeset/base/292426

Log:
  [intrng] Migrate the intrng code from sys/arm/arm to sys/kern/subr_intr.c.
  
  The ci20 port (by kan@) is going to reuse almost all of the intrng code
  since the SoC in question looks suspiciously like someone took an ARM
  SoC design and replaced the ARM core with a MIPS core.
  
  * migrate out the code;
  * rename ARM_ -> INTR_;
  * rename arm_ -> intr_;
  * move the interrupt flush routine from intr.c / intrng.c into
arm/machdep_intr.c - removing the code duplication and removing
the ARM specific bits from here.
  
  Thanks to the Star Wars: The Force Awakens premiere line for allowing
  me a couple hours of quiet time to finish the universe builds.
  
  Tested:
  
  * make universe
  
  TODO:
  
  * The structure definitions in subr_intr.c still includes machine/intr.h
which requires one duplicates all of the intrng definitions in
the platform code (which kan has done, and I think we don't have to.)
  
Instead I should break out the generic things (function declarations,
common intr structures, etc) into a separate header.
  
  * Kan has requested I make the PIC based IPI stuff optional.

Added:
  head/sys/arm/arm/machdep_intr.c   (contents, props changed)
  head/sys/kern/pic_if.m
 - copied, changed from r292394, head/sys/arm/arm/pic_if.m
  head/sys/kern/subr_intr.c
 - copied, changed from r292394, head/sys/arm/arm/intrng.c
Deleted:
  head/sys/arm/arm/intrng.c
  head/sys/arm/arm/pic_if.m
Modified:
  head/sys/arm/allwinner/a20/a20_mp.c
  head/sys/arm/altera/socfpga/socfpga_mp.c
  head/sys/arm/amlogic/aml8726/aml8726_mp.c
  head/sys/arm/annapurna/alpine/alpine_machdep_mp.c
  head/sys/arm/arm/exception.S
  head/sys/arm/arm/gic.c
  head/sys/arm/arm/intr.c
  head/sys/arm/arm/mp_machdep.c
  head/sys/arm/arm/nexus.c
  head/sys/arm/freescale/imx/imx6_mp.c
  head/sys/arm/freescale/imx/imx_gpio.c
  head/sys/arm/include/intr.h
  head/sys/arm/include/smp.h
  head/sys/arm/qemu/virt_mp.c
  head/sys/arm/rockchip/rk30xx_mp.c
  head/sys/arm/samsung/exynos/exynos5_mp.c
  head/sys/arm/ti/omap4/omap4_mp.c
  head/sys/arm/xilinx/zy7_mp.c
  head/sys/conf/files.arm

Modified: head/sys/arm/allwinner/a20/a20_mp.c
==
--- head/sys/arm/allwinner/a20/a20_mp.c Fri Dec 18 05:39:25 2015
(r292425)
+++ head/sys/arm/allwinner/a20/a20_mp.c Fri Dec 18 05:43:59 2015
(r292426)
@@ -61,7 +61,7 @@ void
 platform_mp_init_secondary(void)
 {
 
-   arm_pic_init_secondary();
+   intr_pic_init_secondary();
 }
 
 void

Modified: head/sys/arm/altera/socfpga/socfpga_mp.c
==
--- head/sys/arm/altera/socfpga/socfpga_mp.cFri Dec 18 05:39:25 2015
(r292425)
+++ head/sys/arm/altera/socfpga/socfpga_mp.cFri Dec 18 05:43:59 2015
(r292426)
@@ -87,7 +87,7 @@ void
 platform_mp_init_secondary(void)
 {
 
-   arm_pic_init_secondary();
+   intr_pic_init_secondary();
 }
 
 void

Modified: head/sys/arm/amlogic/aml8726/aml8726_mp.c
==
--- head/sys/arm/amlogic/aml8726/aml8726_mp.c   Fri Dec 18 05:39:25 2015
(r292425)
+++ head/sys/arm/amlogic/aml8726/aml8726_mp.c   Fri Dec 18 05:43:59 2015
(r292426)
@@ -351,7 +351,7 @@ platform_mp_init_secondary(void)
 * each AP.
 */
 
-arm_pic_init_secondary();
+intr_pic_init_secondary();
 }
 
 

Modified: head/sys/arm/annapurna/alpine/alpine_machdep_mp.c
==
--- head/sys/arm/annapurna/alpine/alpine_machdep_mp.c   Fri Dec 18 05:39:25 
2015(r292425)
+++ head/sys/arm/annapurna/alpine/alpine_machdep_mp.c   Fri Dec 18 05:43:59 
2015(r292426)
@@ -122,7 +122,7 @@ void
 platform_mp_init_secondary(void)
 {
 
-   arm_pic_init_secondary();
+   intr_pic_init_secondary();
 }
 
 void

Modified: head/sys/arm/arm/exception.S
==
--- head/sys/arm/arm/exception.SFri Dec 18 05:39:25 2015
(r292425)
+++ head/sys/arm/arm/exception.SFri Dec 18 05:43:59 2015
(r292426)
@@ -410,7 +410,7 @@ ASENTRY_NP(irq_entry)
PUSHFRAMEINSVC  /* mode stack, build trapframe there. */
adr lr, exception_exit  /* Return from handler via standard */
mov r0, sp  /* exception exit routine.  Pass the */
-   b   _C_LABEL(arm_irq_handler)/* trapframe to the handler. */
+   b   _C_LABEL(intr_irq_handler)/* trapframe to the handler. */
 END(irq_entry)
 
 /*

Modified: head/sys/arm/arm/gic.c
==
--- head/sys/arm/arm/gic.c  Fri Dec 18 05:39:25 20

svn commit: r292427 - head/libexec/rtld-elf

2015-12-17 Thread Warner Losh
Author: imp
Date: Fri Dec 18 05:45:49 2015
New Revision: 292427
URL: https://svnweb.freebsd.org/changeset/base/292427

Log:
  Use variable names that aren't as prone to dyslexic confusion.
  
  Suggested by: jmallet@

Modified:
  head/libexec/rtld-elf/rtld.c

Modified: head/libexec/rtld-elf/rtld.c
==
--- head/libexec/rtld-elf/rtld.cFri Dec 18 05:43:59 2015
(r292426)
+++ head/libexec/rtld-elf/rtld.cFri Dec 18 05:45:49 2015
(r292427)
@@ -257,7 +257,7 @@ bool ld_library_path_rpath = false;
 /*
  * Globals for path names, and such
  */
-char *ld_path_elf_hints = _PATH_ELF_HINTS;
+char *ld_elf_hints_default = _PATH_ELF_HINTS;
 char *ld_path_libmap_conf = _PATH_LIBMAP_CONF;
 char *ld_path_rtld = _PATH_RTLD;
 char *ld_standard_library_path = STANDARD_LIBRARY_PATH;
@@ -458,7 +458,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_
 ld_utrace = getenv(LD_ "UTRACE");
 
 if ((ld_elf_hints_path == NULL) || strlen(ld_elf_hints_path) == 0)
-   ld_elf_hints_path = ld_path_elf_hints;
+   ld_elf_hints_path = ld_elf_hints_default;
 
 if (ld_debug != NULL && *ld_debug != '\0')
debug = 1;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r292410 - head/usr.sbin/boot0cfg

2015-12-17 Thread Garrett Cooper

> On Dec 17, 2015, at 21:36, luke  wrote:
> 
>> On Fri, Dec 18, 2015 at 4:42 AM, John Baldwin  wrote:
>> Author: jhb
>> Date: Thu Dec 17 20:42:05 2015
>> New Revision: 292410
>> URL: https://svnweb.freebsd.org/changeset/base/292410
>> 
>> Log:
>>   Exit cleanly if malloc() fails to allocate a buffer for a copy of the
>>   current MBR.
>> 
>>   PR:   205322
>>   Submitted by: Alexander Kuleshov 
>>   MFC after:1 week
>> 
>> Modified:
>>   head/usr.sbin/boot0cfg/boot0cfg.c
>> 
>> Modified: head/usr.sbin/boot0cfg/boot0cfg.c
>> ==
>> --- head/usr.sbin/boot0cfg/boot0cfg.c   Thu Dec 17 20:33:20 2015
>> (r292409)
>> +++ head/usr.sbin/boot0cfg/boot0cfg.c   Thu Dec 17 20:42:05 2015
>> (r292410)
>> @@ -337,6 +337,8 @@ read_mbr(const char *disk, u_int8_t **mb
>> return (mbr_size);
>>  }
>>  *mbr = malloc(sizeof(buf));
>> +if (mbr == NULL)
>> +   errx(1, "%s: unable to allocate MBR buffer", disk);
>>  memcpy(*mbr, buf, sizeof(buf));
>>  close(fd);


> Hi, 
> 
> Should the check be against *mbr  ?
> +if (*mbr == NULL)
> +   errx(1, "%s: unable to allocate MBR buffer", disk);

Yup!
___
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: r292428 - head/sys/dev/nand

2015-12-17 Thread Warner Losh
Author: imp
Date: Fri Dec 18 05:55:24 2015
New Revision: 292428
URL: https://svnweb.freebsd.org/changeset/base/292428

Log:
  No need to test command values this way. There can be only one, even
  though the encoding is bit-wise today...

Modified:
  head/sys/dev/nand/nand_cdev.c
  head/sys/dev/nand/nand_geom.c

Modified: head/sys/dev/nand/nand_cdev.c
==
--- head/sys/dev/nand/nand_cdev.c   Fri Dec 18 05:45:49 2015
(r292427)
+++ head/sys/dev/nand/nand_cdev.c   Fri Dec 18 05:55:24 2015
(r292428)
@@ -236,10 +236,10 @@ nand_strategy(struct bio *bp)
chip = dev->si_drv1;
 
nand_debug(NDBG_CDEV, "Strategy %s on chip %d [%p]\n",
-   (bp->bio_cmd & BIO_READ) == BIO_READ ? "READ" : "WRITE",
+   bp->bio_cmd == BIO_READ ? "READ" : "WRITE",
chip->num, chip);
 
-   if ((bp->bio_cmd & BIO_READ) == BIO_READ) {
+   if (bp->bio_cmd == BIO_READ) {
err = nand_read(chip,
bp->bio_offset & 0x,
bp->bio_data, bp->bio_bcount);

Modified: head/sys/dev/nand/nand_geom.c
==
--- head/sys/dev/nand/nand_geom.c   Fri Dec 18 05:45:49 2015
(r292427)
+++ head/sys/dev/nand/nand_geom.c   Fri Dec 18 05:55:24 2015
(r292428)
@@ -100,9 +100,9 @@ nand_strategy(struct bio *bp)
bp->bio_driver1 = BIO_NAND_STD;
 
nand_debug(NDBG_GEOM, "Strategy %s on chip %d [%p]",
-   (bp->bio_cmd & BIO_READ) == BIO_READ ? "READ" :
-   ((bp->bio_cmd & BIO_WRITE) == BIO_WRITE ? "WRITE" :
-   ((bp->bio_cmd & BIO_DELETE) == BIO_DELETE ? "DELETE" : "UNKNOWN")),
+   bp->bio_cmd == BIO_READ ? "READ" :
+   (bp->bio_cmd == BIO_WRITE ? "WRITE" :
+   (bp->bio_cmd == BIO_DELETE ? "DELETE" : "UNKNOWN")),
chip->num, chip);
 
mtx_lock(&chip->qlock);
@@ -122,9 +122,9 @@ nand_strategy_raw(struct bio *bp)
bp->bio_driver1 = BIO_NAND_RAW;
 
nand_debug(NDBG_GEOM, "Strategy %s on chip %d [%p]",
-   (bp->bio_cmd & BIO_READ) == BIO_READ ? "READ" :
-   ((bp->bio_cmd & BIO_WRITE) == BIO_WRITE ? "WRITE" :
-   ((bp->bio_cmd & BIO_DELETE) == BIO_DELETE ? "DELETE" : "UNKNOWN")),
+   bp->bio_cmd == BIO_READ ? "READ" :
+   (bp->bio_cmd == BIO_WRITE ? "WRITE" :
+   (bp->bio_cmd == BIO_DELETE ? "DELETE" : "UNKNOWN")),
chip->num, chip);
 
mtx_lock(&chip->qlock);
@@ -320,21 +320,21 @@ nand_io_proc(void *arg, int pending)
break;
 
if (bp->bio_driver1 == BIO_NAND_STD) {
-   if ((bp->bio_cmd & BIO_READ) == BIO_READ) {
+   if (bp->bio_cmd == BIO_READ) {
err = nand_read(chip,
bp->bio_offset & 0x,
bp->bio_data, bp->bio_bcount);
-   } else if ((bp->bio_cmd & BIO_WRITE) == BIO_WRITE) {
+   } else if (bp->bio_cmd == BIO_WRITE) {
err = nand_write(chip,
bp->bio_offset & 0x,
bp->bio_data, bp->bio_bcount);
}
} else if (bp->bio_driver1 == BIO_NAND_RAW) {
-   if ((bp->bio_cmd & BIO_READ) == BIO_READ) {
+   if (bp->bio_cmd == BIO_READ) {
err = nand_read_raw(chip,
bp->bio_offset & 0x,
bp->bio_data, bp->bio_bcount);
-   } else if ((bp->bio_cmd & BIO_WRITE) == BIO_WRITE) {
+   } else if (bp->bio_cmd == BIO_WRITE) {
err = nand_write_raw(chip,
bp->bio_offset & 0x,
bp->bio_data, bp->bio_bcount);
@@ -342,7 +342,7 @@ nand_io_proc(void *arg, int pending)
} else
panic("Unknown access type in bio->bio_driver1\n");
 
-   if ((bp->bio_cmd & BIO_DELETE) == BIO_DELETE) {
+   if (bp->bio_cmd == BIO_DELETE) {
nand_debug(NDBG_GEOM, "Delete on chip%d offset %lld "
"length %ld\n", chip->num, bp->bio_offset,
bp->bio_bcount);
___
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: r292429 - head/sys/sys

2015-12-17 Thread Warner Losh
Author: imp
Date: Fri Dec 18 06:13:18 2015
New Revision: 292429
URL: https://svnweb.freebsd.org/changeset/base/292429

Log:
  Add a generic firmware dependent handle to pass from the loader to the
  kernel. This will be used for passing in things like the system table
  from EFI or other similar metadata that can be used by the kernel to
  communicate with the firmware.

Modified:
  head/sys/sys/linker.h

Modified: head/sys/sys/linker.h
==
--- head/sys/sys/linker.h   Fri Dec 18 05:55:24 2015(r292428)
+++ head/sys/sys/linker.h   Fri Dec 18 06:13:18 2015(r292429)
@@ -215,6 +215,7 @@ void *linker_hwpmc_list_objects(void);
 #define MODINFOMD_SHDR 0x0009  /* section header table */
 #define MODINFOMD_CTORS_ADDR   0x000a  /* address of .ctors */
 #define MODINFOMD_CTORS_SIZE   0x000b  /* size of .ctors */
+#define MODINFOMD_FW_HANDLE0x000c  /* Firmware dependent handle */
 #define MODINFOMD_NOCOPY   0x8000  /* don't copy this metadata to 
the kernel */
 
 #define MODINFOMD_DEPLIST  (0x4001 | MODINFOMD_NOCOPY) /* depends on */
___
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: r292410 - head/usr.sbin/boot0cfg

2015-12-17 Thread Marcelo Araujo
2015-12-18 13:53 GMT+08:00 Garrett Cooper :

>
> > On Dec 17, 2015, at 21:36, luke  wrote:
> >
> >> On Fri, Dec 18, 2015 at 4:42 AM, John Baldwin  wrote:
> >> Author: jhb
> >> Date: Thu Dec 17 20:42:05 2015
> >> New Revision: 292410
> >> URL: https://svnweb.freebsd.org/changeset/base/292410
> >>
> >> Log:
> >>   Exit cleanly if malloc() fails to allocate a buffer for a copy of the
> >>   current MBR.
> >>
> >>   PR:   205322
> >>   Submitted by: Alexander Kuleshov 
> >>   MFC after:1 week
> >>
> >> Modified:
> >>   head/usr.sbin/boot0cfg/boot0cfg.c
> >>
> >> Modified: head/usr.sbin/boot0cfg/boot0cfg.c
> >>
> ==
> >> --- head/usr.sbin/boot0cfg/boot0cfg.c   Thu Dec 17 20:33:20 2015
> (r292409)
> >> +++ head/usr.sbin/boot0cfg/boot0cfg.c   Thu Dec 17 20:42:05 2015
> (r292410)
> >> @@ -337,6 +337,8 @@ read_mbr(const char *disk, u_int8_t **mb
> >> return (mbr_size);
> >>  }
> >>  *mbr = malloc(sizeof(buf));
> >> +if (mbr == NULL)
> >> +   errx(1, "%s: unable to allocate MBR buffer", disk);
> >>  memcpy(*mbr, buf, sizeof(buf));
> >>  close(fd);
>
>
> > Hi,
> >
> > Should the check be against *mbr  ?
> > +if (*mbr == NULL)
> > +   errx(1, "%s: unable to allocate MBR buffer", disk);
>
> Yup!
>

+1

Could be write as:
if ((*mbr = malloc(sizeof(buf))) == NULL)
 errx(1, "%s: unable to allocate MBR buffer", disk);


Br,
-- 

-- 
Marcelo Araujo(__)ara...@freebsd.org
\\\'',)http://www.FreeBSD.org    \/  \ ^
Power To Server. .\. /_)
___
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: r292428 - head/sys/dev/nand

2015-12-17 Thread NGie Cooper

> On Dec 17, 2015, at 21:55, Warner Losh  wrote:
> 
> Author: imp
> Date: Fri Dec 18 05:55:24 2015
> New Revision: 292428
> URL: https://svnweb.freebsd.org/changeset/base/292428
> 
> Log:
>  No need to test command values this way. There can be only one, even
>  though the encoding is bit-wise today...

What if a third party has defined other BIOs in addition to these and are doing 
bitwise ORs? I know $work specialized the buf layer — but we don’t use 
nandfs(4) today… not sure about others...
Thanks,
-NGie
___
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: r292428 - head/sys/dev/nand

2015-12-17 Thread Warner Losh
On Thu, Dec 17, 2015 at 11:36 PM, NGie Cooper  wrote:

>
> > On Dec 17, 2015, at 21:55, Warner Losh  wrote:
> >
> > Author: imp
> > Date: Fri Dec 18 05:55:24 2015
> > New Revision: 292428
> > URL: https://svnweb.freebsd.org/changeset/base/292428
> >
> > Log:
> >  No need to test command values this way. There can be only one, even
> >  though the encoding is bit-wise today...
>
> What if a third party has defined other BIOs in addition to these and are
> doing bitwise ORs? I know $work specialized the buf layer — but we don’t
> use nandfs(4) today… not sure about others...
>

Those applications would fail. But they would fail hard in FreeBSD's
default stack due to the
pervasive use of switch statements and direct tests for equality. Only one
bit can ever be
set in the stack today and have things actually work as intended. The only
reason they are
assigned as bits was so that drivers could pass whole classes of commands
up / down the
stack by looking at a bitmask, rather than a series of if statements. This
consideration isn't
relevant to the changes I made, which merely obfuscated the tests for no
benefit.

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