lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 09 Oct 2008 12:54:22 -0500
From:	Dave Kleikamp <shaggy@...ux.vnet.ibm.com>
To:	Ingo Molnar <mingo@...e.hu>
Cc:	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Jeremy Fitzhardinge <jeremy@...p.org>,
	Steven Rostedt <srostedt@...hat.com>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] sched_clock: prevent scd->clock from moving backwards

On Thu, 2008-10-09 at 17:17 +0200, Ingo Molnar wrote:

> hm, -tip testing found a sporadic hard lockup during bootup, and i've 
> bisected it back to this patch. They happened on 64-bit test-systems. 
> I've attached the .config that produced the problem.
> 
> i reverted the patch and the lockups went away. But i cannot see what's 
> wrong with it ...

I could have sworn I ran with the patch, but maybe I got my patch queue
messed up and never tested it right.

I think I see the problem.

--- a/kernel/sched_clock.c
+++ b/kernel/sched_clock.c
@@ -118,13 +118,13 @@ static u64 __update_sched_clock(struct
sched_clock_data *scd, u64 now)
 
        /*
         * scd->clock = clamp(scd->tick_gtod + delta,
-        *                    max(scd->tick_gtod, scd->clock),
-        *                    scd->tick_gtod + TICK_NSEC);
+        *                    max(scd->tick_gtod, scd->clock),
+        *                    min(scd->clock, scd->tick_gtod +
TICK_NSEC));
         */
 
        clock = scd->tick_gtod + delta;
        min_clock = wrap_max(scd->tick_gtod, scd->clock);
-       max_clock = scd->tick_gtod + TICK_NSEC;
+       max_clock = wrap_min(scd->clock, scd->tick_gtod + TICK_NSEC);
 
        clock = wrap_max(clock, min_clock);
        clock = wrap_min(clock, max_clock);

We want wrap_max(scd->clock, scd->tick_gtod + TICK_NSEC), not
wrap_min().  The problem I am trying to fix is that scd->tick_gtod +
TICK_NSEC may be too low.  The upper bound needs to be at LEAST
scd->clock.  Limiting it to scd->clock all the time is disastrous.  :-)

I'll fix the patch and retest it before sending it again.

Sorry about my sloppiness.

Shaggy
-- 
David Kleikamp
IBM Linux Technology Center

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ