From owner-freebsd-current Fri Aug 21 07:12:02 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id HAA09693 for freebsd-current-outgoing; Fri, 21 Aug 1998 07:12:02 -0700 (PDT) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from tim.xenologics.com (tim.xenologics.com [194.77.5.24]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id HAA09627 for ; Fri, 21 Aug 1998 07:11:44 -0700 (PDT) (envelope-from seggers@semyam.dinoco.de) Received: (from uucp@localhost) by tim.xenologics.com (8.8.5/8.8.8) with UUCP id QAA12126; Fri, 21 Aug 1998 16:06:49 +0200 (MET DST) Received: from semyam.dinoco.de (semyam.dinoco.de [127.0.0.1]) by semyam.dinoco.de (8.8.8/8.8.8) with ESMTP id KAA02477; Fri, 21 Aug 1998 10:36:22 +0200 (CEST) (envelope-from seggers@semyam.dinoco.de) Message-Id: <199808210836.KAA02477@semyam.dinoco.de> To: Brian Feldman Subject: Re: 13 months of user time? In-reply-to: Your message of "Thu, 20 Aug 1998 02:08:08 EDT." Cc: seggers@semyam.dinoco.de, freebsd-current@FreeBSD.ORG Date: Fri, 21 Aug 1998 10:36:20 +0200 From: Stefan Eggers Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > SIGXCPU kill problem could try putting the following in kern/kern_synch.c > line 638: I think better not this one as that is a safe way to a panic IMHO. A version I think does what you intend this to do I add below. It is untested code I just added while writing the mail. > if (switchtime.tv_usec < p->p_switchtime.tv_usec || > switchtime.tv_sec < p->p_switchtime.tv_sec) > panic("bogus microuptime twiddling"); > > And see if we get some nice panics and cores. Is it worth a shot? I've As far as I can see the timeval in the process structure is a real timeval and not abused to be something else. So tv_usec contains the micro seconds part and tv_sec the seconds. Let's assume that p->p_switchtime.tv_usec contains 999999 now and p->p_switchtime.tv_sec is 0. Lets suppose the time continues a little bit and when we reach the if statement switchtime.tv_usec might contain 0 and switchtime.tv_sec 1. The time didn't go backward but with the code above causes a panic. > never gotten a SIGXCPU out of place, so my machine wouldn't be the one to > test this on. And I don't think you want the test this way, anyway. ;-) One has first to calculate a 64 bit integer from the seconds and micro seconds and then compare the two resulting numbers. With that it could actually detect switchtime going backward. Something like this: int64_t time1, time2; [...] time1 = switchtime.tv_usec + switchtime.tv_sec * (int64_t)1000000; time2 = p->p_switchtime.tv_usec + p->p_switchtime.tv_sec * (int64_t)1000000; if (time1 < time2) panic("Ooops! Switchtime going backward!"); Stefan. -- Stefan Eggers Lu4 yao2 zhi1 ma3 li4, Max-Slevogt-Str. 1 ri4 jiu3 jian4 ren2 xin1. 51109 Koeln Federal Republic of Germany To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message