[DragonFlyBSD - Bug #2951] clock_gettime always repots 0 sec, 0 nsec
Issue #2951 has been updated by zhtw. swildner wrote: > CLOCK_THREAD_CPUTIME_ID isn't broken here, as far as I can see. Are you sure > it returns 0 for you? I'm sorry, didn't check it thoroughly. It indeed works with CLOCK_THREAD_CPUTIME_ID correctly. > CLOCK_PROF and CLOCK_VIRTUAL always return 0 here. Not sure what's the cause. > > Please check this patch for CLOCK_PROCESS_CPUTIME_ID -> > https://leaf.dragonflybsd.org/~swildner/process_cputime.diff > > Not sure if that's the best fix. Thank you for the patch. I was unable to use it as is because the kernel didn't compile: there is no field "ru" in the proc struct. (I tried 4.4 & 4.6 kernels, see below why). But after I renamed ru to p_ru it did compile. Unfortunately, I can't test it right now, because I only have remote access to both my machines (I'm on a conference now and will return only in 2 weeks). I'm trying to test it with vkernel, but for some reason it doesn't start (with or without your patch). The message I see is: a@hk:~/tmp$ sudo /var/vkernel/4.4/boot/kernel/kernel -m 2g -r root.img -d -p /var/tmp/vkernel.vhost-dev.pid Using memory file: /var/vkernel/memimg.00 KVM mapped at 0x80-0x100 Copyright (c) 2003-2015 The DragonFly Project. Copyright (c) 1992-2003 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. DragonFly v4.4.3.10.gfcff0-RELEASE #2: Wed Sep 21 14:47:58 CEST 2016 r...@hk.zta.lk:/usr/obj/usr/src/sys/VKERNEL64 real memory = 2147483648 (2097152K bytes) avail memory = 2044215296 (1996304K bytes) Fatal trap 12: page fault while in kernel mode cpuid = 0 fault virtual address = 0x9 fault code = supervisor read, page not present instruction pointer = 0x2b:0x6ea789 stack pointer = 0x10:0x7fffe9f0 frame pointer = 0x10:0x1 processor eflags= interrupt enabled, resume, IOPL = 0 current process = 0 () current thread = pri 12 <- SMP: XXX kernel: type 12 trap, code=0 CPU0 stopping CPUs: 0x stopped Stopped at 0x6ea789: movq0x8(%rbp),%rdi db> I'm trying 4.4 because I was never able to run 4.6 vkernel. 4.4 used to work, but I forgot which revision I compiled. I will file a separate bug report for this. Once I have physical access to my desktop I will try your patch again on the real kernel. Bug #2951: clock_gettime always repots 0 sec, 0 nsec http://bugs.dragonflybsd.org/issues/2951#change-12979 * Author: zhtw * Status: New * Priority: Normal * Assignee: * Category: * Target version: When called with CLOCK_PROF, clock_gettime always returns 0 sec, 0 nsec: $ uname -a DragonFly kl.zta.lk 4.6-RELEASE DragonFly v4.6.0.10.g16fba-RELEASE #10: Wed Aug 17 14:26:31 CEST 2016 r...@kl.zta.lk:/usr/obj/usr/src/sys/X86_64_GENERIC x86_64 $ cat time.c #include #include int main() { struct timespec ts; struct timespec *tp = &ts; for (int i = 0; i != 100; ++i) for (int j = 0; j != 1000; ++j) ; int err = clock_gettime(CLOCK_PROF, tp); printf("err: %d\n", err); printf("sec: %ld\n", ts.tv_sec); printf("nsec: %ld\n", ts.tv_nsec); } $ cc -pedantic -Wall time.c $ ./a.out err: 0 sec: 0 nsec: 0 The same program on a FreeBSD machine seems to work: $ uname -a FreeBSD fbsd 10.1-RELEASE FreeBSD 10.1-RELEASE #0 r274401: Tue Nov 11 21:02:49 UTC 2014 r...@releng1.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64 $ cc -pedantic -Wall time.c $ ./a.out err: 0 sec: 1 nsec: 604478000 -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account
[DragonFlyBSD - Bug #2952] (New) vkernel crashes during boot
Issue #2952 has been reported by zhtw. Bug #2952: vkernel crashes during boot http://bugs.dragonflybsd.org/issues/2952 * Author: zhtw * Status: New * Priority: Normal * Assignee: * Category: Kernel * Target version: Can't start vkernel no my 4.6 machine: a@kl:~$ uname -a DragonFly kl.zta.lk 4.6-RELEASE DragonFly v4.6.0.10.g16fba-RELEASE #10: Wed Aug 17 14:26:31 CEST 2016 r...@kl.zta.lk:/usr/obj/usr/src/sys/X86_64_GENERIC x86_64 @kl:~$ sudo /var/vkernel/4.6/boot/kernel/kernel -m 2g -r /vhost/dev/root.img -I auto:bridge0 -d -p /var/run/vkernel. vhost-dev.pid Wachtwoord: Using memory file: /var/vkernel/memimg.03 KVM mapped at 0x80-0x100 TAP UNIT 7 Copyright (c) 2003-2016 The DragonFly Project. Copyright (c) 1992-2003 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. DragonFly v4.6.0.20.ged336-RELEASE #16: Wed Sep 21 14:46:27 CEST 2016 r...@kl.zta.lk:/usr/obj/usr/src/sys/VKERNEL64 real memory = 2147483648 (2097152K bytes) avail memory = 2027917312 (1980388K bytes) Fatal trap 12: page fault while in kernel mode cpuid = 0 fault virtual address = 0x9 fault code = supervisor read, page not present instruction pointer = 0x2b:0x6ef9b9 stack pointer = 0x10:0x7fffe6f0 frame pointer = 0x10:0x1 processor eflags= interrupt enabled, resume, IOPL = 0 current process = 0 () current thread = pri 12 <- SMP: XXX kernel: type 12 trap, code=0 CPU0 stopping CPUs: 0x stopped Stopped at 0x6ef9b9: movq0x8(%rbp),%rdi db> Interestingly, I was able to start the 4.4 vkernel some time ago, but I recently recompiled it and it started to crash the same way 4.6 does. I still have access to my working 4.4 vkernel, but don't know what to compare to see the difference. -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account
[DragonFlyBSD - Bug #2952] (Feedback) vkernel crashes during boot
Issue #2952 has been updated by tuxillo. Category changed from Kernel to vkernel Status changed from New to Feedback Assignee set to tuxillo Hi, Can you boot it with -v to see if we get a better idea where it might be crashing? Also, can you 'addr2line -f -e /var/vkernel/4.6/boot/kernel/kernel 0x6ef9b9 ' ? As a final test, would you be able to cherry-pick this commits and build the vkernel to see if it works? 4dd1b99459f58c096edd1945eb144cf12006d85a 57cbfb93d182ba7966c918d24df413bf77f7e459 Best regards, Antonio Huete Bug #2952: vkernel crashes during boot http://bugs.dragonflybsd.org/issues/2952#change-12980 * Author: zhtw * Status: Feedback * Priority: Normal * Assignee: tuxillo * Category: vkernel * Target version: Can't start vkernel no my 4.6 machine: a@kl:~$ uname -a DragonFly kl.zta.lk 4.6-RELEASE DragonFly v4.6.0.10.g16fba-RELEASE #10: Wed Aug 17 14:26:31 CEST 2016 r...@kl.zta.lk:/usr/obj/usr/src/sys/X86_64_GENERIC x86_64 @kl:~$ sudo /var/vkernel/4.6/boot/kernel/kernel -m 2g -r /vhost/dev/root.img -I auto:bridge0 -d -p /var/run/vkernel. vhost-dev.pid Wachtwoord: Using memory file: /var/vkernel/memimg.03 KVM mapped at 0x80-0x100 TAP UNIT 7 Copyright (c) 2003-2016 The DragonFly Project. Copyright (c) 1992-2003 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. DragonFly v4.6.0.20.ged336-RELEASE #16: Wed Sep 21 14:46:27 CEST 2016 r...@kl.zta.lk:/usr/obj/usr/src/sys/VKERNEL64 real memory = 2147483648 (2097152K bytes) avail memory = 2027917312 (1980388K bytes) Fatal trap 12: page fault while in kernel mode cpuid = 0 fault virtual address = 0x9 fault code = supervisor read, page not present instruction pointer = 0x2b:0x6ef9b9 stack pointer = 0x10:0x7fffe6f0 frame pointer = 0x10:0x1 processor eflags= interrupt enabled, resume, IOPL = 0 current process = 0 () current thread = pri 12 <- SMP: XXX kernel: type 12 trap, code=0 CPU0 stopping CPUs: 0x stopped Stopped at 0x6ef9b9: movq0x8(%rbp),%rdi db> Interestingly, I was able to start the 4.4 vkernel some time ago, but I recently recompiled it and it started to crash the same way 4.6 does. I still have access to my working 4.4 vkernel, but don't know what to compare to see the difference. -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account
[DragonFlyBSD - Bug #2952] vkernel crashes during boot
Issue #2952 has been updated by zhtw. Only now I noticed that I compiled it with CONFIGARGS=-p option. After I removed the option, 4.4 vkernel started to work. 4.6 however now hangs: a@kl:~$ sudo /var/vkernel/4.6/boot/kernel/kernel -m 2g -r /vhost/dev/root.img -I auto:bridge0 -d -p /var/run/vkernel. vhost-dev.pid Wachtwoord: Using memory file: /var/vkernel/memimg.03 KVM mapped at 0x80-0x100 TAP UNIT 7 Copyright (c) 2003-2016 The DragonFly Project. Copyright (c) 1992-2003 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. DragonFly v4.6.0.20.ged336-RELEASE #17: Wed Sep 21 15:29:59 CEST 2016 r...@kl.zta.lk:/usr/obj/usr/src/sys/VKERNEL64 real memory = 2147483648 (2097152K bytes) avail memory = 2027917312 (1980388K bytes) DragonFly/MP: Multiprocessor cpu0 (BSP) cpu1 (AP) Initialize MI interrupts initclocks SMP: AP CPU #1 Launched! I will recompile it with -p again and do what you just asked. (Thanks for such a quick response.) Bug #2952: vkernel crashes during boot http://bugs.dragonflybsd.org/issues/2952#change-12981 * Author: zhtw * Status: Feedback * Priority: Normal * Assignee: tuxillo * Category: vkernel * Target version: Can't start vkernel no my 4.6 machine: a@kl:~$ uname -a DragonFly kl.zta.lk 4.6-RELEASE DragonFly v4.6.0.10.g16fba-RELEASE #10: Wed Aug 17 14:26:31 CEST 2016 r...@kl.zta.lk:/usr/obj/usr/src/sys/X86_64_GENERIC x86_64 @kl:~$ sudo /var/vkernel/4.6/boot/kernel/kernel -m 2g -r /vhost/dev/root.img -I auto:bridge0 -d -p /var/run/vkernel. vhost-dev.pid Wachtwoord: Using memory file: /var/vkernel/memimg.03 KVM mapped at 0x80-0x100 TAP UNIT 7 Copyright (c) 2003-2016 The DragonFly Project. Copyright (c) 1992-2003 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. DragonFly v4.6.0.20.ged336-RELEASE #16: Wed Sep 21 14:46:27 CEST 2016 r...@kl.zta.lk:/usr/obj/usr/src/sys/VKERNEL64 real memory = 2147483648 (2097152K bytes) avail memory = 2027917312 (1980388K bytes) Fatal trap 12: page fault while in kernel mode cpuid = 0 fault virtual address = 0x9 fault code = supervisor read, page not present instruction pointer = 0x2b:0x6ef9b9 stack pointer = 0x10:0x7fffe6f0 frame pointer = 0x10:0x1 processor eflags= interrupt enabled, resume, IOPL = 0 current process = 0 () current thread = pri 12 <- SMP: XXX kernel: type 12 trap, code=0 CPU0 stopping CPUs: 0x stopped Stopped at 0x6ef9b9: movq0x8(%rbp),%rdi db> Interestingly, I was able to start the 4.4 vkernel some time ago, but I recently recompiled it and it started to crash the same way 4.6 does. I still have access to my working 4.4 vkernel, but don't know what to compare to see the difference. -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account
[DragonFlyBSD - Bug #2952] vkernel crashes during boot
Issue #2952 has been updated by tuxillo. Hi, If vkernel 4.6 hangs there you have to cherry-pick the commits I mentioned. Let me know how it works for you. Cheers, Antonio Huete Bug #2952: vkernel crashes during boot http://bugs.dragonflybsd.org/issues/2952#change-12982 * Author: zhtw * Status: Feedback * Priority: Normal * Assignee: tuxillo * Category: vkernel * Target version: Can't start vkernel no my 4.6 machine: a@kl:~$ uname -a DragonFly kl.zta.lk 4.6-RELEASE DragonFly v4.6.0.10.g16fba-RELEASE #10: Wed Aug 17 14:26:31 CEST 2016 r...@kl.zta.lk:/usr/obj/usr/src/sys/X86_64_GENERIC x86_64 @kl:~$ sudo /var/vkernel/4.6/boot/kernel/kernel -m 2g -r /vhost/dev/root.img -I auto:bridge0 -d -p /var/run/vkernel. vhost-dev.pid Wachtwoord: Using memory file: /var/vkernel/memimg.03 KVM mapped at 0x80-0x100 TAP UNIT 7 Copyright (c) 2003-2016 The DragonFly Project. Copyright (c) 1992-2003 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. DragonFly v4.6.0.20.ged336-RELEASE #16: Wed Sep 21 14:46:27 CEST 2016 r...@kl.zta.lk:/usr/obj/usr/src/sys/VKERNEL64 real memory = 2147483648 (2097152K bytes) avail memory = 2027917312 (1980388K bytes) Fatal trap 12: page fault while in kernel mode cpuid = 0 fault virtual address = 0x9 fault code = supervisor read, page not present instruction pointer = 0x2b:0x6ef9b9 stack pointer = 0x10:0x7fffe6f0 frame pointer = 0x10:0x1 processor eflags= interrupt enabled, resume, IOPL = 0 current process = 0 () current thread = pri 12 <- SMP: XXX kernel: type 12 trap, code=0 CPU0 stopping CPUs: 0x stopped Stopped at 0x6ef9b9: movq0x8(%rbp),%rdi db> Interestingly, I was able to start the 4.4 vkernel some time ago, but I recently recompiled it and it started to crash the same way 4.6 does. I still have access to my working 4.4 vkernel, but don't know what to compare to see the difference. -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account
[DragonFlyBSD - Bug #2951] clock_gettime always repots 0 sec, 0 nsec
Issue #2951 has been updated by zhtw. I was able to run 4.4 vkernel with your patch (but with ru replaced with p_ru). Unfortunately it did not help, I still see 0 nsec both in case of CLOCK_PROCESS_CPUTIME_ID and CLOCK_PROF. (Still can't run 4.6 vkernel.) Bug #2951: clock_gettime always repots 0 sec, 0 nsec http://bugs.dragonflybsd.org/issues/2951#change-12983 * Author: zhtw * Status: New * Priority: Normal * Assignee: * Category: * Target version: When called with CLOCK_PROF, clock_gettime always returns 0 sec, 0 nsec: $ uname -a DragonFly kl.zta.lk 4.6-RELEASE DragonFly v4.6.0.10.g16fba-RELEASE #10: Wed Aug 17 14:26:31 CEST 2016 r...@kl.zta.lk:/usr/obj/usr/src/sys/X86_64_GENERIC x86_64 $ cat time.c #include #include int main() { struct timespec ts; struct timespec *tp = &ts; for (int i = 0; i != 100; ++i) for (int j = 0; j != 1000; ++j) ; int err = clock_gettime(CLOCK_PROF, tp); printf("err: %d\n", err); printf("sec: %ld\n", ts.tv_sec); printf("nsec: %ld\n", ts.tv_nsec); } $ cc -pedantic -Wall time.c $ ./a.out err: 0 sec: 0 nsec: 0 The same program on a FreeBSD machine seems to work: $ uname -a FreeBSD fbsd 10.1-RELEASE FreeBSD 10.1-RELEASE #0 r274401: Tue Nov 11 21:02:49 UTC 2014 r...@releng1.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64 $ cc -pedantic -Wall time.c $ ./a.out err: 0 sec: 1 nsec: 604478000 -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account
[DragonFlyBSD - Bug #2952] vkernel crashes during boot
Issue #2952 has been updated by zhtw. Booting with -v gives exactly the same output. addr2line doesn't seem to recognize the line: a@kl:/usr/src$ sudo addr2line -f -e /var/vkernel/4.6-p/boot/kernel/kernel 0x6ef9b9 .mcount ??:? After cherry-picking the two commits it still doesn't work, but addr2line shows something different: a@kl:/usr/src$ sudo addr2line -f -e /var/vkernel/4.6-p-cherry/boot/kernel/kernel 0x6ef9b9 time ??:? But could you check if I did everything right (I don't have much experience in all this): a@kl:/usr/src$ git branch DragonFly_RELEASE_3_8 DragonFly_RELEASE_4_0 DragonFly_RELEASE_4_2 DragonFly_RELEASE_4_4 * DragonFly_RELEASE_4_6 master a@kl:/usr/src$ git status | head -n 2 On branch DragonFly_RELEASE_4_6 Your branch is ahead of 'origin/DragonFly_RELEASE_4_6' by 2 commits. a@kl:/usr/src$ git log -n 2 commit 49c5ab8692483d2ec472789f02823714859a81ba Author: Antonio Huete Jimenez Date: Wed Sep 21 01:31:58 2016 +0200 vkernel - Invalidate pte before setting attributes to the vm_page - Fixes a problem at mountroot time where it doesn't find any disk even though the disk is detected earlier. commit 2ea5d46f3046bdaa05c13c93f357b16170c14461 Author: Antonio Huete Jimenez Date: Wed Sep 21 00:03:05 2016 +0200 vkernel - Fix a vkernel lockup on startup - During ap_init() any pending IPIs is processed manually so clear gd_npoll as the real kernel does. - Do not disable interrupts for vkernels during lwkt_send_ipiq3() because they don't seem to be re-enabled afterwards as they should. I'm not entirely sure this is the right fix, more investigation is required. Build command was: make -DNO_MODULES CONFIGARGS=-p buildkernel KERNCONF=VKERNEL64 -j 4 Install command: make -DNO_MODULES installkernel CONFIGARGS=-p KERNCONF=VKERNEL64 DESTDIR=/var/vkernel/4.6-p-cherry So this all was with CONFIGARGS=-p. But when compiled without it, it started to work. Thanks! Bug #2952: vkernel crashes during boot http://bugs.dragonflybsd.org/issues/2952#change-12984 * Author: zhtw * Status: Feedback * Priority: Normal * Assignee: tuxillo * Category: vkernel * Target version: Can't start vkernel no my 4.6 machine: a@kl:~$ uname -a DragonFly kl.zta.lk 4.6-RELEASE DragonFly v4.6.0.10.g16fba-RELEASE #10: Wed Aug 17 14:26:31 CEST 2016 r...@kl.zta.lk:/usr/obj/usr/src/sys/X86_64_GENERIC x86_64 @kl:~$ sudo /var/vkernel/4.6/boot/kernel/kernel -m 2g -r /vhost/dev/root.img -I auto:bridge0 -d -p /var/run/vkernel. vhost-dev.pid Wachtwoord: Using memory file: /var/vkernel/memimg.03 KVM mapped at 0x80-0x100 TAP UNIT 7 Copyright (c) 2003-2016 The DragonFly Project. Copyright (c) 1992-2003 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. DragonFly v4.6.0.20.ged336-RELEASE #16: Wed Sep 21 14:46:27 CEST 2016 r...@kl.zta.lk:/usr/obj/usr/src/sys/VKERNEL64 real memory = 2147483648 (2097152K bytes) avail memory = 2027917312 (1980388K bytes) Fatal trap 12: page fault while in kernel mode cpuid = 0 fault virtual address = 0x9 fault code = supervisor read, page not present instruction pointer = 0x2b:0x6ef9b9 stack pointer = 0x10:0x7fffe6f0 frame pointer = 0x10:0x1 processor eflags= interrupt enabled, resume, IOPL = 0 current process = 0 () current thread = pri 12 <- SMP: XXX kernel: type 12 trap, code=0 CPU0 stopping CPUs: 0x stopped Stopped at 0x6ef9b9: movq0x8(%rbp),%rdi db> Interestingly, I was able to start the 4.4 vkernel some time ago, but I recently recompiled it and it started to crash the same way 4.6 does. I still have access to my working 4.4 vkernel, but don't know what to compare to see the difference. -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account
[DragonFlyBSD - Bug #2952] vkernel crashes during boot
Issue #2952 has been updated by zhtw. Just to be clear, the summary: When compiled with CONFIGARGS=-p, neither 4.4 nor 4.6 work -- both crash. When compiled without this option, 4.4 works, but 4.6 hangs. After cherry-picking: Without CONFIGARGS=-p 4.6 works. With it it still crashes. Anyway, my problem is solved. Thank you so much! Bug #2952: vkernel crashes during boot http://bugs.dragonflybsd.org/issues/2952#change-12985 * Author: zhtw * Status: Feedback * Priority: Normal * Assignee: tuxillo * Category: vkernel * Target version: Can't start vkernel no my 4.6 machine: a@kl:~$ uname -a DragonFly kl.zta.lk 4.6-RELEASE DragonFly v4.6.0.10.g16fba-RELEASE #10: Wed Aug 17 14:26:31 CEST 2016 r...@kl.zta.lk:/usr/obj/usr/src/sys/X86_64_GENERIC x86_64 @kl:~$ sudo /var/vkernel/4.6/boot/kernel/kernel -m 2g -r /vhost/dev/root.img -I auto:bridge0 -d -p /var/run/vkernel. vhost-dev.pid Wachtwoord: Using memory file: /var/vkernel/memimg.03 KVM mapped at 0x80-0x100 TAP UNIT 7 Copyright (c) 2003-2016 The DragonFly Project. Copyright (c) 1992-2003 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. DragonFly v4.6.0.20.ged336-RELEASE #16: Wed Sep 21 14:46:27 CEST 2016 r...@kl.zta.lk:/usr/obj/usr/src/sys/VKERNEL64 real memory = 2147483648 (2097152K bytes) avail memory = 2027917312 (1980388K bytes) Fatal trap 12: page fault while in kernel mode cpuid = 0 fault virtual address = 0x9 fault code = supervisor read, page not present instruction pointer = 0x2b:0x6ef9b9 stack pointer = 0x10:0x7fffe6f0 frame pointer = 0x10:0x1 processor eflags= interrupt enabled, resume, IOPL = 0 current process = 0 () current thread = pri 12 <- SMP: XXX kernel: type 12 trap, code=0 CPU0 stopping CPUs: 0x stopped Stopped at 0x6ef9b9: movq0x8(%rbp),%rdi db> Interestingly, I was able to start the 4.4 vkernel some time ago, but I recently recompiled it and it started to crash the same way 4.6 does. I still have access to my working 4.4 vkernel, but don't know what to compare to see the difference. -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account
[DragonFlyBSD - Bug #2951] clock_gettime always repots 0 sec, 0 nsec
Issue #2951 has been updated by zhtw. Antonio Huete (tuxillo) just gave me the fix for 4.6 vkernel. Still no luck, CLOCK_PROCESS_CPUTIME_ID returns 0. Bug #2951: clock_gettime always repots 0 sec, 0 nsec http://bugs.dragonflybsd.org/issues/2951#change-12986 * Author: zhtw * Status: New * Priority: Normal * Assignee: * Category: * Target version: When called with CLOCK_PROF, clock_gettime always returns 0 sec, 0 nsec: $ uname -a DragonFly kl.zta.lk 4.6-RELEASE DragonFly v4.6.0.10.g16fba-RELEASE #10: Wed Aug 17 14:26:31 CEST 2016 r...@kl.zta.lk:/usr/obj/usr/src/sys/X86_64_GENERIC x86_64 $ cat time.c #include #include int main() { struct timespec ts; struct timespec *tp = &ts; for (int i = 0; i != 100; ++i) for (int j = 0; j != 1000; ++j) ; int err = clock_gettime(CLOCK_PROF, tp); printf("err: %d\n", err); printf("sec: %ld\n", ts.tv_sec); printf("nsec: %ld\n", ts.tv_nsec); } $ cc -pedantic -Wall time.c $ ./a.out err: 0 sec: 0 nsec: 0 The same program on a FreeBSD machine seems to work: $ uname -a FreeBSD fbsd 10.1-RELEASE FreeBSD 10.1-RELEASE #0 r274401: Tue Nov 11 21:02:49 UTC 2014 r...@releng1.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64 $ cc -pedantic -Wall time.c $ ./a.out err: 0 sec: 1 nsec: 604478000 -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account
[DragonFlyBSD - Bug #2951] clock_gettime always repots 0 sec, 0 nsec
Issue #2951 has been updated by swildner. Yes, my bad, sorry. I messed up the patch with some last minute changes which I didn't test properly. Please remove the changes to kern_time.c in your tree and apply this diff instead -> https://leaf.dragonflybsd.org/~swildner/process_cputime2.diff I've tested it and it seems to work here. It will only fix CLOCK_PROCESS_CPUTIME_ID. Bug #2951: clock_gettime always repots 0 sec, 0 nsec http://bugs.dragonflybsd.org/issues/2951#change-12987 * Author: zhtw * Status: New * Priority: Normal * Assignee: * Category: * Target version: When called with CLOCK_PROF, clock_gettime always returns 0 sec, 0 nsec: $ uname -a DragonFly kl.zta.lk 4.6-RELEASE DragonFly v4.6.0.10.g16fba-RELEASE #10: Wed Aug 17 14:26:31 CEST 2016 r...@kl.zta.lk:/usr/obj/usr/src/sys/X86_64_GENERIC x86_64 $ cat time.c #include #include int main() { struct timespec ts; struct timespec *tp = &ts; for (int i = 0; i != 100; ++i) for (int j = 0; j != 1000; ++j) ; int err = clock_gettime(CLOCK_PROF, tp); printf("err: %d\n", err); printf("sec: %ld\n", ts.tv_sec); printf("nsec: %ld\n", ts.tv_nsec); } $ cc -pedantic -Wall time.c $ ./a.out err: 0 sec: 0 nsec: 0 The same program on a FreeBSD machine seems to work: $ uname -a FreeBSD fbsd 10.1-RELEASE FreeBSD 10.1-RELEASE #0 r274401: Tue Nov 11 21:02:49 UTC 2014 r...@releng1.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64 $ cc -pedantic -Wall time.c $ ./a.out err: 0 sec: 1 nsec: 604478000 -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account
[DragonFlyBSD - Bug #2951] clock_gettime always repots 0 sec, 0 nsec
Issue #2951 has been updated by zhtw. Thank you. Just tried it. The result is still 0. But again, I'm testing in under a vkernel. Did you test it on a real kernel? Is there anything I could do wrong here? Bug #2951: clock_gettime always repots 0 sec, 0 nsec http://bugs.dragonflybsd.org/issues/2951#change-12988 * Author: zhtw * Status: New * Priority: Normal * Assignee: * Category: * Target version: When called with CLOCK_PROF, clock_gettime always returns 0 sec, 0 nsec: $ uname -a DragonFly kl.zta.lk 4.6-RELEASE DragonFly v4.6.0.10.g16fba-RELEASE #10: Wed Aug 17 14:26:31 CEST 2016 r...@kl.zta.lk:/usr/obj/usr/src/sys/X86_64_GENERIC x86_64 $ cat time.c #include #include int main() { struct timespec ts; struct timespec *tp = &ts; for (int i = 0; i != 100; ++i) for (int j = 0; j != 1000; ++j) ; int err = clock_gettime(CLOCK_PROF, tp); printf("err: %d\n", err); printf("sec: %ld\n", ts.tv_sec); printf("nsec: %ld\n", ts.tv_nsec); } $ cc -pedantic -Wall time.c $ ./a.out err: 0 sec: 0 nsec: 0 The same program on a FreeBSD machine seems to work: $ uname -a FreeBSD fbsd 10.1-RELEASE FreeBSD 10.1-RELEASE #0 r274401: Tue Nov 11 21:02:49 UTC 2014 r...@releng1.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64 $ cc -pedantic -Wall time.c $ ./a.out err: 0 sec: 1 nsec: 604478000 -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account
[DragonFlyBSD - Bug #2951] clock_gettime always repots 0 sec, 0 nsec
Issue #2951 has been updated by swildner. Yeah I tested on a real kernel. Bug #2951: clock_gettime always repots 0 sec, 0 nsec http://bugs.dragonflybsd.org/issues/2951#change-12989 * Author: zhtw * Status: New * Priority: Normal * Assignee: * Category: * Target version: When called with CLOCK_PROF, clock_gettime always returns 0 sec, 0 nsec: $ uname -a DragonFly kl.zta.lk 4.6-RELEASE DragonFly v4.6.0.10.g16fba-RELEASE #10: Wed Aug 17 14:26:31 CEST 2016 r...@kl.zta.lk:/usr/obj/usr/src/sys/X86_64_GENERIC x86_64 $ cat time.c #include #include int main() { struct timespec ts; struct timespec *tp = &ts; for (int i = 0; i != 100; ++i) for (int j = 0; j != 1000; ++j) ; int err = clock_gettime(CLOCK_PROF, tp); printf("err: %d\n", err); printf("sec: %ld\n", ts.tv_sec); printf("nsec: %ld\n", ts.tv_nsec); } $ cc -pedantic -Wall time.c $ ./a.out err: 0 sec: 0 nsec: 0 The same program on a FreeBSD machine seems to work: $ uname -a FreeBSD fbsd 10.1-RELEASE FreeBSD 10.1-RELEASE #0 r274401: Tue Nov 11 21:02:49 UTC 2014 r...@releng1.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64 $ cc -pedantic -Wall time.c $ ./a.out err: 0 sec: 1 nsec: 604478000 -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account
[DragonFlyBSD - Bug #2951] clock_gettime always repots 0 sec, 0 nsec
Issue #2951 has been updated by zhtw. This is interesting. When you asked me to doublecheck if clock_gettime works with CLOCK_THREAD_CPUTIME_ID (because you said it works for you), I actually tested it on real kernel. So it does work on real kernel. But now I'm proceeding with testing ChezScheme (this is how I originally found the bug) on a vkernel, I found out again that it clock_gettime doesn't really work even with CLOCK_THREAD_CPUTIME_ID. It always returns 0 as I reported. So this there is definitely a bug. Also, when I proceeded testing ChezScheme, I found another bug, also in clock_gettime, but this time it's present in the real kernel: turned out clock_gettime can return nsec greater than one million: a@kl:~/tmp$ cat t.c #include #include void busywait() { for (int i = 0; i != 100; ++i) for (int j = 0; j != 10; ++j) ; } int main() { struct timespec ts; for (int i = 0; i != 1000; ++i) { busywait(); int err = clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts); if (err) { printf("err: %d\n", err); return 1; } if (ts.tv_nsec > 10) { printf("fatal! nsec = %ld\n", ts.tv_nsec); return 1; } } } a@kl:~/tmp$ cc t.c a@kl:~/tmp$ ./a.out fatal! nsec = 1007424000 Should I create a separate ticket for this? Bug #2951: clock_gettime always repots 0 sec, 0 nsec http://bugs.dragonflybsd.org/issues/2951#change-12990 * Author: zhtw * Status: New * Priority: Normal * Assignee: * Category: * Target version: When called with CLOCK_PROF, clock_gettime always returns 0 sec, 0 nsec: $ uname -a DragonFly kl.zta.lk 4.6-RELEASE DragonFly v4.6.0.10.g16fba-RELEASE #10: Wed Aug 17 14:26:31 CEST 2016 r...@kl.zta.lk:/usr/obj/usr/src/sys/X86_64_GENERIC x86_64 $ cat time.c #include #include int main() { struct timespec ts; struct timespec *tp = &ts; for (int i = 0; i != 100; ++i) for (int j = 0; j != 1000; ++j) ; int err = clock_gettime(CLOCK_PROF, tp); printf("err: %d\n", err); printf("sec: %ld\n", ts.tv_sec); printf("nsec: %ld\n", ts.tv_nsec); } $ cc -pedantic -Wall time.c $ ./a.out err: 0 sec: 0 nsec: 0 The same program on a FreeBSD machine seems to work: $ uname -a FreeBSD fbsd 10.1-RELEASE FreeBSD 10.1-RELEASE #0 r274401: Tue Nov 11 21:02:49 UTC 2014 r...@releng1.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64 $ cc -pedantic -Wall time.c $ ./a.out err: 0 sec: 1 nsec: 604478000 -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account
[DragonFlyBSD - Bug #2951] clock_gettime always repots 0 sec, 0 nsec
Issue #2951 has been updated by zhtw. When I said million, I of course meant billion. But the example is correct anyway. I am also looking at the code, but my experience with kernel programming is nearly non-existing. Bug #2951: clock_gettime always repots 0 sec, 0 nsec http://bugs.dragonflybsd.org/issues/2951#change-12991 * Author: zhtw * Status: New * Priority: Normal * Assignee: * Category: * Target version: When called with CLOCK_PROF, clock_gettime always returns 0 sec, 0 nsec: $ uname -a DragonFly kl.zta.lk 4.6-RELEASE DragonFly v4.6.0.10.g16fba-RELEASE #10: Wed Aug 17 14:26:31 CEST 2016 r...@kl.zta.lk:/usr/obj/usr/src/sys/X86_64_GENERIC x86_64 $ cat time.c #include #include int main() { struct timespec ts; struct timespec *tp = &ts; for (int i = 0; i != 100; ++i) for (int j = 0; j != 1000; ++j) ; int err = clock_gettime(CLOCK_PROF, tp); printf("err: %d\n", err); printf("sec: %ld\n", ts.tv_sec); printf("nsec: %ld\n", ts.tv_nsec); } $ cc -pedantic -Wall time.c $ ./a.out err: 0 sec: 0 nsec: 0 The same program on a FreeBSD machine seems to work: $ uname -a FreeBSD fbsd 10.1-RELEASE FreeBSD 10.1-RELEASE #0 r274401: Tue Nov 11 21:02:49 UTC 2014 r...@releng1.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64 $ cc -pedantic -Wall time.c $ ./a.out err: 0 sec: 1 nsec: 604478000 -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account
[DragonFlyBSD - Bug #2951] clock_gettime always repots 0 sec, 0 nsec
Issue #2951 has been updated by swildner. Yes, get_curthread_cputime() was wrongly adding so that tv_nsec could become >= 10. Please check https://leaf.dragonflybsd.org/~swildner/process_cputime3.diff on a real kernel. I've not yet looked at the vkernel issues. This patch adds a fix for the overflow issue, using timespecadd() now. It also fixes clock_getres() for CLOCK_{PROCESS,THREAD}_CPUTIME_ID. Bug #2951: clock_gettime always repots 0 sec, 0 nsec http://bugs.dragonflybsd.org/issues/2951#change-12992 * Author: zhtw * Status: New * Priority: Normal * Assignee: * Category: * Target version: When called with CLOCK_PROF, clock_gettime always returns 0 sec, 0 nsec: $ uname -a DragonFly kl.zta.lk 4.6-RELEASE DragonFly v4.6.0.10.g16fba-RELEASE #10: Wed Aug 17 14:26:31 CEST 2016 r...@kl.zta.lk:/usr/obj/usr/src/sys/X86_64_GENERIC x86_64 $ cat time.c #include #include int main() { struct timespec ts; struct timespec *tp = &ts; for (int i = 0; i != 100; ++i) for (int j = 0; j != 1000; ++j) ; int err = clock_gettime(CLOCK_PROF, tp); printf("err: %d\n", err); printf("sec: %ld\n", ts.tv_sec); printf("nsec: %ld\n", ts.tv_nsec); } $ cc -pedantic -Wall time.c $ ./a.out err: 0 sec: 0 nsec: 0 The same program on a FreeBSD machine seems to work: $ uname -a FreeBSD fbsd 10.1-RELEASE FreeBSD 10.1-RELEASE #0 r274401: Tue Nov 11 21:02:49 UTC 2014 r...@releng1.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64 $ cc -pedantic -Wall time.c $ ./a.out err: 0 sec: 1 nsec: 604478000 -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account
[DragonFlyBSD - Bug #2951] clock_gettime always repots 0 sec, 0 nsec
Issue #2951 has been updated by swildner. Sorry, there was one more typo in the overflow fix, fixed in https://leaf.dragonflybsd.org/~swildner/process_cputime4.diff Bug #2951: clock_gettime always repots 0 sec, 0 nsec http://bugs.dragonflybsd.org/issues/2951#change-12993 * Author: zhtw * Status: New * Priority: Normal * Assignee: * Category: * Target version: When called with CLOCK_PROF, clock_gettime always returns 0 sec, 0 nsec: $ uname -a DragonFly kl.zta.lk 4.6-RELEASE DragonFly v4.6.0.10.g16fba-RELEASE #10: Wed Aug 17 14:26:31 CEST 2016 r...@kl.zta.lk:/usr/obj/usr/src/sys/X86_64_GENERIC x86_64 $ cat time.c #include #include int main() { struct timespec ts; struct timespec *tp = &ts; for (int i = 0; i != 100; ++i) for (int j = 0; j != 1000; ++j) ; int err = clock_gettime(CLOCK_PROF, tp); printf("err: %d\n", err); printf("sec: %ld\n", ts.tv_sec); printf("nsec: %ld\n", ts.tv_nsec); } $ cc -pedantic -Wall time.c $ ./a.out err: 0 sec: 0 nsec: 0 The same program on a FreeBSD machine seems to work: $ uname -a FreeBSD fbsd 10.1-RELEASE FreeBSD 10.1-RELEASE #0 r274401: Tue Nov 11 21:02:49 UTC 2014 r...@releng1.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64 $ cc -pedantic -Wall time.c $ ./a.out err: 0 sec: 1 nsec: 604478000 -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account
[DragonFlyBSD - Bug #2951] clock_gettime always repots 0 sec, 0 nsec
Issue #2951 has been updated by zhtw. Thanks! It should definitely solve the problem with the nsec overflow. But turned out I was very lucky with this test, because can't reproduce the overflow anymore. But I still have this chezscheme test that fails. In any case, I will be able to confirm that the bug is fixed only in a few days when I have access to the real machine. But thanks for your help anyway! I appreciate it. Bug #2951: clock_gettime always repots 0 sec, 0 nsec http://bugs.dragonflybsd.org/issues/2951#change-12994 * Author: zhtw * Status: New * Priority: Normal * Assignee: * Category: * Target version: When called with CLOCK_PROF, clock_gettime always returns 0 sec, 0 nsec: $ uname -a DragonFly kl.zta.lk 4.6-RELEASE DragonFly v4.6.0.10.g16fba-RELEASE #10: Wed Aug 17 14:26:31 CEST 2016 r...@kl.zta.lk:/usr/obj/usr/src/sys/X86_64_GENERIC x86_64 $ cat time.c #include #include int main() { struct timespec ts; struct timespec *tp = &ts; for (int i = 0; i != 100; ++i) for (int j = 0; j != 1000; ++j) ; int err = clock_gettime(CLOCK_PROF, tp); printf("err: %d\n", err); printf("sec: %ld\n", ts.tv_sec); printf("nsec: %ld\n", ts.tv_nsec); } $ cc -pedantic -Wall time.c $ ./a.out err: 0 sec: 0 nsec: 0 The same program on a FreeBSD machine seems to work: $ uname -a FreeBSD fbsd 10.1-RELEASE FreeBSD 10.1-RELEASE #0 r274401: Tue Nov 11 21:02:49 UTC 2014 r...@releng1.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64 $ cc -pedantic -Wall time.c $ ./a.out err: 0 sec: 1 nsec: 604478000 -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account