Re: CVS commit: src/sys

2021-02-15 Thread David Young
On Sun, Feb 14, 2021 at 07:46:38PM +, Roy Marples wrote:
> On 13/02/2021 21:34, David Young wrote:
> > On Tue, Feb 09, 2021 at 07:02:32AM +, Roy Marples wrote:
> > > Hi David
> > > 
> > > On 03/02/2021 21:45, David Young wrote:
> > > > 
> > > > This change looks a little hasty to me.
> > > > 
> > > > It looks to me like some of these structs were __packed so that
> > > > they could be read/written directly from/to any offset in a packet
> > > > chain using mtod(), which does not pay any mind to the alignment
> > > > of `*t`:
> > > > 
> > > > #define mtod(m, t)  ((t)((m)->m_data))
> > > > 
> > > > I see gre_h is accessed in that way, just for one example.
> > > 
> > > Looking at the other places where this is handled, does this patch to 
> > > gre_h
> > > address your concerns?
> > > I tested this on aarch64 which does not define __NO_STRICT_ALIGNMENT and 
> > > it
> > > passes the KASSERT.
> > 
> > It is possible to simplify your patch a lot.  The GRE header is only 4
> > bytes long.  On the receive side, just perform the m_pullup like the
> > old code did and then memcpy to a `struct gre_h` on the stack.  On the
> > send side, construct the header on the stack and then memcpy it into the
> > mbuf.
> > 
> > The same general approach, of copying headers between mbufs the stack,
> > is probably plenty fast for virtually any size of header used in the
> > network stack.

Thank you.  I know you probably did not expect to spend so much time on
this.  I appreciate your efforts.

Dave

-- 
David Young
dyo...@pobox.comUrbana, IL(217) 721-9981


Re: CVS commit: src/sys

2021-02-13 Thread David Young
On Tue, Feb 09, 2021 at 07:02:32AM +, Roy Marples wrote:
> Hi David
> 
> On 03/02/2021 21:45, David Young wrote:
> >
> > This change looks a little hasty to me.
> >
> > It looks to me like some of these structs were __packed so that
> > they could be read/written directly from/to any offset in a packet
> > chain using mtod(), which does not pay any mind to the alignment
> > of `*t`:
> >
> > #define mtod(m, t)  ((t)((m)->m_data))
> >
> > I see gre_h is accessed in that way, just for one example.
> 
> Looking at the other places where this is handled, does this patch to gre_h
> address your concerns?
> I tested this on aarch64 which does not define __NO_STRICT_ALIGNMENT and it
> passes the KASSERT.

It is possible to simplify your patch a lot.  The GRE header is only 4
bytes long.  On the receive side, just perform the m_pullup like the
old code did and then memcpy to a `struct gre_h` on the stack.  On the
send side, construct the header on the stack and then memcpy it into the
mbuf.

The same general approach, of copying headers between mbufs the stack,
is probably plenty fast for virtually any size of header used in the
network stack.

Dave

-- 
David Young
dyo...@pobox.comUrbana, IL(217) 721-9981


Re: CVS commit: src/sys

2021-02-03 Thread David Young
On Wed, Feb 03, 2021 at 05:51:40AM +, Roy Marples wrote:
> Module Name:  src
> Committed By: roy
> Date: Wed Feb  3 05:51:40 UTC 2021
> 
> Modified Files:
>   src/sys/net: if_arp.h if_ether.h if_gre.h
>   src/sys/netinet: if_ether.h igmp.h in.h ip.h ip6.h ip_carp.h ip_icmp.h
>   ip_mroute.h ip_var.h tcp.h tcp_debug.h tcp_var.h udp.h udp_var.h
> 
> Log Message:
> Remove __packed from various network structures
> 
> They are already network aligned and adding the __packed attribute
> just causes needless compiler warnings about accssing members of packed
> objects.

This change looks a little hasty to me.

It looks to me like some of these structs were __packed so that
they could be read/written directly from/to any offset in a packet
chain using mtod(), which does not pay any mind to the alignment 
of `*t`:

#define mtod(m, t)  ((t)((m)->m_data))

I see gre_h is accessed in that way, just for one example.  I don't
see any reason in principle that every gre_h accessed through mtod()
should be 16-bit aligned in its buffer, but that is the alignment
the compiler will expect if gre_h is not __packed.  If the actual
alignment ever differs from compiler's expectation, then there
could be a bus error or an unwanted byte rotation/shift.

It looks to me like there's a bit of cleanup to do elsewhere before
removing __packed from network structures.

Dave

-- 
David Young
dyo...@pobox.comUrbana, IL(217) 721-9981


Re: CVS commit: src/share/man/man4

2020-04-09 Thread David Young
On Thu, Apr 09, 2020 at 03:25:32PM +0900, SAITOH Masanobu wrote:
> On 2020/04/09 11:08, David Young wrote:
> > On Wed, Apr 08, 2020 at 11:01:52PM +, Jaromir Dolecek wrote:
> > > on I219 I observe about 35% transmit performance drop when tso4 enabled
> > 
> > This sounds familiar.  There was a bug affecting TCP segmentation
> > offload (I think) that we found at CoyotePoint.  ISTR
> > bus_dmamap_load_mbuf(9) failed with EFBIG because under some
> > circumstances the number of segments in the DMA map was too small
> > for the mbuf chain.  The driver would drop the whole mbuf chain
> > on the floor.  This showed up as terrible performance under some
> > circumstances---possibly when the TCP window grew long?  The solution
> > was to increase the number of DMA segments, *I think*.
> 
> m_defrag() was added to -current in September 2018, and 9.0,
> 8.1, post 7.2 have this code.

Thank you, that's just the change I was thinking of.

Dave

-- 
David Young
dyo...@pobox.comUrbana, IL(217) 721-9981


Re: CVS commit: src/share/man/man4

2020-04-08 Thread David Young
On Wed, Apr 08, 2020 at 11:01:52PM +, Jaromir Dolecek wrote:
> Module Name:  src
> Committed By: jdolecek
> Date: Wed Apr  8 23:01:52 UTC 2020
> 
> Modified Files:
>   src/share/man/man4: wm.4
> 
> Log Message:
> add a warning in checksum offload that hardware TCP segmentation might be
> slow
> 
> on I219 I observe about 35% transmit performance drop when tso4 enabled

This sounds familiar.  There was a bug affecting TCP segmentation
offload (I think) that we found at CoyotePoint.  ISTR
bus_dmamap_load_mbuf(9) failed with EFBIG because under some
circumstances the number of segments in the DMA map was too small
for the mbuf chain.  The driver would drop the whole mbuf chain
on the floor.  This showed up as terrible performance under some
circumstances---possibly when the TCP window grew long?  The solution
was to increase the number of DMA segments, *I think*.

I don't think CoyotePoint ever fed its change back to NetBSD,
unfortunately.  On the other hand, some other NetBSDer may have
independently fixed the bug.

Do any stats increase (vmstat -e, ifconfig -v wm0) when the poor
performance occurs? You may have to enable WM_DEBUG or something to see
all of the relevant stats.

Dave

-- 
David Young
dyo...@pobox.comUrbana, IL(217) 721-9981


Re: CVS commit: src/sys/kern

2019-11-07 Thread David Young
On Thu, Nov 07, 2019 at 04:26:51PM +0100, Martin Husemann wrote:
> On Thu, Nov 07, 2019 at 02:53:08PM +0100, Kamil Rytarowski wrote:
> > On 07.11.2019 14:25, Valery Ushakov wrote:
> > > If the sanitizer does complain about other uses, there is little point
> > > in fixing one instance and not the others.
> > 
> > We already agreed with Christos that this is appeasing of GCC. If you
> > want to scan the whole kernel (or whole C) file for more occurrences of
> > violations - please go for it.
> 
> No. The commit needs to be reverted, and then
> 
>  a) either the root cause for the unaligned address be fixed or
>  b) some other means be found to make the sanitizer shut up
> 
> As uwe said: papering over a tiny detail that *never* hits in the real
> world but potentialy hiding a real issue is not the way to go.
> 
> Martin
> 
> P.S.: Independend of this I would still like an official C standard
> clarification; in my reading a simple address calculation is not
> accessing an object through a pointer (which would be the undefined
> behaviour). If the C standard is not clear on this, it needs to be
> improved.

I think the problem is that if you have the series of statements,

element_t *e = >element;

if (s == NULL)
return;

then the comparison with NULL implies that in this scope, s could
be NULL.  NULL does not necessarily have any "arithmetic" relationship
to any other pointer---by that rationale, you probably cannot assign
any alignment to it---so there is no sensible value that you can
give to e.

There is probably an argument to be made that in a
segmented/tagged/capability architecture that has run C programs
(8086; Burroughs Large Systems) or may run them in the future (CHERI),
&(NULL)->element cannot sensibly be computed.

Dave

-- 
David Young
dyo...@pobox.comUrbana, IL(217) 721-9981


CVS commit: src/share/man/man9

2019-11-05 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Nov  5 22:19:43 UTC 2019

Modified Files:
src/share/man/man9: vmem.9

Log Message:
Fix typo: vmem_add(9) does not actually take an `addrp` argument.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/share/man/man9/vmem.9

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/man/man9/vmem.9
diff -u src/share/man/man9/vmem.9:1.17 src/share/man/man9/vmem.9:1.18
--- src/share/man/man9/vmem.9:1.17	Mon Jul  3 21:28:48 2017
+++ src/share/man/man9/vmem.9	Tue Nov  5 22:19:43 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: vmem.9,v 1.17 2017/07/03 21:28:48 wiz Exp $
+.\"	$NetBSD: vmem.9,v 1.18 2019/11/05 22:19:43 dyoung Exp $
 .\"
 .\" Copyright (c)2006 YAMAMOTO Takashi,
 .\" All rights reserved.
@@ -25,7 +25,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\" 
-.Dd February 28, 2016
+.Dd November 5, 2019
 .Dt VMEM 9
 .Os
 .\" 
@@ -52,7 +52,7 @@
 .\" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 .Ft int
 .Fn vmem_add \
-"vmem_t *vm" "vmem_addr_t addr" "vmem_size_t size" "vm_flag_t flags" "vmem_addr_t *addrp"
+"vmem_t *vm" "vmem_addr_t addr" "vmem_size_t size" "vm_flag_t flags"
 .\" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 .Ft int
 .Fn vmem_xalloc \



CVS commit: src/share/man/man9

2019-11-05 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Nov  5 22:19:43 UTC 2019

Modified Files:
src/share/man/man9: vmem.9

Log Message:
Fix typo: vmem_add(9) does not actually take an `addrp` argument.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/share/man/man9/vmem.9

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/unexpand

2019-09-13 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Sep 13 17:32:29 UTC 2019

Modified Files:
src/usr.bin/unexpand: unexpand.c

Log Message:
Deduplicate some code I'd duplicated, shorten a couple of staircases,
repair the indentation in usage().  NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/usr.bin/unexpand/unexpand.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/unexpand

2019-09-13 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Sep 13 17:32:29 UTC 2019

Modified Files:
src/usr.bin/unexpand: unexpand.c

Log Message:
Deduplicate some code I'd duplicated, shorten a couple of staircases,
repair the indentation in usage().  NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/usr.bin/unexpand/unexpand.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/unexpand/unexpand.c
diff -u src/usr.bin/unexpand/unexpand.c:1.17 src/usr.bin/unexpand/unexpand.c:1.18
--- src/usr.bin/unexpand/unexpand.c:1.17	Fri Sep 13 17:26:27 2019
+++ src/usr.bin/unexpand/unexpand.c	Fri Sep 13 17:32:29 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: unexpand.c,v 1.17 2019/09/13 17:26:27 dyoung Exp $	*/
+/*	$NetBSD: unexpand.c,v 1.18 2019/09/13 17:32:29 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1980, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = "@(#)unexpand.c	8.1 (Berkeley) 6/6/93";
 #endif
-__RCSID("$NetBSD: unexpand.c,v 1.17 2019/09/13 17:26:27 dyoung Exp $");
+__RCSID("$NetBSD: unexpand.c,v 1.18 2019/09/13 17:32:29 dyoung Exp $");
 #endif /* not lint */
 
 /*
@@ -67,9 +67,9 @@ static void	usage(void) __attribute__((_
 static void
 usage(void)
 {
-(void)fprintf(stderr, "Usage: %s [-a] [-t tabstop] [file ...]\n",
-	getprogname());
-exit(EXIT_FAILURE);
+	(void)fprintf(stderr, "Usage: %s [-a] [-t tabstop] [file ...]\n",
+	getprogname());
+	exit(EXIT_FAILURE);
 }
 
 int
@@ -132,6 +132,7 @@ main(int argc, char **argv)
 static void
 tabify(const char *line, size_t len)
 {
+	const size_t dstop = (nstops == 0) ? DSTOP : tabstops[0];
 	const char *e, *p;
 	size_t dcol, ocol, limit, n;
 
@@ -144,33 +145,25 @@ tabify(const char *line, size_t len)
 			continue;
 		} else if (*p == '\t') {
 			if (nstops <= 1) {
-size_t stop = (nstops == 0)
-? DSTOP
-: tabstops[0];
-dcol = (1 + dcol / stop) * stop;
+dcol = (1 + dcol / dstop) * dstop;
+continue;
+			}
+			for (n = 0; n < nstops && tabstops[n] <= dcol; n++)
+continue;
+			if (n < nstops - 1 && tabstops[n] - 1 < limit) {
+dcol = tabstops[n];
 continue;
-			} else {
-for (n = 0; n < nstops &&
-tabstops[n] - 1 < dcol; n++)
-	continue;
-if (n < nstops - 1 && tabstops[n] - 1 < limit) {
-	dcol = tabstops[n];
-	continue;
-}
 			}
 		}
 
 		/* Output our tabs */
 		if (nstops <= 1) {
-			size_t stop = (nstops == 0)
-			? DSTOP
-			: tabstops[0];
-			while (((ocol + stop) / stop) <= (dcol / stop)) {
+			while (((ocol + dstop) / dstop) <= (dcol / dstop)) {
 if (dcol - ocol < 2)
 	break;
 if (putchar('\t') == EOF)
 	goto out;
-ocol = (1 + ocol / stop) * stop;
+ocol = (1 + ocol / dstop) * dstop;
 			}
 		} else {
 			for (n = 0; n < nstops && tabstops[n] <= ocol; n++)
@@ -203,13 +196,15 @@ tabify(const char *line, size_t len)
 			dcol++;
 		}
 
+		if (all && dcol < limit)
+			continue; /* Collapse the rest of the line. */
+
 		/* Output remainder of line */
-		if (!all || dcol >= limit) {
-			for (p++; p < e; p++)
-if (putchar(*p) == EOF)
-	goto out;
-			return;
+		for (p++; p < e; p++) {
+			if (putchar(*p) == EOF)
+goto out;
 		}
+		return;
 	}
 	return;
 out:



CVS commit: src/usr.bin/unexpand

2019-09-13 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Sep 13 17:26:28 UTC 2019

Modified Files:
src/usr.bin/unexpand: unexpand.c

Log Message:
Fix `unexpand -a -t n`, which also did not treat `-t n` like it
established stops n, 2 n, 3 n, 


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/unexpand/unexpand.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/unexpand/unexpand.c
diff -u src/usr.bin/unexpand/unexpand.c:1.16 src/usr.bin/unexpand/unexpand.c:1.17
--- src/usr.bin/unexpand/unexpand.c:1.16	Fri Sep 13 16:53:05 2019
+++ src/usr.bin/unexpand/unexpand.c	Fri Sep 13 17:26:27 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: unexpand.c,v 1.16 2019/09/13 16:53:05 dyoung Exp $	*/
+/*	$NetBSD: unexpand.c,v 1.17 2019/09/13 17:26:27 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1980, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = "@(#)unexpand.c	8.1 (Berkeley) 6/6/93";
 #endif
-__RCSID("$NetBSD: unexpand.c,v 1.16 2019/09/13 16:53:05 dyoung Exp $");
+__RCSID("$NetBSD: unexpand.c,v 1.17 2019/09/13 17:26:27 dyoung Exp $");
 #endif /* not lint */
 
 /*
@@ -136,7 +136,7 @@ tabify(const char *line, size_t len)
 	size_t dcol, ocol, limit, n;
 
 	dcol = ocol = 0;
-	limit = nstops == 0 ? UINT_MAX : tabstops[nstops - 1] - 1;
+	limit = nstops <= 1 ? UINT_MAX : tabstops[nstops - 1] - 1;
 	e = line + len;
 	for (p = line; p < e; p++) {
 		if (*p == ' ') {



CVS commit: src/usr.bin/unexpand

2019-09-13 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Sep 13 17:26:28 UTC 2019

Modified Files:
src/usr.bin/unexpand: unexpand.c

Log Message:
Fix `unexpand -a -t n`, which also did not treat `-t n` like it
established stops n, 2 n, 3 n, 


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/unexpand/unexpand.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/unexpand

2019-09-13 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Sep 13 16:53:05 UTC 2019

Modified Files:
src/usr.bin/unexpand: unexpand.c

Log Message:
Fix a handful of bugs in unexpand(1):

1. -a and -t were mutually exclusive when they should not be.

2. `unexpand -t n` did not treat a file like there were stops at n, 2
   n, 3 n, 4 n, and so on.  So expanded tabs after column 4 were not
   collapsed.

3. a debug fprintf wrote every tabstop set with `-t` to the standard
   error stream.

TBD write some tests.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/unexpand/unexpand.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/unexpand

2019-09-13 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Sep 13 16:53:05 UTC 2019

Modified Files:
src/usr.bin/unexpand: unexpand.c

Log Message:
Fix a handful of bugs in unexpand(1):

1. -a and -t were mutually exclusive when they should not be.

2. `unexpand -t n` did not treat a file like there were stops at n, 2
   n, 3 n, 4 n, and so on.  So expanded tabs after column 4 were not
   collapsed.

3. a debug fprintf wrote every tabstop set with `-t` to the standard
   error stream.

TBD write some tests.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/unexpand/unexpand.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/unexpand/unexpand.c
diff -u src/usr.bin/unexpand/unexpand.c:1.15 src/usr.bin/unexpand/unexpand.c:1.16
--- src/usr.bin/unexpand/unexpand.c:1.15	Wed Feb  3 05:32:14 2016
+++ src/usr.bin/unexpand/unexpand.c	Fri Sep 13 16:53:05 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: unexpand.c,v 1.15 2016/02/03 05:32:14 christos Exp $	*/
+/*	$NetBSD: unexpand.c,v 1.16 2019/09/13 16:53:05 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1980, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = "@(#)unexpand.c	8.1 (Berkeley) 6/6/93";
 #endif
-__RCSID("$NetBSD: unexpand.c,v 1.15 2016/02/03 05:32:14 christos Exp $");
+__RCSID("$NetBSD: unexpand.c,v 1.16 2019/09/13 16:53:05 dyoung Exp $");
 #endif /* not lint */
 
 /*
@@ -86,13 +86,9 @@ main(int argc, char **argv)
 	while ((c = getopt(argc, argv, "at:")) != -1) {
 		switch (c) {
 		case 'a':
-			if (nstops)
-usage();
-			all++;
+			all = 1;
 			break;
 		case 't':
-			if (all)
-usage();
 			while ((tab = strsep(, ", \t")) != NULL) {
 if (*tab == '\0')
 	continue;
@@ -121,9 +117,6 @@ main(int argc, char **argv)
 	argc -= optind;
 	argv += optind;
 
-	for (i = 0; i < nstops; i++)
-		fprintf(stderr, "%lu %zu\n", i, tabstops[i]);
-
 	do {
 		if (argc > 0) {
 			if (freopen(argv[0], "r", stdin) == NULL)
@@ -150,8 +143,11 @@ tabify(const char *line, size_t len)
 			dcol++;
 			continue;
 		} else if (*p == '\t') {
-			if (nstops == 0) {
-dcol = (1 + dcol / DSTOP) * DSTOP;
+			if (nstops <= 1) {
+size_t stop = (nstops == 0)
+? DSTOP
+: tabstops[0];
+dcol = (1 + dcol / stop) * stop;
 continue;
 			} else {
 for (n = 0; n < nstops &&
@@ -165,13 +161,16 @@ tabify(const char *line, size_t len)
 		}
 
 		/* Output our tabs */
-		if (nstops == 0) {
-			while (((ocol + DSTOP) / DSTOP) <= (dcol / DSTOP)) {
+		if (nstops <= 1) {
+			size_t stop = (nstops == 0)
+			? DSTOP
+			: tabstops[0];
+			while (((ocol + stop) / stop) <= (dcol / stop)) {
 if (dcol - ocol < 2)
 	break;
 if (putchar('\t') == EOF)
 	goto out;
-ocol = (1 + ocol / DSTOP) * DSTOP;
+ocol = (1 + ocol / stop) * stop;
 			}
 		} else {
 			for (n = 0; n < nstops && tabstops[n] <= ocol; n++)



Re: CVS commit: src/sys/dev

2018-03-01 Thread David Young
On Thu, Mar 01, 2018 at 05:04:01AM +, m...@netbsd.org wrote:
> Index: dev/acpi/acpi.c
> ===
> RCS file: /cvsroot/src/sys/dev/acpi/acpi.c,v
> retrieving revision 1.265
> diff -u -r1.265 acpi.c
> --- dev/acpi/acpi.c   23 Nov 2017 15:48:24 -  1.265
> +++ dev/acpi/acpi.c   1 Mar 2018 04:57:44 -
> @@ -103,6 +103,7 @@
>  __KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.265 2017/11/23 15:48:24 jmcneill Exp 
> $");
>  
>  #include "opt_acpi.h"
> +#include "opt_pci.h"
>  #include "opt_pcifixup.h"
>  
>  #include 
> @@ -487,10 +488,12 @@
>*/
>   acpi_build_tree(sc);
>  
> +#ifdef NPCI
>   /*
>* Probe MCFG table
>*/
>   acpimcfg_probe(sc);
> +#endif
>  

You could also use a weak stub here and avoid the #ifdef/#endif.

Dave

-- 
David Young
dyo...@pobox.comUrbana, IL(217) 721-9981


Re: CVS commit: src/sys/net80211

2018-01-16 Thread David Young
On Tue, Jan 16, 2018 at 08:39:29AM +, Maxime Villard wrote:
> Module Name:  src
> Committed By: maxv
> Date: Tue Jan 16 08:39:29 UTC 2018
> 
> Modified Files:
>   src/sys/net80211: ieee80211_input.c
> 
> Log Message:
> Split ieee80211_input into three sub-functions, that parse received
> packets depending on their type:
> 
>   DATA   -> ieee80211_input_data
>   MANAGEMENT -> ieee80211_input_management
>   CONTROL-> ieee80211_input_control
> 
> No real functional change, but makes the code much clearer.

IMO, changes like this are important and overdue, however, do keep in
mind the provenance of this code: NetBSD -> FreeBSD.

Maybe you have written off ever re-synching with FreeBSD?  If so, do
you have a plan for integrating useful features like virtual stations
independently of their code?

I have said it before, that I do think the "concept architecture" of
802.11 VAP is rather broken, but let's be honest: nobody, especially not
I, have had the time in 10+ years to independently implement anything
comparable. *shrug*

Dave

-- 
David Young
dyo...@pobox.comUrbana, IL(217) 721-9981


Re: CVS commit: src/sys/net80211

2016-04-06 Thread David Young
On Wed, Apr 06, 2016 at 02:42:16PM +, Roy Marples wrote:
> Module Name:  src
> Committed By: roy
> Date: Wed Apr  6 14:42:16 UTC 2016
> 
> Modified Files:
>   src/sys/net80211: ieee80211_ioctl.h ieee80211_node.c ieee80211_node.h
>   ieee80211_rssadapt.h ieee80211_var.h
> 
> Log Message:
> ieee80211 users in Other OS export rssi and noise as int8_t.
> We should not be the odd one out for no good reason and the majority
> of the ieee80211 drivers treat rssi as int8_t.

This may be a more difficult change to make properly than you
anticipated.  Drivers like rtw(4) assume 0 <= RSSI <= UINT8_MAX.  If you
put those RSSI into an int8_t, then for high signal strengths the number
may change sign instead of increase in magnitude.

Dave

-- 
David Young
dyo...@pobox.comUrbana, IL(217) 721-9981


Re: CVS commit: othersrc/external/bsd/arfe

2015-12-05 Thread David Young
On Sat, Dec 05, 2015 at 07:43:58PM +, Roy Marples wrote:
> Hi Thomas
> 
> On 05/12/2015 08:47, Thomas Klausner wrote:
> > Module Name:othersrc
> > Committed By:   wiz
> > Date:   Sat Dec  5 08:47:24 UTC 2015
> > 
> > Modified Files:
> > othersrc/external/bsd/arfe/dt: dt.c
> > othersrc/external/bsd/arfe/it: it.c
> > othersrc/external/bsd/arfe/tt: tt.c
> > 
> > Log Message:
> > Sprinkle __attribute__((__noreturn__)) to fix build on 7.99.23 with clang.
> 
> Why don't you use __dead as defined by sys/cdefs.h?

I could not remember that we called it __dead on NetBSD.  Maybe Thomas
did not remember, either.  I will change it to __dead in my next round
of commits.

Dave

-- 
David Young
dyo...@pobox.comUrbana, IL(217) 721-9981


Re: CVS commit: src/sys/arch/mips/adm5120/dev

2013-09-22 Thread David Young
On Sun, Sep 22, 2013 at 08:30:22AM +, Nick Hudson wrote:
 Module Name:  src
 Committed By: skrll
 Date: Sun Sep 22 08:30:22 UTC 2013
 
 Modified Files:
   src/sys/arch/mips/adm5120/dev: ahci.c ahcivar.h
 
 Log Message:
 Adapt to usbmp. Compile tested only.
 
 Did this ever work?

That's a good question.  I think that it did.  I know who to ask.  I can
provide remote access to an RB153, too.

Dave

-- 
David Young
dyo...@pobox.comUrbana, IL(217) 721-9981


Re: CVS commit: src/usr.sbin/makefs

2013-08-07 Thread David Young
On Mon, Aug 05, 2013 at 02:41:57PM +, Reinoud Zandijk wrote:
 Module Name:  src
 Committed By: reinoud
 Date: Mon Aug  5 14:41:57 UTC 2013
 
 Modified Files:
   src/usr.sbin/makefs: Makefile makefs.8 makefs.c makefs.h
 Added Files:
   src/usr.sbin/makefs: udf.c
   src/usr.sbin/makefs/udf: Makefile.inc
 
 Log Message:
 Implement `makefs -t udf'.

Great!  Thanks.

Dave

-- 
David Young
dyo...@pobox.comUrbana, IL(217) 721-9981


Re: CVS import: src/external/bsd/dhcpcd/dist

2013-07-20 Thread David Young
On Sat, Jul 20, 2013 at 05:44:52PM +0100, Roy Marples wrote:
 David Holland dholland-sourcechan...@netbsd.org writes:
 On Fri, Jul 19, 2013 at 07:15:52PM -0700, Erik Fair wrote:
* dhcpcd will now assign a short hostname by default
 To use a FQDN hostname, set this in dhcpcd.conf(5)
 env hostname_fqdn=YES
  
   This is the wrong default, too - hostname should always be FQDN.
 
 This is far from universally agreed upon.
 
 However, ISTM that if dhcpcd is going to set the hostname at all
 (which is usually wrong) it should set the hostname the dhcp server
 provides and not try to munge it.
 
 Which hostname should dhcpcd set?

Please, take this to tech-net.

Dave

-- 
David Young
dyo...@pobox.comUrbana, IL(217) 721-9981


Re: CVS commit: src/sys/net80211

2013-03-30 Thread David Young
On Fri, Mar 29, 2013 at 09:05:49PM -0400, Christos Zoulas wrote:
 Module Name:  src
 Committed By: christos
 Date: Sat Mar 30 01:05:49 UTC 2013
 
 Modified Files:
   src/sys/net80211: ieee80211.h ieee80211_proto.h
 
 Log Message:
 EDCA and QOS additions from OpenBSD

Beware: our net80211 derives from FreeBSD's.  IIUC, OpenBSD's and
FreeBSD's are (or were?) quite divergent.

Excessive whitespace probably comes from FreeBSD, too. :-)

Dave

-- 
David Young
dyo...@pobox.comUrbana, IL(217) 721-9981


Re: CVS commit: src/sys/dev/usb

2013-01-29 Thread David Young
On Tue, Jan 29, 2013 at 08:54:27AM -0500, Christos Zoulas wrote:
 Module Name:  src
 Committed By: christos
 Date: Tue Jan 29 13:54:27 UTC 2013
 
 Modified Files:
   src/sys/dev/usb: if_otus.c if_otusvar.h
 
 Log Message:
 1) Use ic_curchan consistently
 2) Ignore frames shorter than sizeof(struct ieee80211_frame).

I'm assuming that this is on the input path.

+   mlen -= IEEE80211_CRC_LEN;  /* strip 802.11 FCS */
+   /* Make sure there's room for an 802.11 header. */
+   /*
+* XXX: This will drop most control packets.  Do we really
+* want this in IEEE80211_M_MONITOR mode?
+*/
+   if (__predict_false(mlen  sizeof(*wh))) {

I'm sure that the driver behavior is all over the place, but it is most
useful to pass to the radiotap before trimming FCS and dropping runts.
Perhaps dropping runts can be left to ieee80211_input()?  It may be less
strict about what qualifies as a runt,

if (m-m_pkthdr.len  sizeof(struct ieee80211_frame_min)) {
IEEE80211_DISCARD_MAC(ic, IEEE80211_MSG_ANY,
ni-ni_macaddr, NULL,
too short (1): len %u, m-m_pkthdr.len);
ic-ic_stats.is_rx_tooshort++;
goto out;
}

Dave

-- 
David Young
dyo...@pobox.comUrbana, IL(217) 721-9981


Re: CVS commit: src/sys/arch

2012-12-09 Thread David Young
On Sat, Dec 08, 2012 at 12:36:31PM +, KIYOHARA Takashi wrote:
 Module Name:  src
 Committed By: kiyohara
 Date: Sat Dec  8 12:36:31 UTC 2012
 
 Modified Files:
   src/sys/arch/i386/i386: db_interface.c trap.c
   src/sys/arch/x86/x86: bus_dma.c cpu.c platform.c
 
 Log Message:
 #ifdef - #endif-ed. NMCA, NISA, NNPX, NIOAPIC, LAPIC, MPBIOS and 
 MULTIPROCESSOR.

Please, add no new #ifdefs.  Let config(1) and the linker configure the
kernel.

Dave

-- 
David Young
dyo...@pobox.comUrbana, IL(217) 721-9981


Re: CVS commit: xsrc/external/mit/libpciaccess/dist/src

2012-11-09 Thread David Young
On Sun, Nov 04, 2012 at 02:56:32AM -0800, Matt Thomas wrote:
 
 On Nov 4, 2012, at 2:26 AM, David Laight wrote:
 
  Personally I almost never mark variables 'const', the only I initialise
  in their declarations (at the top of a function) are probably almost
  always never chaned (well maybe execpt default error values).
 
 Personally, I always mark variable as const if I don't expect its value to 
 change since that documents that expectation.  This is especially true for 
 pointers:
 
   const struct foo_softc * const sc = ifp-if_softc;
 
 Once nice side effect is that it catches errors like:
 
   if (sc = NULL) {
   }

I have taken to making variables const for the same reason.

Sometimes, when dealing with hairy code such as 30 year-old code in the
networking stack, I mark a variable const so that the compiler will
gripe if the variable is re-assigned.  It's easier then to understand
some code and to refactor it.

Dave

-- 
David Young
dyo...@pobox.comUrbana, IL(217) 721-9981


Re: CVS commit: xsrc/external/mit/libpciaccess/dist/src

2012-11-02 Thread David Young
On Fri, Nov 02, 2012 at 07:38:38AM +, Alan Barrett wrote:
 Module Name:  xsrc
 Committed By: apb
 Date: Fri Nov  2 07:38:38 UTC 2012
 
 Modified Files:
   xsrc/external/mit/libpciaccess/dist/src: common_interface.c
 
 Log Message:
 Remove useless extra const in const sometype const * var = value;.
 Foundusing clang -Wduplicate-decl-specifier.

Maybe 'const sometype * const var' was intended, i.e., a single
assignment semantic?  I've probably mistyped that myself several times.

Dave

-- 
David Young
dyo...@pobox.comUrbana, IL(217) 721-9981


Re: CVS commit: src

2012-03-26 Thread David Young
On Mon, Mar 26, 2012 at 04:12:05AM +0900, Izumi Tsutsui wrote:
 dyoung@
 
   Log Message:
   Added urtwn(4), a driver for Realtek RTL8188CU/RTL8192CU USB IEEE 
   802.11b/g/n wireless network devices.
  
  Please add yourself to doc/RESPONSIBLE as maintainer of this driver.
 
 Is it mandatory?  Note the driver was ported from OpenBSD.

I don't think that NetBSD has any rules about it, but if on the day
that the driver is imported, no one with commit privileges who owns the
relevant hardware feels responsible for keeping the driver working in
a changing NetBSD kernel, then I believe that the driver either will
become a burden to other developers or will break.

Dave

-- 
David Young
dyo...@pobox.comUrbana, IL(217) 721-9981


Re: CVS commit: src

2012-03-25 Thread David Young
On Sun, Mar 25, 2012 at 12:11:19AM +, NONAKA Kimihiro wrote:
 Module Name:  src
 Committed By: nonaka
 Date: Sun Mar 25 00:11:18 UTC 2012
 
 Modified Files:
   src/distrib/sets/lists/base: mi
   src/distrib/sets/lists/man: mi
   src/etc/mtree: NetBSD.dist.base
   src/share/man/man4: Makefile usb.4
   src/sys/arch/amd64/conf: GENERIC
   src/sys/arch/i386/conf: GENERIC
   src/sys/dev/usb: files.usb usbdevices.config
 Added Files:
   src/share/man/man4: urtwn.4
   src/sys/dev/usb: if_urtwn.c if_urtwn_data.h if_urtwnreg.h if_urtwnvar.h
   src/sys/modules/if_urtwn: Makefile if_urtwn.ioconf
 
 Log Message:
 Added urtwn(4), a driver for Realtek RTL8188CU/RTL8192CU USB IEEE 802.11b/g/n 
 wireless network devices.

Please add yourself to doc/RESPONSIBLE as maintainer of this driver.

Dave

-- 
David Young
dyo...@pobox.comUrbana, IL(217) 721-9981


Re: CVS commit: src/lib/libc/arch/arm/gen

2012-03-21 Thread David Young
On Wed, Mar 21, 2012 at 10:44:35AM +0100, Joerg Sonnenberger wrote:
 On Wed, Mar 21, 2012 at 09:05:36AM +, Hiroyuki Bessho wrote:
  Module Name:src
  Committed By:   bsh
  Date:   Wed Mar 21 09:05:36 UTC 2012
  
  Modified Files:
  src/lib/libc/arch/arm/gen: _lwp.c
  
  Log Message:
  shut up lint(1)
 
 So the question is still -- how much do we want to uglify our code?

Joerg, please make a positive suggestion instead of sniping at
developers in this way.

Dave

-- 
David Young
dyo...@pobox.comUrbana, IL(217) 721-9981


Re: CVS commit: src/sys/net

2012-02-18 Thread David Young
On Sat, Feb 18, 2012 at 11:47:48PM +, Mindaugas Rasiukevicius wrote:
 Module Name:  src
 Committed By: rmind
 Date: Sat Feb 18 23:47:48 UTC 2012
 
 Modified Files:
   src/sys/net: route.h
 
 Log Message:
 rt_setkey: remove invalid assert, sockaddr_dup() may fail if no memory.

What are the ultimate consequences of setting both rt-_rt_key and
rt-rt_nodes-rn_key to NULL? :-/

Dave

-- 
David Young
dyo...@pobox.comUrbana, IL(217) 721-9981


Re: CVS commit: src/sys/kern

2012-01-31 Thread David Young
On Tue, Jan 31, 2012 at 07:11:38PM +, Alexander Nasonov wrote:
 Module Name:  src
 Committed By: alnsn
 Date: Tue Jan 31 19:11:38 UTC 2012
 
 Modified Files:
   src/sys/kern: subr_pcq.c
 
 Log Message:
 Replace offsetof(pcq_t, pcq_items[nitems]) with sizeof(pcq_t) + sizeof(void 
 *[nitems]).

Yuck. The offsetof() way was much more readable.  Please put it back
the old way.  If you have to, provide and use a runtime_offsetof() that
DTRT.

Dave

-- 
David Young
dyo...@pobox.comUrbana, IL(217) 721-9981


Re: CVS commit: src/sys/arch/sandpoint/sandpoint

2012-01-24 Thread David Young
On Tue, Jan 24, 2012 at 12:10:07PM +0100, Frank Wille wrote:
 On Mon, 23 Jan 2012 18:52:11 -0600
 David Young dyo...@pobox.com wrote:
 
   Log Message:
   A detach function for the onboard flash probably makes no sense, so
   remove it.
  
  Sure it makes sense.
 
 Hmm... how do you detach it? With drvctl(8)? Why should you do that?

drvctl -d device

You should be able to detach it so that you know that the driver can
return the hardware to initial conditions, and so that in a modular
universe you can unload the old driver software and load new.

Dave

-- 
David Young
dyo...@pobox.comUrbana, IL(217) 721-9981


Re: CVS commit: src/sys/arch/sandpoint/sandpoint

2012-01-23 Thread David Young
On Mon, Jan 23, 2012 at 03:16:38PM +, Frank Wille wrote:
 Module Name:  src
 Committed By: phx
 Date: Mon Jan 23 15:16:38 UTC 2012
 
 Modified Files:
   src/sys/arch/sandpoint/sandpoint: flash_cfi.c
 
 Log Message:
 A detach function for the onboard flash probably makes no sense, so remove it.

Sure it makes sense.

Has it been tested, though?

Dave

-- 
David Young
dyo...@pobox.comUrbana, IL(217) 721-9981


Re: CVS commit: src/sys/arch/i386/i386

2012-01-18 Thread David Young
On Wed, Jan 18, 2012 at 09:34:39PM +, Matthias Drochner wrote:
 Module Name:  src
 Committed By: drochner
 Date: Wed Jan 18 21:34:38 UTC 2012
 
 Modified Files:
   src/sys/arch/i386/i386: mainbus.c
 
 Log Message:
 revert previous, the assumption all buses 1 and up must be subordinate
 to pci0 doesn't even hold on i386 -- there are server-class chipsets
 with multiple primary PCI buses, see arch/x86/pci/pchb.c for examples

Matthias, was setting pba_sub = 255 causing material problems for
someone, or are you concerned that lossage will eventually occur on
certain server-class machines?

I ask because, while setting pba_sub that way is far from ideal, it
has worked well for me on a variety of machines, and if it has caused
anybody any trouble, I don't remember them bringing it up with me.

Dave

-- 
David Young
dyo...@pobox.comUrbana, IL(217) 721-9981


Re: CVS commit: src/sys/arch/i386/i386

2012-01-18 Thread David Young
On Wed, Jan 18, 2012 at 11:38:39PM +0100, Matthias Drochner wrote:
 
 dyo...@pobox.com said:
   was setting pba_sub = 255 causing material problems for someone, or
  are you concerned that lossage will eventually occur on certain
  server-class machines?
 
 No, this wasn't causing damage. I was tracking another problem which
 was incidentally triggered by another of your changes -- increased
 stack use lead to stack overflow on amd64 with a deep PCI hierarchy
 (a MicroTCA system).

Tell me more about this.

 Just stumbled over this. But it is obviously wrong. If you think
 it should be in the public tree there should be at least a big fat
 comment telling that it is for testing purposes and nothing uses
 it really and it will be removed before it can cause damage.

It does belong in the public tree.  Please revert the reversion.  I will
add a big, fat comment.

Dave

-- 
David Young
dyo...@pobox.comUrbana, IL(217) 721-9981


Re: CVS commit: src

2011-12-20 Thread David Young
On Tue, Dec 20, 2011 at 03:39:36PM +, Reinoud Zandijk wrote:
 Currently the MAP_NOSYSCALLS is only implemented for x86 but other
 architectures are easy to adapt; see the sys/arch/x86/x86/syscall.c patch.
 Port maintainers are encouraged to add them for their processor ports too.
 When this feature is not yet implemented for an architecture the
 MAP_NOSYSCALLS is simply ignored with virtually no cpu cost..

If MAP_NOSYSCALLS is not implemented, perhaps mmap(2) should fail with
EOPNOTSUPP?  After all, the program that uses MAP_NOSYSCALLS probably
depends on it to work.

Dave

-- 
David Young
dyo...@pobox.comUrbana, IL(217) 721-9981


Re: CVS commit: src/sys/dev/pci

2011-12-11 Thread David Young
On Mon, Dec 12, 2011 at 02:44:15AM +, Jonathan A. Kollasch wrote:
 Module Name:  src
 Committed By: jakllsch
 Date: Mon Dec 12 02:44:15 UTC 2011
 
 Modified Files:
   src/sys/dev/pci: if_sip.c
 
 Log Message:
 Using BUS_DMA_NOCACHE for bus_dmamem_map() causes issues on (at least) 
 sparc64.

What kind of issues?

Dave

-- 
David Young
dyo...@pobox.comUrbana, IL(217) 721-9981


Re: CVS commit: src/sys/dev/pci

2011-12-11 Thread David Young
On Mon, Dec 12, 2011 at 03:54:57PM +1100, matthew green wrote:
 
  On Mon, Dec 12, 2011 at 02:44:15AM +, Jonathan A. Kollasch wrote:
   Module Name:  src
   Committed By: jakllsch
   Date: Mon Dec 12 02:44:15 UTC 2011
   
   Modified Files:
 src/sys/dev/pci: if_sip.c
   
   Log Message:
   Using BUS_DMA_NOCACHE for bus_dmamem_map() causes issues on (at least) 
   sparc64.
  
  What kind of issues?
 
 this is maping normal memory uncached.  attempting to access this
 mapping causes data faults.

Jonathan, please add some explanation to the commit message.

Isn't this just covering a bug in the sparc64 bus_dma(9) implementation?

Dave

-- 
David Young
dyo...@pobox.comUrbana, IL(217) 721-9981


Re: CVS commit: src/sys/dev

2011-12-01 Thread David Young
On Thu, Dec 01, 2011 at 07:42:49PM +0100, Manuel Bouyer wrote:
 On Thu, Dec 01, 2011 at 05:50:14PM +, David Laight wrote:
  I'd rather the .c file wasn't polluted with #ifdefs.
  Probably better to #define fss_compat_ioctl(...) EINVAL somewhere.
  
  We ought to sort out a way of making the compat code loadable
  - in which case this would need to be a real function call
  (possibly an indirect one).
 
 I'm not sure bloating the kernel and infrastrucure with functions call,
 functions pointer and others to be able to compile out 4 lines of code
 is worth it.

Use a weak alias, fss_compat_ioctl() - einval().  Let the compat code
supply a strong symbol for the real implementation.

IIRC, our module loader cannot (yet) load a strong alias over a weak
alias and restore the weak alias when the module containing the strong
alias is unloaded.  That would have been nice to have when bpf was
modularized.

Dave

-- 
David Young
dyo...@pobox.comUrbana, IL(217) 721-9981


Re: CVS commit: src/sys/net

2011-11-07 Thread David Young
On Sun, Nov 06, 2011 at 11:43:06PM +, YAMAMOTO Takashi wrote:
 hi,
 
 isn't PR/40516 a problem for this particular usage?

Probably.  Should we use Andrew's version for now?

Dave

-- 
David Young OJC Technologies is now Pixo
dyo...@pixotech.com Urbana, IL   (217) 344-0444 x24


Re: CVS commit: src/sys/net

2011-11-02 Thread David Young
On Thu, Oct 20, 2011 at 06:59:42AM +, YAMAMOTO Takashi wrote:
 hi,
 
  Module Name:src
  Committed By:   dyoung
  Date:   Wed Oct 19 01:34:37 UTC 2011
  
  Modified Files:
  src/sys/net: if.c if.h
  
  Log Message:
  Start to untangle the ifnet ioctls mess.
  
  Add ifnet functions, if_mcast_op(), if_flags_set(), and if_addr_init()
  for adding/deleting multicast addresses, modifying the if_flags,
  and initializing local/remote addresses.  Make ifpromisc() use
  if_flags_set().  Protocols and network drivers should use these
  instead of ifp-if_ioctl() calls.  Subsequent commits will
  replace ifp-if_ioctl(SIOCADDMULTI| SIOCDELMULTI| SIOCSIFDSTADDR|
  SIOCINITIFADDR| SIOCSIFFLAGS) calls with calls to the new functions.
  
  Use a mutex(9) to synchronize ifp-if_ioctl() calls originating in
  userland.  Also synchronize ifp-if_ioctl() calls with ifnet detachment
  and reclamation.
 
 can you explain what you are trying to achieve with this percpu stuff?

I have tried to explain in some new comments.  Let me know if you still
have questions.

Dave

-- 
David Young OJC Technologies is now Pixo
dyo...@pixotech.com Urbana, IL   (217) 344-0444 x24


Re: CVS commit: src/sys/net

2011-10-19 Thread David Young
On Wed, Oct 19, 2011 at 09:29:51PM +, David Young wrote:
 Module Name:  src
 Committed By: dyoung
 Date: Wed Oct 19 21:29:51 UTC 2011
 
 Modified Files:
   src/sys/net: if.c if.h
 
 Log Message:
 Userland by pulling the ifioctl lock-related data members into a
 struct ifnet_lock that the ifnet has a pointer to.  In a non-_KERNEL
 environment, don't #include sys/percpu.h et cetera, and don't define
 the struct ifnet_lock but *do* declare it.

Oops, that commit message was missing a verb.  I changed it to:

Fix userland compilation: pull the ifioctl lock-related data members
into a struct ifnet_lock that the ifnet has a pointer to.  In a
non-_KERNEL environment, don't #include sys/percpu.h et cetera, and
don't define the struct ifnet_lock but *do* declare it.

Dave

-- 
David Young OJC Technologies is now Pixo
dyo...@pixotech.com Urbana, IL   (217) 344-0444 x24


Re: CVS commit: src/sys

2011-09-18 Thread David Young
On Sat, Sep 17, 2011 at 08:19:47PM +0200, Grégoire Sutre wrote:
 On 09/01/2011 05:10 PM, Christos Zoulas wrote:
 Module Name: src
 Committed By:christos
 Date:Thu Sep  1 15:10:32 UTC 2011
 
 Modified Files:
  src/sys/arch/i386/eisa: eisa_machdep.c
  src/sys/arch/i386/mca: mca_machdep.c
  src/sys/arch/x86/include: bus_private.h
  src/sys/arch/x86/isa: isa_machdep.c
  src/sys/arch/x86/pci: pci_machdep.c
  src/sys/arch/x86/x86: bus_dma.c
  src/sys/arch/xen/xen: isa_machdep.c xpci_xenbus.c
  src/sys/sys: bus.h
 
 Log Message:
 Add bus_dma overrides. From dyoung
 
 Should NULL be allowed as first argument of bus_dma_tag_create?

It should not be.

 I would prefer for NULL to be allowed to make my life easier in
 the drmgem port from OpenBSD.  But maybe requiring non-NULL would
 make more sense if this shall be used from MI device drivers only?

I was working on this a week or two ago, I will send you a patch.

I found that you can simplify the drmgem code a lot if you use
bus_dma_tag_create() to refine an existing tag instead of trying to
create one from scratch.  I think that you can probably make the code
MI, too.

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 344-0444 x24


Re: CVS commit: src

2011-08-31 Thread David Young
On Thu, Sep 01, 2011 at 03:47:29AM +0400, Valeriy E. Ushakov wrote:
 On Thu, Sep 01, 2011 at 01:24:12 +0200, Joerg Sonnenberger wrote:
 
  Please revert this. It is incorrect at least for execl and other
  variadic functions.
 
 What Joerg said.  I know, Xenix 286 is, fortunately, no longer with
 us, but I learned its lessons the hard way :)

Joerg, Valeriy,

Please explain your objection.

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 344-0444 x24


Re: CVS commit: src/sys/arch

2011-08-30 Thread David Young
On Tue, Aug 30, 2011 at 08:01:13AM +, Jukka Ruohonen wrote:
 Module Name:  src
 Committed By: jruoho
 Date: Tue Aug 30 08:01:13 UTC 2011
 
 Modified Files:
   src/sys/arch/amd64/conf: GENERIC
   src/sys/arch/i386/conf: GENERIC
 
 Log Message:
 Comment out the legacy bktr(4) from the GENERICs.

Please put that back.

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 344-0444 x24


Re: CVS commit: src/share/man/man4

2011-08-30 Thread David Young
On Tue, Aug 30, 2011 at 05:58:02AM +, Jukka Ruohonen wrote:
 Module Name:  src
 Committed By: jruoho
 Date: Tue Aug 30 05:58:02 UTC 2011
 
 Modified Files:
   src/share/man/man4: bktr.4
 
 Log Message:
 Note that bktr(4) is not part of the dtv(4) infrastructure.
 
 XXX: This driver should be converted (or even bluntly removed, given the
  lack of general third-party software support).

Jukka,

The driver should be converted, however, I don't think that there is
a case for bluntly removing bktr(4), yet: the Brooktree devices are
still manufactured, they are still used for CCTV, and they were until
very recently (I reckon, still) supported by programs such as ffmpeg.
A client of mine even shipped a product that relies on the legacy
bktr(4) interface.  So you could say that it is not quite dead yet.

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 344-0444 x24


Re: CVS commit: src/sys

2011-08-27 Thread David Young
On Sat, Aug 27, 2011 at 05:05:58PM +, Manuel Bouyer wrote:
 Module Name:  src
 Committed By: bouyer
 Date: Sat Aug 27 17:05:58 UTC 2011
 
 Modified Files:
   src/sys/arch/evbmips/conf: LOONGSON
   src/sys/conf: files
   src/sys/dev/ata: ata_wdc.c
   src/sys/dev/ic: wdc.c
 
 Log Message:
 The loongon2f+cs5526+jmicron PATA-SATA bridge cause an interresting issue:
 1) because the CS5536 is not associated with a x86 CPU, interrupts are not
   ack'ed as it expects so interrupts cannot configured as edge-triggered
   (as is expected for a PCIIDE in compat mode)
 2) the PATA-SATA bridge ignores the WDC_IDS (interrupt disable bit) so
   the PATA IRQ line gets asserted when resetting or running some polled
   commands. It also wrongly asserts IRQ when the (nonexistent) slave
   device is selected
 2) wouldn't be an issue with edge-triggered interrupt because we would
get a spurious interrupt and continue operation, a new interrupt only shows
up when the PATA IRQ line goes low and high again. But because of 1),
we get an unclearable interrupt instead, and the system loops on the
interrupt handler.
 
 To workaround this, introduce a WDC_NO_IDS compile option which runs
 all polled commands (including reset) at splbio() and without sleeps,
 so that the controller's interrupt is effectively disabled and
 won't be reenabled before the interrupt can be cleared.

ata_wdc.c does not compile if !WDC_NO_IDS because it contains:

+#ifdef WDC_NO_IDS
+   wait_flags = AT_POLL;
+#else
+#error NEED WDC_NO_IDS
+#endif

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 344-0444 x24


Re: src/sys/modules/spdmem

2011-08-18 Thread David Young
On Thu, Aug 18, 2011 at 11:11:20AM -0700, Paul Goyette wrote:
 Module Name:src
 Committed By:   christos
 Date:   Thu Aug 18 17:02:49 UTC 2011
 
 Modified Files:
 src/sys/modules/spdmem: Makefile
 
 Log Message:
 document non-literal string format
 
 Rather than sweeping the issue under the rug, wouldn't it be better to
 actually fix the problem?
 
 See attached diff which replaces the variable format with a
 literal #define string ...

I think we should make no changes to appease the compiler in this case.
There is nothing inherently safer about using a literal format string
than a static const format string, the compiler just isn't smart enough
to tell an unsafe non-literal format string from a safe one.

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 344-0444 x24


Re: CVS commit: src/usr.sbin/wlanctl

2011-08-16 Thread David Young
On Tue, Aug 16, 2011 at 04:33:46AM -0400, Christos Zoulas wrote:
 Module Name:  src
 Committed By: christos
 Date: Tue Aug 16 08:33:46 UTC 2011
 
 Modified Files:
   src/usr.sbin/wlanctl: wlanctl.c
 
 Log Message:
 avoid non-literal format strings

What's the purpose of this change, to quiet compiler warnings?  The old
code looked correct to me.  Wasn't it?  I had purposefully not repeated
the printf()s because I thought that it showed the intention of the code
better.

In principle, at least, the compiler should have been able to tell that
the old code was safe.  Can't it?

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 344-0444 x24


Re: CVS commit: src/sys/arch/x86

2011-08-03 Thread David Young
On Mon, Aug 01, 2011 at 11:08:04AM +, Matthias Drochner wrote:
 Module Name:  src
 Committed By: drochner
 Date: Mon Aug  1 11:08:03 UTC 2011
 
 Modified Files:
   src/sys/arch/x86/include: pci_machdep_common.h
   src/sys/arch/x86/pci: pci_intr_machdep.c
 
 Log Message:
 add an experimental implementation of PCI MSIs (Message Signaled
 Interrupts). Successfully tested with hdaudio and wpi wireless
 ethernet.
 notes:

Can you replace the magic numbers with symbols from pcireg.h ? You may
need to add the symbols, of course.

struct pci_attach_args * is const virtually everywhere, shouldn't it be
a const argument to pci_msi_establish(), too?

 -There seem to be buggy chips around which announce MSI support
  but don't correctly implement it. Thus the final word whether MSIs
  can be used should be by the driver.

Might be helpful for other developers to see a heads-up about those
chips.

 -Drivers need to take care of saving/restoring MSI data in the device's
  config space on suspend/resume.

This may be the responsibility of pci_child_suspend()/pci_child_resume()?

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 344-0444 x24


Re: CVS commit: src/sys/dev

2011-07-27 Thread David Young
On Wed, Jul 27, 2011 at 10:04:19AM +0200, Alan Barrett wrote:
 If you would prefer to retain the original white space, then you can
 avoid using white space in + lines, like this:
 
 #define bar
 -0x10
 +PCI_BAR(0)
 
 At least, that works in normal code; I don't know whether it works
 in #define lines.

I *would* prefer to retain the original whitespace.  Thank you so much
for the advice.  I will try this out, later, and let you know if it
works on #define lines or not.

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 344-0444 x24


Re: CVS commit: src/sys/arch

2011-07-17 Thread David Young
On Sun, Jul 17, 2011 at 11:44:53PM +, Christos Zoulas wrote:
 In article 20110717232910.de94317...@cvs.netbsd.org,
 David Young source-changes-d@NetBSD.org wrote:
 -=-=-=-=-=-
 
 Module Name: src
 Committed By:dyoung
 Date:Sun Jul 17 23:29:10 UTC 2011
 
 Modified Files:
  src/sys/arch/sparc/include: types.h
  src/sys/arch/sparc/sparc: machdep.c
  src/sys/arch/sparc64/include: bus_defs.h bus_funcs.h
  src/sys/arch/sparc64/sparc64: machdep.c
 Removed Files:
  src/sys/arch/sparc/include: bus.h
  src/sys/arch/sparc64/include: bus.h
 
 Log Message:
 Switch sparc and sparc64 to new-style sys/bus.h.
 
 
 Can we please use ansi function definitions in newly committed code?

This was tedious enough without converting to ANSI function definitions.
A good job for Coccinelle (spatch)?

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 344-0444 x24


Re: CVS commit: src/sys/arch/alpha/include

2011-07-17 Thread David Young
On Mon, Jul 18, 2011 at 11:26:59AM +1000, matthew green wrote:
 making port-alpha build by simply removing what isn't building is the
 wrong answer, unless you're positive that is the right thing to do.

This was rather poor phrasing, wasn't it?

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 344-0444 x24


Re: CVS commit: src

2011-07-06 Thread David Young
On Wed, Jul 06, 2011 at 06:19:12PM +, David Holland wrote:
 On Wed, Jul 06, 2011 at 06:18:09PM +, David Young wrote:
   Modified Files:
  src/distrib/sets/lists/comp: mi
  src/sys/sys: Makefile
   
   Log Message:
   Install /usr/include/sys/bus.h for oddball ports whose userland somehow
   #includes it.
 
 uh... wouldn't it be better to track down and kill the offenders?

Be my guest.

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 344-0444 x24


Re: CVS commit: src

2011-07-06 Thread David Young
On Wed, Jul 06, 2011 at 06:46:20PM +, David Holland wrote:
 On Wed, Jul 06, 2011 at 01:22:58PM -0500, David Young wrote:
 Modified Files:
src/distrib/sets/lists/comp: mi
src/sys/sys: Makefile
 
 Log Message:
 Install /usr/include/sys/bus.h for oddball ports whose userland somehow
 #includes it.

uh... wouldn't it be better to track down and kill the offenders?
   
   Be my guest.
 
 Okay :-) do you know which oddball ports these are?

I am pretty sure that alpha is one of them.

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 344-0444 x24


Re: CVS commit: src/sys/arch

2011-06-08 Thread David Young
On Wed, Jun 08, 2011 at 05:47:48PM +, Manuel Bouyer wrote:
 Log Message:
 Make GDIUM build again after matt-nb5-mips64 merge. untested as I don't have
 this hardware, but I'll use this as a base for Lemote Fulong support.

Thanks!
 
Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 344-0444 x24


Re: CVS commit: src

2011-05-26 Thread David Young
On Thu, May 26, 2011 at 06:10:42PM +0200, Lars Heidieker wrote:
 On 05/26/11 06:25, Masao Uebayashi wrote:
  Module Name:src
  Committed By:   uebayasi
  Date:   Thu May 26 04:25:28 UTC 2011
  
  Modified Files:
  src/share/man/man5: boot.cfg.5
  src/share/man/man8/man8.i386: boot.8
  src/sys/arch/i386/stand/boot: boot2.c
  src/sys/arch/i386/stand/lib: bootmenu.c exec.c libi386.h
  src/sys/arch/i386/stand/pxeboot: main.c
  src/sys/arch/x86/include: bootinfo.h cpu.h
  src/sys/arch/x86/x86: x86_machdep.c
  src/sys/kern: init_main.c subr_userconf.c
  src/sys/sys: userconf.h
  
  Log Message:
  Support userconf(4) command in boot(8)/boot.cfg(5) on i386/amd64.
  
 From jmmv@, no objections seen in the proposed thread:
  
  http://mail-index.netbsd.org/tech-kern/2009/01/22/msg004081.html
  
  
 
 Hi,
 
 with those changes I can't compile a kernel without USERCONF option set.
 The changes in x86_machdep.c should be with in if defs on that options
 
 Ok to commit the attached patch?

Conditional compilation clutters the code up.  What if instead you add
to kern_stub.c,

#include sys/userconf.h
__weak_alias(userconf_bootinfo, voidop);

?

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 344-0444 x24


Re: CVS commit: src

2011-05-26 Thread David Young
On Thu, May 26, 2011 at 05:35:20PM +0100, David Laight wrote:
 On Thu, May 26, 2011 at 11:32:51AM -0500, David Young wrote:
  On Thu, May 26, 2011 at 06:10:42PM +0200, Lars Heidieker wrote:
   On 05/26/11 06:25, Masao Uebayashi wrote:
 ...
   with those changes I can't compile a kernel without USERCONF option set.
   The changes in x86_machdep.c should be with in if defs on that options
   
   Ok to commit the attached patch?
  
  Conditional compilation clutters the code up.  What if instead you add
  to kern_stub.c,
  
  #include sys/userconf.h
  __weak_alias(userconf_bootinfo, voidop);
 
 I'd either:
 leave userconf_bootinfo() defined but with no body
 or:
 #define userconf_bootinfo()
 (or maybe both!)

If you do both, ISTM that the preprocessor will turn this:

void
userconf_bootinfo(void)
{
#ifdef USERCONF
#endif /* USERCONF */
}

to this:

void
{
#ifdef USERCONF
#endif /* USERCONF */
}

which won't compile.

Leaving userconf_bootinfo() undefined but with no body seems equivalent
to aliasing to voidop() *except* that there's an extra 'ret' instruction
in the kernel somewhere. :-) Also, it precludes linking with an object
containing a real userconf_bootinfo(), later.  There's still the #ifdef
clutter of userconf_bootinfo(), albeit greatly reduced.

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 344-0444 x24


Re: CVS commit: src/sys/dev/scsipi

2011-04-25 Thread David Young
On Mon, Apr 25, 2011 at 02:14:23PM +, Juergen Hannken-Illjes wrote:
 Module Name:  src
 Committed By: hannken
 Date: Mon Apr 25 14:14:22 UTC 2011
 
 Modified Files:
   src/sys/dev/scsipi: scsiconf.c
 
 Log Message:
 Don't kill outstanding requests when detaching a scsibus on shutdown.
 Both the controller and tyhe targets are still running.

I don't think you have fixed the actual bug.  It sounds like the
detachment routine is broken in every case where the controller was not
abruptly detached, but the driver relinquishes control of the controller
in an orderly fashion because of an operator command.

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 344-0444 x24


Re: CVS commit: src/sys/dev/scsipi

2011-04-25 Thread David Young
On Mon, Apr 25, 2011 at 06:26:09PM +0200, Juergen Hannken-Illjes wrote:
 On Mon, Apr 25, 2011 at 10:33:14AM -0500, David Young wrote:
  On Mon, Apr 25, 2011 at 02:14:23PM +, Juergen Hannken-Illjes wrote:
   Module Name:  src
   Committed By: hannken
   Date: Mon Apr 25 14:14:22 UTC 2011
   
   Modified Files:
 src/sys/dev/scsipi: scsiconf.c
   
   Log Message:
   Don't kill outstanding requests when detaching a scsibus on shutdown.
   Both the controller and tyhe targets are still running.
  
  I don't think you have fixed the actual bug.  It sounds like the
  detachment routine is broken in every case where the controller was not
  abruptly detached, but the driver relinquishes control of the controller
  in an orderly fashion because of an operator command.
 
 The actual bug was i386 shutdown, a loop of vfs_unmountall1, config_detach_all
 and vfs_unmount_forceone.  Here config_detach_all() detaches devices from
 the leafs up.
 For me it sometimes happend that the (scsi) root disk had outstanding xfers
 when it came to config_detach_all().  The disk would not detach but the
 bus detach would kill all outstanding operations.  I don't want these xfers to
 abort but the disk continue operations until all xfers are done.
 
 And yes, this detach routine looks bogus at least ...

The bug was in scsibusdetach(), which is not doing things in the proper
order: it has to detach its children and check for error.  If no error,
then it can release the resources that the children were using.  See
attached patch.

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 344-0444 x24
Index: scsiconf.c
===
RCS file: /cvsroot/src/sys/dev/scsipi/scsiconf.c,v
retrieving revision 1.261
diff -u -p -r1.261 scsiconf.c
--- scsiconf.c  25 Apr 2011 14:14:22 -  1.261
+++ scsiconf.c  25 Apr 2011 17:30:31 -
@@ -256,11 +256,20 @@ scsibusdetach(device_t self, int flags)
struct scsipi_xfer *xs;
int error;
 
+   /*
+* Detach all of the periphs.
+*/
+   if ((error = scsipi_target_detach(chan, -1, -1, flags)) != 0)
+   return error;
+
pmf_device_deregister(self);
 
/*
 * Process outstanding commands (which will never complete as the
 * controller is gone).
+*
+* XXX Surely this is redundant?  If we get this far, the
+* XXX peripherals have all been detached.
 */
for (ctarget = 0; ctarget  chan-chan_ntargets; ctarget++) {
if (ctarget == chan-chan_id)
@@ -269,8 +278,6 @@ scsibusdetach(device_t self, int flags)
periph = scsipi_lookup_periph(chan, ctarget, clun);
if (periph == NULL)
continue;
-   if ((flags  DETACH_SHUTDOWN) != 0)
-   return EBUSY;
TAILQ_FOREACH(xs, periph-periph_xferq, device_q) {
callout_stop(xs-xs_callout);
xs-error = XS_DRIVER_STUFFUP;
@@ -280,16 +287,10 @@ scsibusdetach(device_t self, int flags)
}
 
/*
-* Detach all of the periphs.
-*/
-   error = scsipi_target_detach(chan, -1, -1, flags);
-
-   /*
 * Now shut down the channel.
-* XXX only if no errors ?
 */
scsipi_channel_shutdown(chan);
-   return (error);
+   return 0;
 }
 
 /*


Re: CVS commit: src/common/lib/libprop

2011-04-20 Thread David Young
On Wed, Apr 20, 2011 at 08:00:07PM +, Martin Husemann wrote:
 Module Name:  src
 Committed By: martin
 Date: Wed Apr 20 20:00:07 UTC 2011
 
 Modified Files:
   src/common/lib/libprop: prop_object.c
 
 Log Message:
 Update also the non-void pointers to the current test objects.
 Finaly fixes PR lib/43964.

Thanks!

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 344-0444 x24


Re: CVS commit: src/sys/netinet

2011-04-14 Thread David Young
On Fri, Apr 15, 2011 at 09:48:04AM +0900, tsugutomo.en...@jp.sony.com wrote:
 David Young dyo...@netbsd.org writes:
 
  Initialize ipintrq.ifq_maxlen using IFQ_MAXLEN directly instead of using
  the global ipqmaxlen.  Get rid of the global ipqmaxlen.
 
 This prevents us from patching the variable, doesn't it?

You can probably still patch the ipintrq, but is there any reason not to
use sysctl?

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 344-0444 x24


Re: CVS commit: src

2011-04-12 Thread David Young
On Tue, Apr 12, 2011 at 09:25:06PM +0300, Jukka Ruohonen wrote:
 On Tue, Apr 12, 2011 at 09:24:00PM +0300, Jukka Ruohonen wrote:
  On Tue, Apr 12, 2011 at 08:05:13PM +0200, Klaus Klein wrote:
   by being that specific, such documentation creates the obligation to
   keep the redundant definition in sync.
  
 PS.
 
 If you look what I've written in, say, stdlib(3), unistd(3), or stddef(3) --
 all these have been written with minimum maintenance costs in mind.

You're doing the right thing with our documentation.  Keep it up.

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 344-0444 x24


Re: CVS commit: src/sys/arch/xen/xen

2011-03-29 Thread David Young
On Wed, Mar 30, 2011 at 12:17:05AM +, Jean-Yves Migeon wrote:
 Module Name:  src
 Committed By: jym
 Date: Wed Mar 30 00:17:04 UTC 2011
 
 Modified Files:
   src/sys/arch/xen/xen: if_xennet_xenbus.c
 
 Log Message:
 printf(xennet: ...) = aprint_error_ifnet()

It's silly, I know, but aprint_error_ifnet() is only supposed to be used
during autoconfiguration.

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 344-0444 x24


Re: CVS commit: src/sys/net80211

2011-02-25 Thread David Young
On Fri, Feb 25, 2011 at 08:01:50AM +, Christoph Egger wrote:
 Module Name:  src
 Committed By: cegger
 Date: Fri Feb 25 08:01:49 UTC 2011
 
 Modified Files:
   src/sys/net80211: ieee80211_radiotap.h
 
 Log Message:
 sync with FreeBSD rev 1.11. No binary changes.

Careful:  NetBSD follows the standard,
http://www.radiotap.net/defined-fields, and field 18 has not been
standardized.  Please back out this change (and all of the subsequent
changes) and send a patch for review to tech-net.

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 344-0444 x24


Re: CVS commit: src

2011-02-23 Thread David Young
On Wed, Feb 23, 2011 at 01:33:05AM +, YAMAMOTO Takashi wrote:
 hi,
 
  On Feb 22, 2011, at 1:31 PM, YAMAMOTO Takashi wrote:
  
  Module Name:   src
  Committed By:  yamt
  Date:  Tue Feb 22 21:31:16 UTC 2011
  
  Added Files:
 src/common/lib/libc/gen: radixtree.c
 src/sys/sys: radixtree.h
  
  Log Message:
  an implementation of radix tree.  the idea from linux.
  
  How is that different from ptree?
 
 while i'm not familiar with ptree...
 
 - there is no node structure which needs to be embedded into user 
 structures.
 - tagging functionality.

Aren't both ptree and radixtree missing documentation?

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 344-0444 x24


Re: CVS commit: src

2011-02-23 Thread David Young
On Thu, Feb 24, 2011 at 12:12:50AM +, YAMAMOTO Takashi wrote:
 I wrote:
  Aren't both ptree and radixtree missing documentation?
 
 right.  both of them are work-in-progress piece of code.  well, at least
 radixtree is.
 are you suggesting something?

Yes: commit new libraries with documentation.

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 344-0444 x24


Re: CVS commit: src/sys/arch

2011-02-19 Thread David Young
On Sat, Feb 19, 2011 at 01:52:29PM +, Jared D. McNeill wrote:
 Log Message:
 modularize VIA PadLock support
  - retire options VIA_PADLOCK, replace with 'padlock0 at cpu0'
  - driver supports attach  detach
  - support building as a module

Nice!

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 344-0444 x24


Re: CVS commit: src

2011-01-31 Thread David Young
On Mon, Jan 31, 2011 at 03:24:25PM +1100, matthew green wrote:
 
   disklabel.h should export nothing to userland and values userland
   needs should be obtained via sysctl.
   
   I've been asking this question of various developers for a while.
   
   how do i create a disklabel on a file system image as a normal
   user a non-netbsd host with this method?
   
   But that would be a hosted tool and that's a different case than 
   a native tool.  
   
   Where would the hosted tool get that information from?  If it's from a
   MD header file we're back to where we started...
  
  Why?  hosted != native.  I don't expect a tool to be built on linux to
  know where to get a disklabel from.
  
  I do expect the native on NetBSD to know how to get the disklabel location
  for the current machine it's running on from sysctl and not a header file.
 
 how does the cross build on linux create an image with a disklabel?

You use environment variables to supply the parameters that native
disklabel gets from sysctl:

env DISKLABELOFFSET=0 DISKLABELSECTOR=1 $TOOL_DISKLABEL -v -
F -f $DISKTAB -w $IMAGE $DISKTYPE || exit 1

Doesn't look like that's documented, oops.

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 344-0444 x24


Re: CVS commit: src/sys/dev/pci

2011-01-30 Thread David Young
On Sun, Jan 30, 2011 at 07:01:07PM -0500, Christos Zoulas wrote:
 Module Name:  src
 Committed By: christos
 Date: Mon Jan 31 00:01:07 UTC 2011
 
 Modified Files:
   src/sys/dev/pci: if_iwi.c
 
 Log Message:
 clear register 0x41 as FreeBSD and OpenBSD do. Update copyright to the latest.

Over the years, I've seen the cargo cult clear this particular register
repeatedly on several makes and models of wireless chip.  Nobody has
been able to explain it by reference to any documentation or a vendor
recommendation.  Are you sure that this change has any effect or
justification?

See this discussion for the story on this register,
http://www.mail-archive.com/bcm43xx-dev@lists.berlios.de/msg09278.html.

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 344-0444 x24


Re: CVS commit: src/etc/mtree

2011-01-10 Thread David Young
On Mon, Jan 10, 2011 at 05:17:37PM +, Nicolas Joly wrote:
 Module Name:  src
 Committed By: njoly
 Date: Mon Jan 10 17:17:36 UTC 2011
 
 Modified Files:
   src/etc/mtree: NetBSD.dist.tests
 
 Log Message:
 Add lib/libc/sys test dirs.

Thanks!

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 278-3933


Re: CVS commit: src/etc/powerd/scripts

2010-12-31 Thread David Young
On Fri, Dec 31, 2010 at 11:01:08AM +0100, Jean-Yves Migeon wrote:
 On 31.12.2010 10:36, Jukka Ruohonen wrote:
  Module Name:src
  Committed By:   jruoho
  Date:   Fri Dec 31 09:36:15 UTC 2010
  
  Modified Files:
  src/etc/powerd/scripts: sleep_button
  
  Log Message:
  Use hw.acpi.sleep.state instead of machdep.sleep_state.
 
 And so it begins :)
 
 I am using machdep.sleep_state as node to put a domU into suspend mode.
 Up to now, putting sleep_state under machdep allowed powerd(8)
 sleep_button to be used regardless of the environment (eg. ACPI sleep or
 Xen domU sleep).
 
 While retiring sleep_state from machdep goes in the right direction
 IMHO, will it be replaced by a MI interface to put a system into sleep,
 as it is not a feature specific to ACPI?

IMO, we should put the system to sleep by sending a
power-saving/wakeup-latency goal and a set of waking events (e.g.,
keystroke, mouse movement, LAN activity) to the root device_t using
drvctl.  To put any smaller set of devices to sleep, send the goal 
wake events to some subtree.

FWIW, the sleep states that ACPI names are not sufficient even to
describe all of the potential sleep states of ACPI hardware.  I have a
laptop that's perfectly capable of an S3-like sleep, but the ACPI BIOS
doesn't support S3, and the HDD is not formatted properly for the S4
sleep.

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 278-3933


Re: CVS commit: src/sys/dev/pci

2010-12-12 Thread David Young
On Sat, Dec 11, 2010 at 11:18:12PM -0800, Matt Thomas wrote:
 On Dec 11, 2010, at 11:02 AM, David Young wrote:
  Why does this need to be #ifdef'd ?
 
 It doesn't but it never ever match on anything other
 than a PowerPC so why have the code when it can never
 be executed?

IMO, it's not worth a few bytes' savings in instructions to clutter code
with conditional compilation.

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 278-3933


Re: CVS commit: src/sys/dev/pci

2010-12-11 Thread David Young
On Sat, Dec 11, 2010 at 06:25:02PM +, Matt Thomas wrote:
 Module Name:  src
 Committed By: matt
 Date: Sat Dec 11 18:25:02 UTC 2010
 
 Modified Files:
   src/sys/dev/pci: ppb.c
 
 Log Message:
 On powerpc, recognize PCI Express RC root bridges.

Why does this need to be #ifdef'd ?

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 278-3933


Re: CVS commit: src/sys/kern

2010-11-10 Thread David Young
On Tue, Nov 09, 2010 at 12:36:16PM +0900, Masao Uebayashi wrote:
 The root cause of such a problem is, we don't do I/O scheduling at all.
 
 I think that pool(9) (and pool_cache(9)) is a great tool to manage
 limited resources.  The way to go would be to extend it to manage
 bandwidth in I/O subsystems.  (We already use pool_cache(9) for
 KVA.)
 
 Resources are shared, and have dependencies.  I/O resources would
 look like some hierachical structure chained with pool backend
 callbacks.  Probably combined with device tree too.

FWIW, I'm working on managing PCI I/O resources in this way, but I'm
probably going to use vmem(9), not pool(9).

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 278-3933


Re: CVS commit: src/sys/dev/usb

2010-11-03 Thread David Young
On Wed, Nov 03, 2010 at 04:03:03PM -0400, Christos Zoulas wrote:
 Module Name:  src
 Committed By: christos
 Date: Wed Nov  3 20:03:02 UTC 2010
 
 Modified Files:
   src/sys/dev/usb: if_otus.c if_otusreg.h usbdevs
 Added Files:
   src/sys/dev/usb: if_otusvar.h
 
 Log Message:
 From Anon Ymous:
 
 Port of the otus driver from OpenBSD.  This driver supports USB 2.0
 wireless network devices based on Atheros Communications AR9001U
 chipset.  It claims to support several AR9001U based adapters, but has
 only been tested with a NetGear WNDA3100 adapter (0x0846/0x9010).
 
 XXX: The EDCA support is currently missing from our network stack
 (hopefully coming soon), but the driver hooks for it are there.

This really should have been reviewed before it was committed. :-/

Please, no new uses of USB_MATCH() and friends in the kernel.

There are lots of magic numbers in this driver.  There is not less
magical code under ISC license for this device somewhere?

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 278-3933


Re: CVS commit: src/sys/dev/usb

2010-11-03 Thread David Young
On Wed, Nov 03, 2010 at 05:07:25PM -0400, Christos Zoulas wrote:
 Module Name:  src
 Committed By: christos
 Date: Wed Nov  3 21:07:25 UTC 2010
 
 Modified Files:
   src/sys/dev/usb: if_otus.c
 
 Log Message:
 remove USB_ macros per dyoung.

Thanks. :-)

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 278-3933


Re: CVS commit: src/sys/arch/i386/i386

2010-10-31 Thread David Young
On Sun, Oct 31, 2010 at 04:51:19AM +, YAMAMOTO Takashi wrote:
 Module Name:  src
 Committed By: yamt
 Date: Sun Oct 31 04:51:19 UTC 2010
 
 Modified Files:
   src/sys/arch/i386/i386: vector.S
 
 Log Message:
 keep interrupts disabled in NMI handler.
 the patch provided by IRINO yoshiaki in PR/43007.

Good catch!

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 278-3933


Re: CVS commit: src/sys

2010-09-11 Thread David Young
On Mon, Sep 06, 2010 at 03:54:27PM +, Jared D. McNeill wrote:
 Log Message:
 Add support for blacklisting ACPI BIOS implementations by year. By default,
 don't use ACPI on BIOS which advertise release years = 2000. This
 can be changed by setting option ACPI_BLACKLIST_YEAR=0 or by setting
 acpi_force_load=1.

How do I find out my ACPI BIOS release year?

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 278-3933


Re: CVS commit: src/share/man/man3

2010-08-27 Thread David Young
On Fri, Aug 27, 2010 at 09:13:38AM +, Jukka Ruohonen wrote:
 Module Name:  src
 Committed By: jruoho
 Date: Fri Aug 27 09:13:38 UTC 2010
 
 Modified Files:
   src/share/man/man3: bits.3
 
 Log Message:
 Replace the example with something more generic and perceptual.

That's a big improvement, thanks!

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 278-3933


Re: CVS commit: src/sys/dev/pci

2010-06-25 Thread David Young
On Fri, Jun 25, 2010 at 01:10:13PM +0900, masan...@iij.ad.jp wrote:
 
 From: SAITOH Masanobu msai...@netbsd.org
 Subject: CVS commit: src/sys/dev/pci
 Date: Fri, 25 Jun 2010 03:47:58 +
 
  Module Name:src
  Committed By:   msaitoh
  Date:   Fri Jun 25 03:47:57 UTC 2010
  
  Modified Files:
  src/sys/dev/pci: if_wmreg.h
  
  Log Message:
  The GIO master enable bit in STATUS register is not bit 16 but bit 18.
  It will fix a problem on 82580 SGMII system.
 
 This is wrong. I've cvs admined with the following message:
 
   The GIO master enable bit in STATUS register is not bit 16 but bit 18.
   It will fix a problem in the reset sequence on PCI-e chips.

Is it 18 or 19?

-#defineSTATUS_GIO_M_ENA (1U  16) /* PCIX master enable */
+#defineSTATUS_GIO_M_ENA (1U  19) /* GIO master enable */

Use __BIT(3) ?

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 278-3933


Re: CVS commit: src

2010-06-04 Thread David Young
On Tue, Jun 01, 2010 at 11:29:10PM +, Joerg Sonnenberger wrote:
 Module Name:  src
 Committed By: joerg
 Date: Tue Jun  1 23:29:10 UTC 2010
 
 Modified Files:
   src/distrib/sets/lists/man: mi
   src/external/bsd/mdocml/man: Makefile
   src/share/mk: bsd.man.mk bsd.own.mk
 
 Log Message:
 Install mdocml's default CSS as /usr/share/man/style.css.  Switch HTML
 man pages to use mandoc unconditional as it gives reasonable output for
 all man pages, not only a subset of mdoc(7).  Use the newly installed
 style.css for formatting and produce hyperlinks for .Xr.

Joerg,

I'm not sure, but this may have broken compilation of HTML manual pages
for 3rd-party programs that use BSD makefiles.  It looks like some
important TOOL_ variable is not defined:

elmendorf:~/regxml/doc make obj cleandir dependall
rm -f xmltools.cat7
rm -f xmltools.html7
#format  doc/xmltools.cat7
nroff -mandoc /home/dyoung/regxml/doc/xmltools.7xmltools.cat7.tmp  mv 
xmltools.cat7.tmp xmltools.cat7
#format  doc/xmltools.html7
/home/dyoung/regxml/doc/xmltools.7  xmltools.html7.tmp   mv 
xmltools.html7.tmp xmltools.html7
sh: /home/dyoung/regxml/doc/xmltools.7: permission denied
*** Error code 126

Stop.
make: stopped in /home/dyoung/regxml/doc
*** Error code 1

Stop.
make: stopped in /home/dyoung/regxml/doc

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 278-3933


Re: CVS commit: src/sys

2010-05-24 Thread David Young
On Mon, May 24, 2010 at 08:29:49PM +, Paul Goyette wrote:
 Module Name:  src
 Committed By: pgoyette
 Date: Mon May 24 20:29:49 UTC 2010
 
 Modified Files:
   src/sys/arch/i386/pci: gcscehci.c
   src/sys/dev/cardbus: ehci_cardbus.c ohci_cardbus.c uhci_cardbus.c
   src/sys/dev/pci: azalia.c cs4280.c ehci_pci.c ohci_pci.c uhci_pci.c
 
 Log Message:
 Update all callers of the pci_find{vendor,product} routines to now call
 these routines through their global pointers.

It was not necessary to change all of the pci_find{vendor,product}
calls, was it?  You could have tucked the call through
pci_find{vendor,product}_vec into pci_find{vendor,product}() like this:

const char *
pci_findvendor(pcireg_t id)
{
return (*pci_findvendor_vec)(id);
}

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 278-3933


Re: CVS commit: src/sys

2010-04-29 Thread David Young
On Thu, Apr 29, 2010 at 08:52:16AM +, Andrew Doran wrote:
 Also annoying that so much of this code is MD.
 
 Please run large x86 changes by me before commit.  I would have told you
 what Matt just did :-).  FYI you can now remove the #error from both busfunc.S
 and special _ALIGN_TEXT definitions since the sizes of the routines will be
 quite different now.

Something like this?

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 278-3933
Index: sys/arch/i386/i386/busfunc.S
===
RCS file: /cvsroot/src/sys/arch/i386/i386/busfunc.S,v
retrieving revision 1.6
diff -u -p -r1.6 busfunc.S
--- sys/arch/i386/i386/busfunc.S28 Apr 2010 19:17:03 -  1.6
+++ sys/arch/i386/i386/busfunc.S29 Apr 2010 17:30:57 -
@@ -34,10 +34,6 @@ __KERNEL_RCSID(0, $NetBSD: busfunc.S,v 
 
 #include assym.h
 
-/* XXX */
-#undef _ALIGN_TEXT
-#define_ALIGN_TEXT .align 16
-
 /*
  * uint8_t bus_space_read_1(bus_space_tag_t tag, bus_space_handle_t bsh,
  *bus_size_t offset);
Index: sys/arch/amd64/amd64/busfunc.S
===
RCS file: /cvsroot/src/sys/arch/amd64/amd64/busfunc.S,v
retrieving revision 1.8
diff -u -p -r1.8 busfunc.S
--- sys/arch/amd64/amd64/busfunc.S  28 Apr 2010 19:17:03 -  1.8
+++ sys/arch/amd64/amd64/busfunc.S  29 Apr 2010 17:30:57 -
@@ -33,14 +33,6 @@
 
 #include assym.h
 
-/* XXX */
-#undef _ALIGN_TEXT
-#define_ALIGN_TEXT .align 16
-
-#if X86_BUS_SPACE_IO != 0
-#error depends on X86_BUS_SPACE_IO == 0
-#endif
-
 .Ldopanic:
movq$.Lpstr, %rdi
call_C_LABEL(panic)


Re: CVS commit: src/sys/netinet

2010-04-28 Thread David Young
On Wed, Apr 28, 2010 at 08:02:53PM +0300, Mihai Chelaru wrote:
 Masaru OKI wrote:
 
  Module Name:  src
  Committed By: oki
  Date: Fri Mar 12 13:33:19 UTC 2010
  
  Modified Files:
  src/sys/netinet: in.c
  
  Log Message:
  Fixed a number of race conditions in the case of receiving ipv4 packet.
  found by iij seil team.
  
  
  To generate a diff of this commit:
  cvs rdiff -u -r1.136 -r1.137 src/sys/netinet/in.c
  
  Please note that diffs are not public domain; they are subject to the
  copyright notices on the relevant files.
 
 Hi,
 
 Some questions and remarks:
 
 * Can you detail a little bit what are the exactly race conditions this
 patch is covering ?

I would like to see that, too.  I think that in the mean time, the patch
should be backed out.

Some synchronization around ifaddrs access may be necessary.

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 278-3933


Re: CVS commit: src/sys/netinet

2010-04-28 Thread David Young
On Wed, Apr 28, 2010 at 08:02:53PM +0300, Mihai Chelaru wrote:
 Masaru OKI wrote:
 
  Module Name:  src
  Committed By: oki
  Date: Fri Mar 12 13:33:19 UTC 2010
  
  Modified Files:
  src/sys/netinet: in.c
  
  Log Message:
  Fixed a number of race conditions in the case of receiving ipv4 packet.
  found by iij seil team.
  
  
  To generate a diff of this commit:
  cvs rdiff -u -r1.136 -r1.137 src/sys/netinet/in.c
  
  Please note that diffs are not public domain; they are subject to the
  copyright notices on the relevant files.
 
 Hi,
 
 Some questions and remarks:
 
 * Can you detail a little bit what are the exactly race conditions this
 patch is covering ?

I would like to see that, too.  I think that in the mean time, the patch
should be backed out.

Some synchronization around ifaddrs access may be necessary.

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 278-3933


Re: CVS commit: src/sys/dev/ic

2010-03-31 Thread David Young
On Wed, Mar 31, 2010 at 05:09:41AM +, Michael Lorenz wrote:
 Module Name:  src
 Committed By: macallan
 Date: Wed Mar 31 05:09:41 UTC 2010
 
 Modified Files:
   src/sys/dev/ic: pcf8584.c
 
 Log Message:
 Do as OpenSolaris does and read the status register after each write.
 Now this driver works on my Blade 2500.

 void
 pcfiic_write(struct pcfiic_softc *sc, bus_size_t r, u_int8_t v)
 {
+   volatile uint8_t junk;
bus_space_write_1(sc-sc_iot, sc-sc_ioh, sc-sc_regmap[r], v);
+   junk = bus_space_read_1(sc-sc_iot, sc-sc_ioh, PCF_S1);
bus_space_barrier(sc-sc_iot, sc-sc_ioh, sc-sc_regmap[r], 1,
BUS_SPACE_BARRIER_WRITE);
 }

I wonder, does the device need the read, or is the bus_space_barrier()
insufficient to flush the write to the device?

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 278-3933


Re: CVS commit: src/sys/dev/ic

2010-03-31 Thread David Young
On Wed, Mar 31, 2010 at 01:19:10PM -0700, Jason Thorpe wrote:
 
 On Mar 31, 2010, at 7:45 AM, David Young wrote:
 
  On Wed, Mar 31, 2010 at 05:09:41AM +, Michael Lorenz wrote:
  Module Name:   src
  Committed By:  macallan
  Date:  Wed Mar 31 05:09:41 UTC 2010
  
  Modified Files:
 src/sys/dev/ic: pcf8584.c
  
  Log Message:
  Do as OpenSolaris does and read the status register after each write.
  Now this driver works on my Blade 2500.
  
  void
  pcfiic_write(struct pcfiic_softc *sc, bus_size_t r, u_int8_t v)
  {
  +   volatile uint8_t junk;
 bus_space_write_1(sc-sc_iot, sc-sc_ioh, sc-sc_regmap[r], v);
  +   junk = bus_space_read_1(sc-sc_iot, sc-sc_ioh, PCF_S1);
 bus_space_barrier(sc-sc_iot, sc-sc_ioh, sc-sc_regmap[r], 1,
 BUS_SPACE_BARRIER_WRITE);
  }
  
  I wonder, does the device need the read, or is the bus_space_barrier()
  insufficient to flush the write to the device?
 
 bus_space_barrier() doesn't flush ... barriers only enforce
 the ordering of operations (and, of course, with respect to
 non-overlapping addresses ... obviously reads after writes of the
 same address in code will be enforced on the bus without an explicit
 barrier).

Right.  Putting the question another way, Is it important that reading
the register we wrote lands the write as a side-effect?  Do we
expect that on sparc64, the bus barrier also lands the write as a
side-effect?

It sounds like the answer to both questions may be no, and the
write-to-write delay is key.

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 278-3933


Re: acpiec bus tag (was Re: CVS commit: src/sys/dev)

2010-03-29 Thread David Young
On Fri, Mar 26, 2010 at 07:57:56PM +0200, Jukka Ruohonen wrote:
 On Fri, Mar 26, 2010 at 12:50:38PM -0500, David Young wrote:
  It used to be definitely incorrect.  So we're making progress.  Do you
  have any idea how to make it definitely correct?
 
 Sorry: I misread the patch originally. It should not affect the
 functionality. The NULL pointer dereference is a real bug though.

I just fixed the NULL dereference:

cvs rdiff -u -r1.162 -r1.163 src/sys/dev/acpi/acpi.c
cvs rdiff -u -r1.63 -r1.64 src/sys/dev/acpi/acpi_ec.c   

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 278-3933


acpiec bus tag (was Re: CVS commit: src/sys/dev)

2010-03-26 Thread David Young
On Fri, Mar 26, 2010 at 07:26:01AM +0200, Jukka Ruohonen wrote:
 On Wed, Mar 24, 2010 at 01:13:30AM +, David Young wrote:
  Module Name:src
  Committed By:   dyoung
  Date:   Wed Mar 24 01:13:30 UTC 2010
  
  Modified Files:
  src/sys/dev/acpi: acpi_ec.c
  src/sys/dev/isa: pas.c
  
  Log Message:
  Do not use unitialized bus_space_tag_t's.  Use the tag(s) from the
  attachment arguments.
  
  
  To generate a diff of this commit:
  cvs rdiff -u -r1.62 -r1.63 src/sys/dev/acpi/acpi_ec.c
  cvs rdiff -u -r1.67 -r1.68 src/sys/dev/isa/pas.c
 
 ... and: this also fundamentally alters the behavior of acpiec(4) in a way
 that is likely to be incorrect.

It used to be definitely incorrect.  So we're making progress.  Do you
have any idea how to make it definitely correct?

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 278-3933


acpiecdt bus tag (was Re: CVS commit: src/sys/dev)

2010-03-26 Thread David Young
On Fri, Mar 26, 2010 at 07:00:15AM +0200, Jukka Ruohonen wrote:
 On Wed, Mar 24, 2010 at 01:13:30AM +, David Young wrote:
  Module Name:src
  Committed By:   dyoung
  Date:   Wed Mar 24 01:13:30 UTC 2010
  
  Modified Files:
  src/sys/dev/acpi: acpi_ec.c
  src/sys/dev/isa: pas.c
  
  Log Message:
  Do not use unitialized bus_space_tag_t's.  Use the tag(s) from the
  attachment arguments.
  
  
  To generate a diff of this commit:
  cvs rdiff -u -r1.62 -r1.63 src/sys/dev/acpi/acpi_ec.c
  cvs rdiff -u -r1.67 -r1.68 src/sys/dev/isa/pas.c
 
 This makes systems with acpiecdt(4) panic early in the boot:
 
  static bool acpiec_suspend(device_t, const pmf_qual_t *);
  static bool acpiec_resume(device_t, const pmf_qual_t *);
 @@ -225,6 +226,7 @@
  static void
  acpiecdt_attach(device_t parent, device_t self, void *aux)
  {   
 +   struct acpi_attach_args *aa = aux;
 ACPI_HANDLE ec_handle;
 bus_addr_t cmd_reg, data_reg;
 uint8_t gpebit;
 @@ -235,8 +237,8 @@
 aprint_naive(\n);
 aprint_normal(: ACPI Embedded Controller via ECDT\n);
 
 -   acpiec_common_attach(parent, self, ec_handle, cmd_reg, data_reg,
 -   NULL, gpebit);
 +   acpiec_common_attach(parent, self, ec_handle, aa-aa_iot, cmd_reg,
 +   aa-aa_iot, data_reg, NULL, gpebit);
  }
 
 There is a NULL pointer dereference above, given that the ECDT, unlike rest
 of the APCI device nodes, is attached as:
 
 /* Early EC handler initialization if ECDT table is available. */
 config_found_ia(self, acpiecdtbus, NULL, NULL);

We should not attach it that way, then! :-)

It is important that acpiec and acpiecdt use bus_space_tag_t's that come
something, such as their parent, instead of tags that are conjured from
the zeroes in their softc.

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 278-3933


Re: CVS commit: src/sys/dev/isa

2010-03-23 Thread David Young
On Tue, Mar 23, 2010 at 11:39:54AM +0100, Matthias Drochner wrote:
 dyo...@pobox.com said:
  Can the two tags that pcdisplay_is_console() compared ever come from
  different spaces?
 
 Yes, if there are independant ISA buses they are distinguished
 by their tags.

Good to know.  I did not know that this ever occurred.

I would not expect for comparing tags with == to work reliably, now,
based on my reading of bus_space(9).  I do not expect for it to work for
very much longer.

Let us add a bus_space_is_equal(bus_space_tag_t t1, bus_space_tag_t
t2) for implementation in MD code.  kern_stub.c can provide a default
implementation that will work for now:

return memcpy(t1, t2, sizeof(t1)) == 0;

That will work even if bus_space_tag_t is a struct.

(BTW, it was only by making bus_space_tag_t a struct that I got the
compiler to stop on some cases of bus_space_tag_t misuse.)

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 278-3933


Re: CVS commit: src/sys

2010-03-17 Thread David Young
On Mon, Mar 15, 2010 at 04:43:04AM +, Mindaugas Rasiukevicius wrote:
 Hi,
 
  David Young dyo...@pobox.com wrote:
   On Sat, Nov 21, 2009 at 03:41:07PM +1100, matthew green wrote:
   
   SPLDEBUG is single-purpose.  It also has some bugs, which I am happy
to describe.  But let's keep it until we come up with something better.


now you've told me all of:  it's single purpose, MD, and doesn't work.

please revert SPLDEBUG.  it does not belong in sys/kern.
   
   Have a little patience.  I am incorporating all of the suggestions that
   I have heard so far into a patch.
   
  
  Is there any progress on this?  IIIRC, general agreement was that
  subr_spldebug.c does not belong to sys/kern.
 
 Can you respond?

I plan to commit my final patches in this area for posterity, and then
to remove the feature just as soon as DTrace is capable of providing
it.  I don't think that there are FBT probes on all of the relevant
assembly-language routines, yet.

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 278-3933


Re: CVS commit: src/sys

2010-03-14 Thread David Young
On Fri, Mar 05, 2010 at 06:35:02PM +, Antti Kantee wrote:
 Module Name:  src
 Committed By: pooka
 Date: Fri Mar  5 18:35:02 UTC 2010
 
 Modified Files:
   src/sys/kern: kern_module.c sys_module.c
   src/sys/sys: module.h
 
 Log Message:
 Move builtin modules to a list in init and load them from there
 instead of using linksets directly.  This has two implications:
 
 1) It is now possible to unload a builtin module provided it is
not busy.  This is useful e.g. to disable a kernel feature as
an immediate workaround to a security problem.  To re-initialize
the module, modload -f name is required.

Antti,

On my console and in /var/log/messages, I find

  WARNING: module error: use -f to reinstate builtin module compat

For example, whenever I type my login:

  login: dyoung
  WARNING: module error: use -f to reinstate builtin module compat
  Password:

I noticed that modstat tells me that REFS == -1 on some modules:

NAME CLASS  SOURCE REFS  SIZE REQUIRES
compat   misc   builtin-1--

Does it have something to do with your change?

Dave

-- 
David Young OJC Technologies
dyo...@ojctech.com  Urbana, IL * (217) 278-3933


CVS commit: src/sys/dev/cardbus

2010-03-10 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Mar 10 21:00:36 UTC 2010

Modified Files:
src/sys/dev/cardbus: if_ex_cardbus.c

Log Message:
This is *always* compiled with #define rbus 1, so get rid of the
conditional compilation.

Simplify interrupt (dis)establishment by two source transformations:

-   cardbus_intr_disestablish(cc, cf, ih);
+   Cardbus_intr_disestablish(ct, ih);

-   ih = cardbus_intr_establish(cc, cf, ...);
+   ih = Cardbus_intr_establish(ct, ...);

Tested by me.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/dev/cardbus/if_ex_cardbus.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/cardbus

2010-03-10 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Mar 10 21:00:36 UTC 2010

Modified Files:
src/sys/dev/cardbus: if_ex_cardbus.c

Log Message:
This is *always* compiled with #define rbus 1, so get rid of the
conditional compilation.

Simplify interrupt (dis)establishment by two source transformations:

-   cardbus_intr_disestablish(cc, cf, ih);
+   Cardbus_intr_disestablish(ct, ih);

-   ih = cardbus_intr_establish(cc, cf, ...);
+   ih = Cardbus_intr_establish(ct, ...);

Tested by me.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/dev/cardbus/if_ex_cardbus.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/cardbus/if_ex_cardbus.c
diff -u src/sys/dev/cardbus/if_ex_cardbus.c:1.50 src/sys/dev/cardbus/if_ex_cardbus.c:1.51
--- src/sys/dev/cardbus/if_ex_cardbus.c:1.50	Fri Feb 26 00:57:02 2010
+++ src/sys/dev/cardbus/if_ex_cardbus.c	Wed Mar 10 21:00:36 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ex_cardbus.c,v 1.50 2010/02/26 00:57:02 dyoung Exp $	*/
+/*	$NetBSD: if_ex_cardbus.c,v 1.51 2010/03/10 21:00:36 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1998 and 1999
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_ex_cardbus.c,v 1.50 2010/02/26 00:57:02 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_ex_cardbus.c,v 1.51 2010/03/10 21:00:36 dyoung Exp $);
 
 /* #define EX_DEBUG 4 */	/* define to report information for debugging */
 
@@ -215,10 +215,6 @@
 	struct ex_softc *sc = csc-sc_softc;
 	struct cardbus_attach_args *ca = aux;
 	cardbus_devfunc_t ct = ca-ca_ct;
-#if rbus
-#else
-	cardbus_chipset_tag_t cc = ct-ct_cc;
-#endif
 	const struct ex_cardbus_product *ecp;
 	bus_addr_t adr, adr1;
 
@@ -244,10 +240,6 @@
 
 	if (Cardbus_mapreg_map(ct, PCI_BAR0, PCI_MAPREG_TYPE_IO, 0,
 		sc-sc_iot, sc-sc_ioh, adr, csc-sc_mapsize) == 0) {
-#if rbus
-#else
-		(*ct-ct_cf-cardbus_io_open)(cc, 0, adr, adr + csc-sc_mapsize);
-#endif
 		csc-sc_bar_reg = PCI_BAR0;
 		csc-sc_bar_val = adr | PCI_MAPREG_TYPE_IO;
 
@@ -326,7 +318,7 @@
 		/*
 		 * Unhook the interrupt handler.
 		 */
-		cardbus_intr_disestablish(ct-ct_cc, ct-ct_cf, sc-sc_ih);
+		Cardbus_intr_disestablish(ct, sc-sc_ih);
 
 		if (csc-sc_cardtype == EX_CB_CYCLONE) {
 			Cardbus_mapreg_unmap(ct,
@@ -344,13 +336,11 @@
 ex_cardbus_enable(struct ex_softc *sc)
 {
 	struct ex_cardbus_softc *csc = (struct ex_cardbus_softc *)sc;
-	cardbus_function_tag_t cf = csc-sc_ct-ct_cf;
-	cardbus_chipset_tag_t cc = csc-sc_ct-ct_cc;
 
 	Cardbus_function_enable(csc-sc_ct);
 	ex_cardbus_setup(csc);
 
-	sc-sc_ih = cardbus_intr_establish(cc, cf, csc-sc_intrline,
+	sc-sc_ih = Cardbus_intr_establish(csc-sc_ct, csc-sc_intrline,
 	IPL_NET, ex_intr, sc);
 	if (NULL == sc-sc_ih) {
 		aprint_error_dev(sc-sc_dev, couldn't establish interrupt\n);



CVS commit: src/sys/dev/cardbus

2010-03-09 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Mar 10 00:21:10 UTC 2010

Modified Files:
src/sys/dev/cardbus: ehci_cardbus.c if_tlp_cardbus.c ohci_cardbus.c

Log Message:
This is *always* compiled with #define rbus 1, so get rid of the
conditional compilation.

Simplify interrupt (dis)establishment by two source transformations:

-   cardbus_intr_disestablish(cc, cf, ih);
+   Cardbus_intr_disestablish(ct, ih);

-   ih = cardbus_intr_establish(cc, cf, ...);
+   ih = Cardbus_intr_establish(ct, ...);

Tested by Klaus Heinz.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/cardbus/ehci_cardbus.c
cvs rdiff -u -r1.66 -r1.67 src/sys/dev/cardbus/if_tlp_cardbus.c
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/cardbus/ohci_cardbus.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/cardbus

2010-03-09 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Mar 10 00:21:10 UTC 2010

Modified Files:
src/sys/dev/cardbus: ehci_cardbus.c if_tlp_cardbus.c ohci_cardbus.c

Log Message:
This is *always* compiled with #define rbus 1, so get rid of the
conditional compilation.

Simplify interrupt (dis)establishment by two source transformations:

-   cardbus_intr_disestablish(cc, cf, ih);
+   Cardbus_intr_disestablish(ct, ih);

-   ih = cardbus_intr_establish(cc, cf, ...);
+   ih = Cardbus_intr_establish(ct, ...);

Tested by Klaus Heinz.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/cardbus/ehci_cardbus.c
cvs rdiff -u -r1.66 -r1.67 src/sys/dev/cardbus/if_tlp_cardbus.c
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/cardbus/ohci_cardbus.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/cardbus/ehci_cardbus.c
diff -u src/sys/dev/cardbus/ehci_cardbus.c:1.27 src/sys/dev/cardbus/ehci_cardbus.c:1.28
--- src/sys/dev/cardbus/ehci_cardbus.c:1.27	Fri Feb 26 00:57:01 2010
+++ src/sys/dev/cardbus/ehci_cardbus.c	Wed Mar 10 00:21:10 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehci_cardbus.c,v 1.27 2010/02/26 00:57:01 dyoung Exp $	*/
+/*	$NetBSD: ehci_cardbus.c,v 1.28 2010/03/10 00:21:10 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ehci_cardbus.c,v 1.27 2010/02/26 00:57:01 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: ehci_cardbus.c,v 1.28 2010/03/10 00:21:10 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -153,11 +153,6 @@
 	sc-sc_ct = ct;
 	sc-sc.sc_bus.dmatag = ca-ca_dmat;
 
-#if rbus
-#else
-XXX	(ct-ct_cf-cardbus_mem_open)(cc, 0, iob, iob + 0x40);
-#endif
-
 	/* Enable the device. */
 	csr = Cardbus_conf_read(ct, ca-ca_tag, PCI_COMMAND_STATUS_REG);
 	Cardbus_conf_write(ct, ca-ca_tag, PCI_COMMAND_STATUS_REG,
@@ -169,7 +164,7 @@
 	DPRINTF((%s: offs=%d\n, devname, sc-sc.sc_offs));
 	EOWRITE2(sc-sc, EHCI_USBINTR, 0);
 
-	sc-sc_ih = cardbus_intr_establish(cc, cf, ca-ca_intrline,
+	sc-sc_ih = Cardbus_intr_establish(ct, ca-ca_intrline,
 	   IPL_USB, ehci_intr, sc);
 	if (sc-sc_ih == NULL) {
 		printf(%s: couldn't establish interrupt\n, devname);
@@ -206,7 +201,7 @@
 		printf(%s: init failed, error=%d\n, devname, r);
 
 		/* Avoid spurious interrupts. */
-		cardbus_intr_disestablish(sc-sc_cc, sc-sc_cf, sc-sc_ih);
+		Cardbus_intr_disestablish(ct, sc-sc_ih);
 		sc-sc_ih = NULL;
 
 		return;
@@ -231,7 +226,7 @@
 	if (rv)
 		return (rv);
 	if (sc-sc_ih != NULL) {
-		cardbus_intr_disestablish(sc-sc_cc, sc-sc_cf, sc-sc_ih);
+		Cardbus_intr_disestablish(ct, sc-sc_ih);
 		sc-sc_ih = NULL;
 	}
 	if (sc-sc.sc_size) {

Index: src/sys/dev/cardbus/if_tlp_cardbus.c
diff -u src/sys/dev/cardbus/if_tlp_cardbus.c:1.66 src/sys/dev/cardbus/if_tlp_cardbus.c:1.67
--- src/sys/dev/cardbus/if_tlp_cardbus.c:1.66	Fri Feb 26 00:57:02 2010
+++ src/sys/dev/cardbus/if_tlp_cardbus.c	Wed Mar 10 00:21:10 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_tlp_cardbus.c,v 1.66 2010/02/26 00:57:02 dyoung Exp $	*/
+/*	$NetBSD: if_tlp_cardbus.c,v 1.67 2010/03/10 00:21:10 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_tlp_cardbus.c,v 1.66 2010/02/26 00:57:02 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_tlp_cardbus.c,v 1.67 2010/03/10 00:21:10 dyoung Exp $);
 
 #include opt_inet.h
 
@@ -307,20 +307,12 @@
 	if (Cardbus_mapreg_map(ct, TULIP_PCI_MMBA,
 	PCI_MAPREG_TYPE_MEM, 0, sc-sc_st, sc-sc_sh, adr,
 	csc-sc_mapsize) == 0) {
-#if rbus
-#else
-		(*ct-ct_cf-cardbus_mem_open)(cc, 0, adr, adr+csc-sc_mapsize);
-#endif
 		csc-sc_csr |= PCI_COMMAND_MEM_ENABLE;
 		csc-sc_bar_reg = TULIP_PCI_MMBA;
 		csc-sc_bar_val = adr | PCI_MAPREG_TYPE_MEM;
 	} else if (Cardbus_mapreg_map(ct, TULIP_PCI_IOBA,
 	PCI_MAPREG_TYPE_IO, 0, sc-sc_st, sc-sc_sh, adr,
 	csc-sc_mapsize) == 0) {
-#if rbus
-#else
-		(*ct-ct_cf-cardbus_io_open)(cc, 0, adr, adr+csc-sc_mapsize);
-#endif
 		csc-sc_csr |= PCI_COMMAND_IO_ENABLE;
 		csc-sc_bar_reg = TULIP_PCI_IOBA;
 		csc-sc_bar_val = adr | PCI_MAPREG_TYPE_IO;
@@ -472,7 +464,7 @@
 	 * Unhook the interrupt handler.
 	 */
 	if (csc-sc_ih != NULL)
-		cardbus_intr_disestablish(ct-ct_cc, ct-ct_cf, csc-sc_ih);
+		Cardbus_intr_disestablish(ct, csc-sc_ih);
 
 	/*
 	 * Release bus space and close window.
@@ -489,8 +481,6 @@
 {
 	struct tulip_cardbus_softc *csc = (void *) sc;
 	cardbus_devfunc_t ct = csc-sc_ct;
-	cardbus_chipset_tag_t cc = ct-ct_cc;
-	cardbus_function_tag_t cf = ct-ct_cf;
 
 	/*
 	 * Power on the socket.
@@ -505,7 +495,7 @@
 	/*
 	 * Map and establish the interrupt.
 	 */
-	csc-sc_ih = cardbus_intr_establish(cc, cf, csc-sc_intrline, IPL_NET,
+	csc-sc_ih = Cardbus_intr_establish(ct, csc-sc_intrline, IPL_NET,
 	tlp_intr, sc);
 	if (csc-sc_ih == NULL) {
 		aprint_error_dev(sc-sc_dev,
@@ 

CVS commit: src/sys/dev/cardbus

2010-03-05 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Mar  5 22:47:03 UTC 2010

Modified Files:
src/sys/dev/cardbus: rbus_ppb.c

Log Message:
Remove dead code (it is commented out).

Delete the detach routine, it's obviously not finished.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/cardbus/rbus_ppb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/cardbus/rbus_ppb.c
diff -u src/sys/dev/cardbus/rbus_ppb.c:1.38 src/sys/dev/cardbus/rbus_ppb.c:1.39
--- src/sys/dev/cardbus/rbus_ppb.c:1.38	Thu Mar  4 18:49:14 2010
+++ src/sys/dev/cardbus/rbus_ppb.c	Fri Mar  5 22:47:03 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: rbus_ppb.c,v 1.38 2010/03/04 18:49:14 dyoung Exp $	*/
+/*	$NetBSD: rbus_ppb.c,v 1.39 2010/03/05 22:47:03 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rbus_ppb.c,v 1.38 2010/03/04 18:49:14 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: rbus_ppb.c,v 1.39 2010/03/05 22:47:03 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -78,7 +78,6 @@
 
 static int  ppb_cardbus_match(device_t, cfdata_t, void *);
 static void ppb_cardbus_attach(device_t, device_t, void *);
-static int  ppb_cardbus_detach(device_t  self, int flags);
 static int  ppb_activate(device_t, enum devact);
 int rppbprint(void *, const char *);
 int rbus_intr_fixup(pci_chipset_tag_t, int, int, int);
@@ -104,7 +103,7 @@
 };
 
 CFATTACH_DECL_NEW(rbus_ppb, sizeof(struct ppb_cardbus_softc),
-ppb_cardbus_match, ppb_cardbus_attach, ppb_cardbus_detach, ppb_activate);
+ppb_cardbus_match, ppb_cardbus_attach, NULL, ppb_activate);
 
 #ifdef  CBB_DEBUG
 int rbus_ppb_debug = 0;   /* hack with kdb */
@@ -509,8 +508,6 @@
 int bus, device, function, command;
 	struct rbus_pci_addr_fixup_context *rct =
 	  (struct rbus_pci_addr_fixup_context *)context;
-	//cardbus_chipset_tag_t ct = rct-ct;
-	//	struct cardbus_softc *sc = rct-sc;
 
 	pci_decompose_tag(pc, tag, bus, device, function);
 
@@ -731,45 +728,6 @@
 	config_found_ia(self, pcibus, pba, rppbprint);
 }
 
-static int
-ppb_cardbus_detach(device_t self, int flags)
-{
-  /* struct ppb_softc *sc = device_private(self);*/
-	struct ppb_cardbus_softc *csc = device_private(self);
-
-#if 0
-	struct cardbus_devfunc *ct = csc-ct;
-	int rv, reg;
-
-#ifdef DIAGNOSTIC
-	if (ct == NULL)
-		panic(%s: data structure lacks, device_xname(sc-sc_dev));
-#endif
-
-	rv = fxp_detach(sc);
-	if (rv == 0) {
-		/*
-		 * Unhook the interrupt handler.
-		 */
-		Cardbus_intr_disestablish(ct, sc-sc_ih);
-
-		/*
-		 * release bus space and close window
-		 */
-		if (csc-base0_reg)
-			reg = PCI_BAR0;
-		else
-			reg = PCI_BAR1;
-		Cardbus_mapreg_unmap(ct, reg, sc-sc_st, sc-sc_sh, csc-size);
-	}
-	return (rv);
-
-#endif
-	csc-foo=1;
-	return 0;
-
-}
-
 int
 ppb_activate(device_t self, enum devact act)
 {



CVS commit: src/sys/dev/cardbus

2010-03-05 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Mar  5 22:47:03 UTC 2010

Modified Files:
src/sys/dev/cardbus: rbus_ppb.c

Log Message:
Remove dead code (it is commented out).

Delete the detach routine, it's obviously not finished.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/cardbus/rbus_ppb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



  1   2   3   >