Re: CVS commit: src/sys

2017-01-03 Thread Robert Elz
Date:Wed, 04 Jan 2017 14:23:12 +0700
From:Robert Elz 
Message-ID:  <3987.1483514...@andromeda.noi.kre.to>

Ignore this gibberish..

  | division into a constant is equvalent to multiplication by its reciprocal,

I still have the impression tha it is possible to do this conversion using
a multiplication, but it isn't that simple...

kre



Re: CVS commit: src/sys

2017-01-03 Thread Robert Elz
Date:Wed, 4 Jan 2017 14:52:11 +0800 (PHT)
From:Paul Goyette 
Message-ID:  

  | Either is possible, although converting to fixed-point fraction is
  | marginally more expensive (requires a division vs multiplication).

Compared with the cost of the sys call to retrieve, and then copy out,
the data, one division would be relatively harmless, but here the division
is into a constant (100 for the current timeval data source), and
division into a constant is equvalent to multiplication by its reciprocal,
so in this case, it is just changing a multiplication by a small const into
a multiplication by a big one (still probaby a little slower on some arch's.)

  | Does anyone else have any preferences?  I'd prefer that the next "touch"
  | on this be the last one, at least for a while.   :)

That is totally understandable - please wait and do it right.

kre



Re: CVS commit: src/sys

2017-01-03 Thread Paul Goyette

On Wed, 4 Jan 2017, Robert Elz wrote:


   Date:Wed, 4 Jan 2017 05:52:45 +
   From:David Holland 
   Message-ID:  <20170104055245.ga16...@netbsd.org>

 | also make it nsec...

Since it is a 64  bt value, better would be pico-secs if it is going
to continue to be a timeval/timespec kind of number - but better would be
to make it be a binary fraction of a second (ie: fixed point with the
point to the left of the MSBit position - then the precision can grow
as needed (to absurd values) without canging the API)


Either is possible, although converting to fixed-point fraction is
marginally more expensive (requires a division vs multiplication).

Does anyone else have any preferences?  I'd prefer that the next "touch"
on this be the last one, at least for a while.   :)




+--+--++
| Paul Goyette | PGP Key fingerprint: | E-mail addresses:  |
| (Retired)| FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com   |
| Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd.org |
+--+--++


Re: CVS commit: src/sys

2017-01-03 Thread Robert Elz
Date:Wed, 4 Jan 2017 05:52:45 +
From:David Holland 
Message-ID:  <20170104055245.ga16...@netbsd.org>

  | also make it nsec...

Since it is a 64  bt value, better would be pico-secs if it is going
to continue to be a timeval/timespec kind of number - but better would be
to make it be a binary fraction of a second (ie: fixed point with the
point to the left of the MSBit position - then the precision can grow
as needed (to absurd values) without canging the API)

kre



Re: CVS commit: src/sys

2017-01-03 Thread David Holland
On Wed, Jan 04, 2017 at 09:17:23AM +0800, Paul Goyette wrote:
 > > > /* info for a single history event */
 > > > struct sysctl_history_event {
 > > > -struct timespec she_tspec;
 > > > +time_t  she_time_sec;
 > > > +uint32_tshe_time_usec;
 > > > +uint32_tshe_filler;
 > > 
 > > I would make those explicitly sized types, uint64_t x 2
 > 
 > Sure!

also make it nsec...

-- 
David A. Holland
dholl...@netbsd.org


Re: CVS commit: src/sys

2017-01-03 Thread Paul Goyette

On Wed, 4 Jan 2017, Christos Zoulas wrote:


@@ -80,13 +80,14 @@ struct sysctl_history_list_entry {

/* info for a single history event */
struct sysctl_history_event {
-   struct timespec she_tspec;
+   time_t  she_time_sec;
+   uint32_tshe_time_usec;
+   uint32_tshe_filler;


I would make those explicitly sized types, uint64_t x 2


Sure!



+--+--++
| Paul Goyette | PGP Key fingerprint: | E-mail addresses:  |
| (Retired)| FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com   |
| Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd.org |
+--+--++


Re: CVS commit: src/sys

2017-01-03 Thread Christos Zoulas
In article <20170104010558.7643ef...@cvs.netbsd.org>,
Paul Goyette  wrote:
>-=-=-=-=-=-
>
>Module Name:   src
>Committed By:  pgoyette
>Date:  Wed Jan  4 01:05:58 UTC 2017
>
>Modified Files:
>   src/sys/kern: kern_history.c
>   src/sys/sys: kernhist.h
>
>Log Message:
>Rearrange the sysctl export structure for better alignment.
>
>
>To generate a diff of this commit:
>cvs rdiff -u -r1.9 -r1.10 src/sys/kern/kern_history.c
>cvs rdiff -u -r1.14 -r1.15 src/sys/sys/kernhist.h
>
>Please note that diffs are not public domain; they are subject to the
>copyright notices on the relevant files.
>
>
>-=-=-=-=-=-
>
>Modified files:
>
>Index: src/sys/kern/kern_history.c
>diff -u src/sys/kern/kern_history.c:1.9 src/sys/kern/kern_history.c:1.10
>--- src/sys/kern/kern_history.c:1.9Sun Jan  1 23:58:47 2017
>+++ src/sys/kern/kern_history.cWed Jan  4 01:05:58 2017
>@@ -1,4 +1,4 @@
>-/*$NetBSD: kern_history.c,v 1.9 2017/01/01 23:58:47 pgoyette Exp $
> */
>+/*$NetBSD: kern_history.c,v 1.10 2017/01/04 01:05:58 pgoyette Exp $   
> */
> 
> /*
>  * Copyright (c) 1997 Charles D. Cranor and Washington University.
>@@ -33,7 +33,7 @@
>  */
> 
> #include 
>-__KERNEL_RCSID(0, "$NetBSD: kern_history.c,v 1.9 2017/01/01 23:58:47
>pgoyette Exp $");
>+__KERNEL_RCSID(0, "$NetBSD: kern_history.c,v 1.10 2017/01/04 01:05:58
>pgoyette Exp $");
> 
> #include "opt_ddb.h"
> #include "opt_kernhist.h"
>@@ -466,7 +466,8 @@ sysctl_kernhist_helper(SYSCTLFN_ARGS)
>   out_evt->she_fmtoffset = 0;
>   continue;
>   }
>-  TIMEVAL_TO_TIMESPEC(&in_evt->tv, &out_evt->she_tspec);
>+  out_evt->she_time_sec = in_evt->tv.tv_sec;
>+  out_evt->she_time_usec = in_evt->tv.tv_usec;
>   out_evt->she_callnumber = in_evt->call;
>   out_evt->she_cpunum = in_evt->cpunum;
>   out_evt->she_values[0] = in_evt->v[0];
>
>Index: src/sys/sys/kernhist.h
>diff -u src/sys/sys/kernhist.h:1.14 src/sys/sys/kernhist.h:1.15
>--- src/sys/sys/kernhist.h:1.14Sun Jan  1 23:58:47 2017
>+++ src/sys/sys/kernhist.h Wed Jan  4 01:05:58 2017
>@@ -1,4 +1,4 @@
>-/*$NetBSD: kernhist.h,v 1.14 2017/01/01 23:58:47 pgoyette Exp $   */
>+/*$NetBSD: kernhist.h,v 1.15 2017/01/04 01:05:58 pgoyette Exp $   */
> 
> /*
>  * Copyright (c) 1997 Charles D. Cranor and Washington University.
>@@ -80,13 +80,14 @@ struct sysctl_history_list_entry {
> 
> /* info for a single history event */
> struct sysctl_history_event {
>-  struct timespec she_tspec;
>+  time_t  she_time_sec;
>+  uint32_tshe_time_usec;
>+  uint32_tshe_filler;

I would make those explicitly sized types, uint64_t x 2

christos



Re: CVS commit: src/sys/compat/linux/arch

2017-01-03 Thread Ryo ONODERA
From: m...@netbsd.org (Emmanuel Dreyfus), Date: Tue, 3 Jan 2017 02:30:17 +0100

> Ryo ONODERA  wrote:
> 
>> This commit breaks my kernel build.
>> It seems that this commit does not fit with -current's format.
>> Could you regenerate these files again?
> 
> What error do you get?

Here is typical errors. Anyway these are fixed already.
Thank you.

/usr/src/sys/compat/linux/arch/amd64/linux_sysent.c:1088:6: error: missing initi
alizer for field 'sy_entry' of 'struct sysent' [-Werror=missing-field-initialize
rs]
  linux_sys_nosys },   /* 503 = filler */
  ^
In file included from /usr/src/sys/sys/timevar.h:66:0,
 from /usr/src/sys/sys/time.h:296,
 from /usr/src/sys/sys/param.h:145,
 from /usr/src/sys/compat/linux/arch/amd64/linux_sysent.c:18:
/usr/src/sys/sys/systm.h:125:11: note: 'sy_entry' declared here
  uint32_t sy_entry; /* DTrace entry ID for systrace. */
   ^
/usr/src/sys/compat/linux/arch/amd64/linux_sysent.c:1090:6: error: missing initi
alizer for field 'sy_entry' of 'struct sysent' [-Werror=missing-field-initialize
rs]
  linux_sys_nosys },   /* 504 = filler */
  ^
In file included from /usr/src/sys/sys/timevar.h:66:0,
 from /usr/src/sys/sys/time.h:296,
 from /usr/src/sys/sys/param.h:145,
 from /usr/src/sys/compat/linux/arch/amd64/linux_sysent.c:18:
/usr/src/sys/sys/systm.h:125:11: note: 'sy_entry' declared here
  uint32_t sy_entry; /* DTrace entry ID for systrace. */
   ^
/usr/src/sys/compat/linux/arch/amd64/linux_sysent.c:1092:6: error: missing initi
alizer for field 'sy_entry' of 'struct sysent' [-Werror=missing-field-initialize
rs]
  linux_sys_nosys },   /* 505 = filler */
  ^
In file included from /usr/src/sys/sys/timevar.h:66:0,
 from /usr/src/sys/sys/time.h:296,
 from /usr/src/sys/sys/param.h:145,
 from /usr/src/sys/compat/linux/arch/amd64/linux_sysent.c:18:
/usr/src/sys/sys/systm.h:125:11: note: 'sy_entry' declared here
  uint32_t sy_entry; /* DTrace entry ID for systrace. */
   ^


> -- 
> Emmanuel Dreyfus
> http://hcpnet.free.fr/pubz
> m...@netbsd.org

--
Ryo ONODERA // ryo...@yk.rim.or.jp
PGP fingerprint = 82A2 DC91 76E0 A10A 8ABB  FD1B F404 27FA C7D1 15F3