Re: monotonic time going back by wrong skews

2021-04-06 Thread Paul Irofti
The diff is obviously fine. But it is still a heuristic with no real motivation except for this particular ESXi VM case. So my question about why we choose the minimum instead of the median or the mean has not been answered. Because median or mean is affected by outliers. We actually see some

Re: monotonic time going back by wrong skews

2021-04-05 Thread Paul Irofti
On 05.04.2021 06:13, Scott Cheloha wrote: On Mon, Mar 29, 2021 at 02:00:01PM +0900, YASUOKA Masahiko wrote: On Thu, 25 Mar 2021 19:41:35 +0100 (CET) Mark Kettenis wrote: From: Scott Cheloha Date: Thu, 25 Mar 2021 13:18:04 -0500 On Wed, Mar 24, 2021 at 05:40:21PM +0900, YASUOKA Masahiko

Re: monotonic time going back by wrong skews

2021-03-24 Thread Paul Irofti
Hi, Thank you for taking this to tech@ as requested! I will reproduce here what I replied to Yasouka and Scott (which I think proposed taking the minimum skew value) in private. "First, thank you very much for the in-depth analysis. I would suggest you take this to a public forum like tech@

Re: occasional SSIGSEGV on C++ exception handling

2021-02-22 Thread Paul Irofti
On 22.02.2021 15:56, Otto Moerbeek wrote: On Mon, Feb 22, 2021 at 11:09:41AM +0200, Paul Irofti wrote: - investigate the commit you mention above. Sadly I cannot remember the original case that prompted for the caching code to be added. Sorry I could not reply

Re: occasional SSIGSEGV on C++ exception handling

2021-02-22 Thread Paul Irofti
- investigate the commit you mention above. Sadly I cannot remember the original case that prompted for the caching code to be added. Sorry I could not reply earlier. The caching code was added by me to make libreoffice work with non-toy spreadsheets. Apparently

Re: [please test] acpi: more *sleep(9) -> *sleep_nsec(9) conversions

2020-12-21 Thread Paul Irofti
I think Scott should split his diff in two so people can test which part breaks suspend-resume. Can you try reverting the dsdt.c bits and leaving the acpiec part of the diff in your tree and see if suspend is still broken? Paul

Re: sndiod: (mostly) suppress aliasing noise

2020-12-20 Thread Paul Irofti
Hi, Interesting diff. I did not have time to look at it thoroughly, but here are a few observations: - why do you keep the symmetric filter coefficients? (this could halve your while-loop computations too, right?) - the diff's mainlobe look kind of strange at the end, why is that? What

Re: sigismasked()

2020-09-09 Thread Paul Irofti
On 2020-09-09 09:35, Martin Pieuchot wrote: Simple helper function to centralize the manipulation of `ps_sigignore' and `p_sigmask' in kern/kern_sig.c and later on add the corresponding asserts, ok? Yes please! OK pirofti@ Index: kern/kern_sig.c

Re: timekeep: fixing large skews on amd64 with RDTSCP

2020-08-23 Thread Paul Irofti
În 23 august 2020 06:05:44 EEST, Scott Cheloha a scris: >On Tue, Jul 28, 2020 at 10:02:07AM +0300, Paul Irofti wrote: >> >> [...] >> >> Is the issue with LFENCE slowing down the network stack settled? That >was >> the argument against it last time. > >

Re: timekeep: fixing large skews on amd64 with RDTSCP

2020-07-28 Thread Paul Irofti
On 2020-07-27 18:24, Mark Kettenis wrote: Date: Mon, 27 Jul 2020 17:14:21 +0200 From: Christian Weisgerber Scott Cheloha: --- lib/libc/arch/amd64/gen/usertc.c8 Jul 2020 09:17:48 - 1.2 +++ lib/libc/arch/amd64/gen/usertc.c25 Jul 2020 17:50:38 - @@ -21,9 +21,12 @@ static

Re: disable libc sys wrappers?

2020-07-14 Thread Paul Irofti
On 13.07.2020 20:43, Ted Unangst wrote: On 2020-07-09, Theo de Raadt wrote: Added a -T option to ktrace for transparency. I got ambitious here and made it take suboptions, anticipating that other transparency modifications may be desired. Please don't do that. Here is a simpler version.

Re: timekeep: tk_generation problem

2020-07-13 Thread Paul Irofti
Hi, I am assuming you tested on amd64. Mind sharing the dmesg? Could this be due to the lack of RDTSC serialization in userland? Thank you for the report! Paul În 13 iulie 2020 06:44:57 EEST, George Koehler a scris: >Hello tech list, > >My CLOCK_MONOTONIC can jump backwards. It looks like

Re: timekeep: fixing large skews on amd64 with RDTSCP

2020-07-11 Thread Paul Irofti
On 2020-07-11 13:46, Mark Kettenis wrote: From: Paul Irofti Date: Sat, 11 Jul 2020 13:32:22 +0300 Hi, Getting lots of messages about people loving the new timekeep functionality, which I am very happy about, but also some that have the skew too large for it to be enabled. I plan on sending

timekeep: fixing large skews on amd64 with RDTSCP

2020-07-11 Thread Paul Irofti
Hi, Getting lots of messages about people loving the new timekeep functionality, which I am very happy about, but also some that have the skew too large for it to be enabled. I plan on sending a diff next week to improve the situation via RDTSCP on the machines that have it. Which is

Re: userland clock_gettime proof of concept

2020-07-10 Thread Paul Irofti
:03:58 -0400 >> >> From: George Koehler >> >> >> >> On Wed, 8 Jul 2020 14:26:02 +0200 (CEST) >> >> Mark Kettenis wrote: >> >> >> >> > > From: Paul Irofti >> >> > > Reads OK to me. Please make the adjustments to sta

Re: userland clock_gettime proof of concept

2020-07-10 Thread Paul Irofti
În 11 iulie 2020 02:15:27 EEST, Mark Kettenis a scris: >> Date: Fri, 10 Jul 2020 19:03:58 -0400 >> From: George Koehler >> >> On Wed, 8 Jul 2020 14:26:02 +0200 (CEST) >> Mark Kettenis wrote: >> >> > > From: Paul Irofti >> > > Rea

Re: arm64 usertc

2020-07-09 Thread Paul Irofti
$ */ /* - * Copyright (c) 2020 Paul Irofti + * Copyright (c) 2020 Mark Kettenis * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -18,4 +18,39 @@ #include #include -int (*const _tc_get_timecount

Re: disable libc sys wrappers?

2020-07-08 Thread Paul Irofti
I don't see the original mail here either. Is it me or Ted, or a forward from a private conversation? Anyway, I am OK with this and Robert had a similar diff two months ago when this started. Just make sure this is off by default for both type of binaries. Paul În 8 iulie 2020 18:42:41 EEST,

Re: pshared semaphores

2020-07-08 Thread Paul Irofti
Where is the original email that you replied too? The subject interests me but I don't see Ted's original email.

Re: userland clock_gettime proof of concept

2020-07-08 Thread Paul Irofti
On 2020-07-08 01:09, Theo de Raadt wrote: The /sys/arch/powerpc/include/timetc.h in your diff never gets used, because there is no #include . On macppc, I am fixing this issue for all the architectures, just being careful by doing builds first. Thank you for handling this.

Re: userland clock_gettime proof of concept

2020-07-08 Thread Paul Irofti
On 2020-06-26 06:22, George Koehler wrote: On Mon, 22 Jun 2020 19:12:22 +0300 Paul Irofti wrote: New iteration: - ps_timekeep should not coredump, pointed by deraadt@ - set ps_timekeep to 0 before user uvm_map for randomization - map timekeep before fixup. confirmed by naddy

Re: user tc for alpha

2020-07-08 Thread Paul Irofti
On 2020-07-07 23:49, Christian Weisgerber wrote: Userland gettime support for alpha. Alas, completely untested since I don't have access to that arch. Never had an alpha. Reads OK to me (if you make the function static like kettenis@ said). Index: lib/libc/arch/alpha/gen/usertc.c

Re: user tc for alpha

2020-07-08 Thread Paul Irofti
n 1.1 diff -u -p -r1.1 usertc.c --- lib/libc/arch/sparc64/gen/usertc.c 6 Jul 2020 13:33:05 - 1.1 +++ lib/libc/arch/sparc64/gen/usertc.c 7 Jul 2020 23:29:48 - @@ -1,6 +1,6 @@ /*$OpenBSD: usertc.c,v 1.1 2020/07/06 13:33:05 pirofti Exp $ */ /* - * Copyright (c) 20

Re: userland clock_gettime proof of concept

2020-07-05 Thread Paul Irofti
On Fri, Jul 03, 2020 at 06:36:39PM +0300, Paul Irofti wrote: > > > În 3 iulie 2020 17:55:25 EEST, Mark Kettenis a > scris: > >> Date: Fri, 3 Jul 2020 15:13:22 +0200 > >> From: Robert Nagy > >> > >> On 02/07/20 00:31 +0100, Stuart Hen

Re: userland clock_gettime proof of concept

2020-07-03 Thread Paul Irofti
În 3 iulie 2020 20:57:52 EEST, Mark Kettenis a scris: >> Date: Fri, 3 Jul 2020 12:42:58 -0500 >> From: Scott Cheloha >> >> On Fri, Jul 03, 2020 at 02:34:20PM +0300, Paul Irofti wrote: >> > On 2020-07-03 00:40, Scott Cheloha wrote: >> > > On Fri,

Re: userland clock_gettime proof of concept

2020-07-03 Thread Paul Irofti
În 3 iulie 2020 18:45:29 EEST, Scott Cheloha a scris: >On Fri, Jul 03, 2020 at 06:36:39PM +0300, Paul Irofti wrote: >> >> >> ??n 3 iulie 2020 17:55:25 EEST, Mark Kettenis > a scris: >> >> Date: Fri, 3 Jul 2020 15:13:22 +0200 >> >> From: R

Re: userland clock_gettime proof of concept

2020-07-03 Thread Paul Irofti
În 3 iulie 2020 17:55:25 EEST, Mark Kettenis a scris: >> Date: Fri, 3 Jul 2020 15:13:22 +0200 >> From: Robert Nagy >> >> On 02/07/20 00:31 +0100, Stuart Henderson wrote: >> > running on 38 of these, btw. >> >> been running with this on all my workstations and laptops and on 3 >build >>

Re: userland clock_gettime proof of concept

2020-07-03 Thread Paul Irofti
On 2020-07-03 00:40, Scott Cheloha wrote: On Fri, Jun 26, 2020 at 04:53:14PM +0300, Paul Irofti wrote: On Wed, Jun 24, 2020 at 11:53:23AM +0200, Robert Nagy wrote: On 22/06/20 19:12 +0300, Paul Irofti wrote: New iteration: - ps_timekeep should not coredump, pointed by deraadt@ - set

Re: userland clock_gettime proof of concept

2020-06-26 Thread Paul Irofti
On Wed, Jun 24, 2020 at 11:53:23AM +0200, Robert Nagy wrote: > On 22/06/20 19:12 +0300, Paul Irofti wrote: > > New iteration: > > > > - ps_timekeep should not coredump, pointed by deraadt@ > > - set ps_timekeep to 0 before user uvm_map for randomization > &

Re: userland clock_gettime proof of concept

2020-06-22 Thread Paul Irofti
..6551854a010 --- /dev/null +++ lib/libc/arch/aarch64/gen/usertc.c @@ -0,0 +1,21 @@ +/* $OpenBSD$ */ +/* + * Copyright (c) 2020 Paul Irofti + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided

Re: userland clock_gettime proof of concept

2020-06-22 Thread Paul Irofti
On Mon, Jun 22, 2020 at 09:46:13AM -0600, Theo de Raadt wrote: > Christian Weisgerber wrote: > > > Paul Irofti: > > > > > 683 /* map the process's timekeep page */ > > > 684 if (exec_timekeep_map(pr)) > > > 685 goto fr

Re: userland clock_gettime proof of concept

2020-06-22 Thread Paul Irofti
On Mon, Jun 22, 2020 at 05:35:48PM +0200, Christian Weisgerber wrote: > Paul Irofti: > > > 683 /* map the process's timekeep page */ > > 684 if (exec_timekeep_map(pr)) > > 685 goto free_pack_abort; > > 686 /* setup ne

Re: userland clock_gettime proof of concept

2020-06-22 Thread Paul Irofti
On Sun, Jun 21, 2020 at 05:42:55PM -0600, Theo de Raadt wrote: > Paul Irofti wrote: > > > > > > > > > ??n 22 iunie 2020 01:26:16 EEST, Christian Weisgerber > > a scris: > > >Christian Weisgerber: > > > > > >> I tweaked

Re: userland clock_gettime proof of concept

2020-06-22 Thread Paul Irofti
> Still uses uint instead of u_int in places. Still has the pointless > extra NULL and 0 for timecounters in files that are otherwise If you don't like uint, then let's fix what's in the tree in amd64 (which is how uint got used in my diff too). OK? diff --git sys/arch/amd64/amd64/tsc.c

Re: userland clock_gettime proof of concept

2020-06-22 Thread Paul Irofti
On Mon, Jun 22, 2020 at 01:27:22AM +0200, Mark Kettenis wrote: > > Date: Mon, 22 Jun 2020 02:06:39 +0300 > > From: Paul Irofti > > > > În 22 iunie 2020 00:15:59 EEST, Christian Weisgerber a > > scris: > > >Paul Irofti: > > > > > >[U

Re: userland clock_gettime proof of concept

2020-06-21 Thread Paul Irofti
În 22 iunie 2020 01:26:16 EEST, Christian Weisgerber a scris: >Christian Weisgerber: > >> I tweaked the patch locally to make _timekeep a visible global >> symbol in libc. >> >> Printing its value has revealed two issues: >> >> * The timekeep page is mapped to the same address for every

Re: userland clock_gettime proof of concept

2020-06-21 Thread Paul Irofti
În 22 iunie 2020 00:15:59 EEST, Christian Weisgerber a scris: >Paul Irofti: > >[Unrelated, just to mark where we're at] >> Right. Just reproduced it here. This moves the check at the top so >that >> each CPU checks its own skew and disables tc_user if necessary. > &

Re: userland clock_gettime proof of concept

2020-06-21 Thread Paul Irofti
On Sun, Jun 21, 2020 at 08:18:57PM +0200, Christian Weisgerber wrote: > Paul Irofti: > > > Can't test right now, but if you enable the TSC_DEBUG in cpu.c or if you > > put a printf in the CPU_INFO_FOREACH you will probably see the correct > > skew values. > > It's

Re: lfence for rdtsc

2020-06-21 Thread Paul Irofti
On Sun, Jun 21, 2020 at 04:55:56PM +0100, Stuart Henderson wrote: > On 2020/06/21 18:46, Paul Irofti wrote: > > > > > > În 21 iunie 2020 16:30:43 EEST, Theo de Raadt a scris: > > >Paul Irofti wrote: > > > > > >> If you change the name to rd

Re: userland clock_gettime proof of concept

2020-06-21 Thread Paul Irofti
On Sun, Jun 21, 2020 at 05:44:36PM +0200, Christian Weisgerber wrote: > Paul Irofti: > > > This also handles negative skew values that my prevoius diff did not. > > > --- sys/arch/amd64/amd64/tsc.c > > +++ sys/arch/amd64/amd64/tsc.c > > @@ -216,6 +217,8 @@ tsc

Re: lfence for rdtsc

2020-06-21 Thread Paul Irofti
În 21 iunie 2020 16:30:43 EEST, Theo de Raadt a scris: >Paul Irofti wrote: > >> If you change the name to rdtsc_ordered(), OK. > >That is a weaker name. > >Ordered in what way, at what level; ordered against what? > >This is using a specific pipeline ordering

Re: userland clock_gettime proof of concept

2020-06-21 Thread Paul Irofti
--- /dev/null +++ lib/libc/arch/aarch64/gen/usertc.c @@ -0,0 +1,21 @@ +/* $OpenBSD$ */ +/* + * Copyright (c) 2020 Paul Irofti + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above

Re: userland clock_gettime proof of concept

2020-06-21 Thread Paul Irofti
ght (c) 2020 Paul Irofti + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVI

Re: userland clock_gettime proof of concept

2020-06-21 Thread Paul Irofti
ha/gen/usertc.c @@ -0,0 +1,21 @@ +/* $OpenBSD$ */ +/* + * Copyright (c) 2020 Paul Irofti + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission noti

Re: lfence for rdtsc

2020-06-21 Thread Paul Irofti
On Sat, Jun 20, 2020 at 10:02:19PM +0200, Mark Kettenis wrote: > RDTSC is not a serializing instruction; to make sure we get the TSC > value corresponding to the position of RDTSC in te instruction stream > we need a barrier. Linux uses LFENCE on machines where it is > available. FreeBSD seems

Re: userland clock_gettime proof of concept

2020-06-19 Thread Paul Irofti
În 19 iunie 2020 23:37:28 EEST, Mark Kettenis a scris: >> Date: Fri, 19 Jun 2020 23:16:26 +0300 >> From: Paul Irofti >> >> În 19 iunie 2020 22:49:32 EEST, Mark Kettenis > a scris: >> >> Date: Fri, 19 Jun 2020 20:28:58 +0300 >> >> From: Paul

Re: userland clock_gettime proof of concept

2020-06-19 Thread Paul Irofti
În 19 iunie 2020 22:49:32 EEST, Mark Kettenis a scris: >> Date: Fri, 19 Jun 2020 20:28:58 +0300 >> From: Paul Irofti >> >> On Fri, Jun 19, 2020 at 06:52:40PM +0200, Mark Kettenis wrote: >> > > Date: Fri, 19 Jun 2020 14:31:17 +0300 >>

Re: userland clock_gettime proof of concept

2020-06-19 Thread Paul Irofti
On Fri, Jun 19, 2020 at 06:52:40PM +0200, Mark Kettenis wrote: > > Date: Fri, 19 Jun 2020 14:31:17 +0300 > > From: Paul Irofti > > > > Hi, > > > > Here is another iteration of the diff that addresses all issues raised > > in the meantime: >

Re: userland clock_gettime proof of concept

2020-06-19 Thread Paul Irofti
On Fri, Jun 19, 2020 at 05:20:24PM +0300, Paul Irofti wrote: > Hi Lucas, > > Will reply inline. > > > As a matter of syntax, there are quite some places with functions > > without parameters defined as `f()` instead of `f(void)`. > > Sure. Good catch. > >

Re: userland clock_gettime proof of concept

2020-06-19 Thread Paul Irofti
Hi Lucas, Will reply inline. As a matter of syntax, there are quite some places with functions without parameters defined as `f()` instead of `f(void)`. Sure. Good catch. + if (tc == NULL || tk_user < 1 || tk_user > TC_LAST) Shouldn't you check for >= TC_LAST in here? Otherwise

Re: userland clock_gettime proof of concept

2020-06-19 Thread Paul Irofti
+++ lib/libc/arch/aarch64/gen/usertc.c @@ -0,0 +1,21 @@ +/* $OpenBSD$ */ +/* + * Copyright (c) 2020 Paul Irofti + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice

Re: userland clock_gettime proof of concept

2020-06-12 Thread Paul Irofti
On 12.06.2020 10:48, Robert Nagy wrote: On 11/06/20 20:10 +0200, Mark Kettenis wrote: Date: Thu, 11 Jun 2020 19:38:48 +0200 From: Christian Weisgerber Theo de Raadt: The diff is growing complexity to support a future which wouldn't exist if attempts at *supporting all* architectures

Re: userland clock_gettime proof of concept

2020-06-11 Thread Paul Irofti
On 2020-06-11 16:54, Mark Kettenis wrote: Date: Thu, 11 Jun 2020 16:27:03 +0300 From: Paul Irofti On Thu, Jun 11, 2020 at 02:49:54PM +0200, Marc Espie wrote: On Thu, Jun 11, 2020 at 03:42:27PM +0300, Paul Irofti wrote: On Thu, Jun 11, 2020 at 02:05:44PM +0200, Marc Espie wrote: On Thu, Jun

Re: userland clock_gettime proof of concept

2020-06-11 Thread Paul Irofti
On Thu, Jun 11, 2020 at 02:49:54PM +0200, Marc Espie wrote: > On Thu, Jun 11, 2020 at 03:42:27PM +0300, Paul Irofti wrote: > > On Thu, Jun 11, 2020 at 02:05:44PM +0200, Marc Espie wrote: > > > On Thu, Jun 11, 2020 at 01:13:07PM +0300, Paul Irofti wrote: > > > >

Re: userland clock_gettime proof of concept

2020-06-11 Thread Paul Irofti
On Thu, Jun 11, 2020 at 02:05:44PM +0200, Marc Espie wrote: > On Thu, Jun 11, 2020 at 01:13:07PM +0300, Paul Irofti wrote: > > On 2020-06-11 02:46, Christian Weisgerber wrote: > > > Paul Irofti: > > > > > > > This iteration of the diff add

Re: userland clock_gettime proof of concept

2020-06-11 Thread Paul Irofti
On 2020-06-11 03:42, Theo de Raadt wrote: Christian Weisgerber wrote: Paul Irofti: This iteration of the diff adds bounds checking for tk_user and moves the usertc.c stub to every arch in libc as recommanded by deraadt@. It also fixes a gettimeofday issue reported by cheloha@ and tb

Re: userland clock_gettime proof of concept

2020-06-11 Thread Paul Irofti
On 2020-06-11 02:46, Christian Weisgerber wrote: Paul Irofti: This iteration of the diff adds bounds checking for tk_user and moves the usertc.c stub to every arch in libc as recommanded by deraadt@. It also fixes a gettimeofday issue reported by cheloha@ and tb@. Additionally, it changes

Re: userland clock_gettime proof of concept

2020-06-11 Thread Paul Irofti
On 2020-06-11 01:16, Christian Weisgerber wrote: Paul Irofti: This iteration of the diff adds bounds checking for tk_user and moves the usertc.c stub to every arch in libc as recommanded by deraadt@. It also fixes a gettimeofday issue reported by cheloha@ and tb@. Forgot to add armv7

Re: userland clock_gettime proof of concept

2020-06-08 Thread Paul Irofti
rch64/gen/usertc.c @@ -0,0 +1,21 @@ +/* $OpenBSD$ */ +/* + * Copyright (c) 2020 Paul Irofti + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission noti

Re: userland clock_gettime proof of concept

2020-06-08 Thread Paul Irofti
On Fri, Jun 05, 2020 at 08:34:12PM +0300, Paul Irofti wrote: > On 05.06.2020 20:25, Mark Kettenis wrote: > > > Date: Fri, 5 Jun 2020 01:33:16 +0300 > > > From: Paul Irofti > > > > > > On Wed, Jun 03, 2020 at 05:13:42PM +0300, Paul Irofti wrote: > >

Re: userland clock_gettime proof of concept

2020-06-05 Thread Paul Irofti
On 05.06.2020 20:25, Mark Kettenis wrote: Date: Fri, 5 Jun 2020 01:33:16 +0300 From: Paul Irofti On Wed, Jun 03, 2020 at 05:13:42PM +0300, Paul Irofti wrote: On 2020-05-31 20:46, Mark Kettenis wrote: Forget about all that for a moment. Here is an alternative suggestion: On sparc64 we need

Re: userland clock_gettime proof of concept

2020-06-04 Thread Paul Irofti
On Wed, Jun 03, 2020 at 05:13:42PM +0300, Paul Irofti wrote: > On 2020-05-31 20:46, Mark Kettenis wrote: > > Forget about all that for a moment. Here is an alternative suggestion: > > > > On sparc64 we need to support both tick_timecounter and > > sys_tick_timecou

Re: userland clock_gettime proof of concept

2020-06-03 Thread Paul Irofti
On 2020-05-31 20:46, Mark Kettenis wrote: Forget about all that for a moment. Here is an alternative suggestion: On sparc64 we need to support both tick_timecounter and sys_tick_timecounter. So we need some sort of clockid value to distnguish between those two. I already suggested to use the

Re: userland clock_gettime proof of concept

2020-06-02 Thread Paul Irofti
How are you going to support multiple timecounters on an architecture? Let's say tsc sets tc_user=1 and acpihpet sets tc_user=2. Then in libc/arch/amd64/gen/usertc.c I do: static uint64_t rdtsc() { uint32_t hi, lo; asm volatile("rdtsc" : "=a"(lo), "=d"(hi));

Re: userland clock_gettime proof of concept

2020-06-02 Thread Paul Irofti
On 2020-06-02 16:29, Mark Kettenis wrote: From: Paul Irofti Date: Tue, 2 Jun 2020 16:23:30 +0300 On 2020-05-31 20:46, Mark Kettenis wrote: From: Paul Irofti Date: Sun, 31 May 2020 19:12:54 +0300 On 2020-05-31 18:25, Theo de Raadt wrote: Mark Kettenis wrote: I changed __amd64

Re: userland clock_gettime proof of concept

2020-06-02 Thread Paul Irofti
On 2020-05-31 20:46, Mark Kettenis wrote: From: Paul Irofti Date: Sun, 31 May 2020 19:12:54 +0300 On 2020-05-31 18:25, Theo de Raadt wrote: Mark Kettenis wrote: I changed __amd64 to __amd64__ because I didn't find __powerpc. I'm not sure, but one might move the list of arches to dlfcn

Re: userland clock_gettime proof of concept

2020-05-31 Thread Paul Irofti
On 2020-05-31 20:51, Theo de Raadt wrote: (There has been some pressure to get this in before it covers all the architectures and this kind of discussion is why I think such a premature "and then we'll fix it in the tree" procedure is wrong). Again, I hope not from me. I am in no rush with

Re: userland clock_gettime proof of concept

2020-05-31 Thread Paul Irofti
On 2020-05-31 20:46, Mark Kettenis wrote: From: Paul Irofti Date: Sun, 31 May 2020 19:12:54 +0300 On 2020-05-31 18:25, Theo de Raadt wrote: Mark Kettenis wrote: I changed __amd64 to __amd64__ because I didn't find __powerpc. I'm not sure, but one might move the list of arches to dlfcn

Re: userland clock_gettime proof of concept

2020-05-31 Thread Paul Irofti
On 2020-05-31 19:17, Theo de Raadt wrote: Paul Irofti wrote: Yeah, I just followed the dlfcn/dlfcn_stubs.c example from libc. Which I see now it is commented out... --- lib/libc/dlfcn/init.c.beforeSat May 30 23:26:35 2020 +++ lib/libc/dlfcn/init.c Sat May 30 18:00:45 2020

Re: userland clock_gettime proof of concept

2020-05-31 Thread Paul Irofti
On 2020-05-31 18:25, Theo de Raadt wrote: Mark Kettenis wrote: I changed __amd64 to __amd64__ because I didn't find __powerpc. I'm not sure, but one might move the list of arches to dlfcn/Makefile.inc and do -DTIMEKEEP, like how thread/Makefile.inc does -DFUTEX. One might drop the

Re: userland clock_gettime proof of concept

2020-05-31 Thread Paul Irofti
On Sun, May 31, 2020 at 12:25:00AM -0400, George Koehler wrote: > On Sat, 30 May 2020 19:21:30 +0300 > Paul Irofti wrote: > > > Here is an updated diff with no libc bump. Please use this one for > > further testing. > > Your diff does amd64. > Here is a diff to

Re: userland clock_gettime proof of concept

2020-05-31 Thread Paul Irofti
On 2020-05-31 07:28, Theo de Raadt wrote: PowerPC Mac OS X had a userland gettimeofday(2) using the cpu's timebase and a "common page" from the kernel. Their common page also had executable code for gettimeofday, memcpy, pthread_self, and a few other functions. We are desperately avoiding the

Re: userland clock_gettime proof of concept

2020-05-30 Thread Paul Irofti
$ */ +/* + * Copyright (c) 2020 Paul Irofti + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED

Re: userland clock_gettime proof of concept

2020-05-30 Thread Paul Irofti
On Sat, May 30, 2020 at 10:11:10AM -0600, Theo de Raadt wrote: > Paul Irofti wrote: > > > > > The libc bump is there because it helps me switch more easily between > > > > versions. > > > > > > That is bogus. Minors are used for visible ABI ad

Re: userland clock_gettime proof of concept

2020-05-30 Thread Paul Irofti
On Sat, May 30, 2020 at 09:59:41AM -0600, Theo de Raadt wrote: > Paul Irofti wrote: > > > > A few more notes below. > > > > I addressed all the comments. Here is the updated diff. This includes > > the rename to usertc that I suggested. > > I w

Re: userland clock_gettime proof of concept

2020-05-30 Thread Paul Irofti
AL(gettimeofday); +PROTO_WRAP(gettimeofday); PROTO_NORMAL(setitimer); PROTO_NORMAL(settimeofday); PROTO_NORMAL(utimes); diff --git lib/libc/hidden/sys/timetc.h lib/libc/hidden/sys/timetc.h new file mode 100644 index 000..bf9e8228f95 --- /dev/null +++ lib/libc/hidden/sys/timetc.h @@ -0,0

Re: userland clock_gettime proof of concept

2020-05-30 Thread Paul Irofti
On 2020-05-30 12:30, Mark Kettenis wrote: Date: Fri, 29 May 2020 17:51:50 +0300 From: Paul Irofti On Fri, May 29, 2020 at 03:00:50PM +0200, Mark Kettenis wrote: Date: Fri, 29 May 2020 13:45:37 +0100 From: Stuart Henderson On 2020/05/29 13:50, Paul Irofti wrote: +struct __timekeep

Re: userland clock_gettime proof of concept

2020-05-30 Thread Paul Irofti
On 2020-05-30 12:40, Mark Kettenis wrote: Date: Sat, 30 May 2020 10:49:07 +0200 From: Robert Nagy On 30/05/20 10:40 +0200, Mark Kettenis wrote: Date: Sat, 30 May 2020 10:32:15 +0200 From: Robert Nagy On 29/05/20 17:51 +0300, Paul Irofti wrote: On Fri, May 29, 2020 at 03:00:50PM +0200, Mark

Re: userland clock_gettime proof of concept

2020-05-29 Thread Paul Irofti
On Fri, May 29, 2020 at 03:00:50PM +0200, Mark Kettenis wrote: > > Date: Fri, 29 May 2020 13:45:37 +0100 > > From: Stuart Henderson > > > > On 2020/05/29 13:50, Paul Irofti wrote: > > > +struct __timekeep { > > > + uint32_t major; /* vers

Re: userland clock_gettime proof of concept

2020-05-29 Thread Paul Irofti
On 2020-05-29 16:00, Mark Kettenis wrote: Date: Fri, 29 May 2020 13:45:37 +0100 From: Stuart Henderson On 2020/05/29 13:50, Paul Irofti wrote: +struct __timekeep { + uint32_t major; /* version major number */ + uint32_t minor; /* version minor number

Re: userland clock_gettime proof of concept

2020-05-29 Thread Paul Irofti
On 2020-05-29 15:45, Stuart Henderson wrote: On 2020/05/29 13:50, Paul Irofti wrote: +struct __timekeep { + uint32_t major; /* version major number */ + uint32_t minor; /* version minor number */ + + u_int64_t th_scale; + unsigned int

Re: userland clock_gettime proof of concept

2020-05-29 Thread Paul Irofti
On Thu, May 28, 2020 at 07:43:55PM +0200, Mark Kettenis wrote: > > Date: Thu, 28 May 2020 17:44:31 +0300 > > From: Paul Irofti > > > > Hi, > > > > Here is a new iteration of the diff which includes support for MD high > > resolution clocks. Currently o

Re: userland clock_gettime proof of concept

2020-05-28 Thread Paul Irofti
On Thu, May 28, 2020 at 10:27:03PM +0300, Paul Irofti wrote: > > 5. What if the TSC is not available as a usable timecounter? In that > >case libc should fall back on the system call. But we need a way > >to communicate what the timecounter is and det

Re: userland clock_gettime proof of concept

2020-05-28 Thread Paul Irofti
> 5. What if the TSC is not available as a usable timecounter? In that >case libc should fall back on the system call. But we need a way >to communicate what the timecounter is and detect when we switch >timecounters. Maybe adding a timecounter ID to the page will help >here.

Re: userland clock_gettime proof of concept

2020-05-28 Thread Paul Irofti
Is the bump actually needed? Symbols.list is untouched so there's no change to the exported symbols. I am not sure if WRAP does not require it. Probably not. Otherwise as the diff stands now (always falling back to the syscall if timekeep is missing), I tend to agree with your statement :)

Re: userland clock_gettime proof of concept

2020-05-28 Thread Paul Irofti
/amd64/gen/rdtsc.c @@ -0,0 +1,26 @@ +/* $OpenBSD$ */ +/* + * Copyright (c) 2020 Paul Irofti + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice

Re: userland clock_gettime proof of concept

2020-05-23 Thread Paul Irofti
{CANCEL:=.o} clock_gettime.o PHIDDEN=${HIDDEN:.o=.po} SHIDDEN=${HIDDEN:.o=.so} DHIDDEN=${HIDDEN:.o=.do} diff --git lib/libc/sys/w_clock_gettime.c lib/libc/sys/w_clock_gettime.c new file mode 100644 index 000..7c2883c31fd --- /dev/null +++ lib/libc/sys/w_clock_gettime.c @@ -0,0 +1,64 @@ +/

Re: userland clock_gettime proof of concept

2020-05-22 Thread Paul Irofti
ork.o sigaction.o _ptrace.o ${CANCEL:=.o} clock_gettime.o PHIDDEN=${HIDDEN:.o=.po} SHIDDEN=${HIDDEN:.o=.so} DHIDDEN=${HIDDEN:.o=.do} diff --git lib/libc/sys/w_clock_gettime.c lib/libc/sys/w_clock_gettime.c new file mode 100644 index 000..858308e91c4 --- /dev/null +++ lib/libc/sys/w_

Re: userland clock_gettime proof of concept

2020-05-16 Thread Paul Irofti
{CANCEL:=.o} clock_gettime.o PHIDDEN=${HIDDEN:.o=.po} SHIDDEN=${HIDDEN:.o=.so} DHIDDEN=${HIDDEN:.o=.do} diff --git lib/libc/sys/w_clock_gettime.c lib/libc/sys/w_clock_gettime.c new file mode 100644 index 000..061dcd47dce --- /dev/null +++ lib/libc/sys/w_clock_gettime.c @@ -0,0 +1,109 @@

Re: userland clock_gettime proof of concept

2020-05-16 Thread Paul Irofti
> Hopefully this version also fixes the init bug solene@ was seeing. No according to robert@, sorry. I'll look into it more and get back with a fix.

Re: userland clock_gettime proof of concept

2020-05-15 Thread Paul Irofti
_clock_gettime.c lib/libc/sys/w_clock_gettime.c new file mode 100644 index 000..04850fbda32 --- /dev/null +++ lib/libc/sys/w_clock_gettime.c @@ -0,0 +1,109 @@ +/* $OpenBSD$ */ +/* + * Copyright (c) 2020 Paul Irofti + * + * Permission to use, copy, modify, and distribute this so

Re: userland clock_gettime proof of concept

2020-05-14 Thread Paul Irofti
Hi Solene, Robert is also seeing this on one of his systems. I am currently investigating this and will come back with a fix. Thank you for the report, Paul On 2020-05-14 12:31, Solene Rapenne wrote: Le Wed, 13 May 2020 17:03:01 +0300, Paul Irofti a écrit : Hi, By far one of the most

userland clock_gettime proof of concept

2020-05-13 Thread Paul Irofti
ib/libc/sys/w_clock_gettime.c new file mode 100644 index 000..e955615248f --- /dev/null +++ lib/libc/sys/w_clock_gettime.c @@ -0,0 +1,114 @@ +/* $OpenBSD$ */ +/* + * Copyright (c) 2020 Paul Irofti + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or

Re: fix wifi media: line during background scan

2020-04-07 Thread Paul Irofti
On Tue, Apr 07, 2020 at 01:42:48PM +0200, Stefan Sperling wrote: > I've noticed that wireless interfaces in 11n mode show a "media:" line > in ifconfig such as this while a background scan is in progress: > > media: IEEE802.11 autoselect (OFDM6) > > What is expected is a line showing active 11n

Re: split futex into three

2020-04-04 Thread Paul Irofti
Here is a proper diff (both sys and libc into one). diff --git lib/libc/Symbols.list lib/libc/Symbols.list index f9aa62ab6e8..4fa37a835aa 100644 --- lib/libc/Symbols.list +++ lib/libc/Symbols.list @@ -86,7 +86,10 @@ _thread_sys_fstatat _thread_sys_fstatfs _thread_sys_fsync

split futex into three

2020-04-04 Thread Paul Irofti
On Sat, Apr 04, 2020 at 03:53:50PM +0300, Paul Irofti wrote: > > The real problem is that futex(2) is actually 3 different syscalls wrapped > > into one. It was split into three then kdump could properly report > > futex_wake(2) and futex_requeue(2) as returning a count, while

Re: kdump futex fix

2020-04-04 Thread Paul Irofti
> The real problem is that futex(2) is actually 3 different syscalls wrapped > into one. It was split into three then kdump could properly report > futex_wake(2) and futex_requeue(2) as returning a count, while > futex_wait(2) returns an errno. The existing 'switch' in sys_futex() > would

debug packages: let strip do the stripping

2019-11-25 Thread Paul Irofti
Hi, Few people complained (hi landry@!) that stripped binaries are slightly larger now than they used to be when debug packages are enabled. My investigations show that this is because objcopy --strip-debug is less efficient than plain strip(1) which is what we use for non-debug packages.

Re: acpivout(4): fix brightness not going up

2019-11-25 Thread Paul Irofti
On Wed, Nov 20, 2019 at 05:44:35PM +0100, Patrick Wildt wrote: > On Sat, Nov 02, 2019 at 10:09:43PM -0400, James Hastings wrote: > > Hi, > > > > Backlight on multiple laptops will go down but not up when using brightness > > keys. > > Compare new brightness level to min/max values in sc_bcl[]

Re: misc. acpi(4): *sleep -> *sleep_nsec(9)

2019-11-25 Thread Paul Irofti
On Fri, Nov 22, 2019 at 06:08:34PM -0600, Scott Cheloha wrote: > The acpi_event_wait() loop is tricky. I'm leaving it alone for now. > > Everything else here is straightforward, though. The acpiec(4) sleep > is adjacent to a delay of 1 microsecond so I've chosen that to replace > the current

  1   2   3   4   >