From owner-freebsd-current@freebsd.org Sat Jun 4 07:18:36 2016 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 20EAAB68F6C for ; Sat, 4 Jun 2016 07:18:36 +0000 (UTC) (envelope-from sobomax@sippysoft.com) Received: from mail-oi0-x230.google.com (mail-oi0-x230.google.com [IPv6:2607:f8b0:4003:c06::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DB3821B9F for ; Sat, 4 Jun 2016 07:18:35 +0000 (UTC) (envelope-from sobomax@sippysoft.com) Received: by mail-oi0-x230.google.com with SMTP id j1so158941816oih.3 for ; Sat, 04 Jun 2016 00:18:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sippysoft-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc; bh=OBHWTDeArBkTWzCIzuAQjGAQVtG05fVWArCQgeOuV9k=; b=2FipbG0rD1vqW2Q5HL5os/zi5/VfnpopMflqhRYuDTE5RfTxa3awRpOLtWfXsRzFE/ seM/NU/8EhMIuxGwWV8O0e3w4d0A2mw9XQz8GDsuHfdxS3M0ZqCBiHPgAnFu0QDXBQ/g Ucck3XsQN9VBNmje1juvYf/JAHh6ZsgNvSNLb6jJfkIpUrYLd0/2FbVTYgdTt8u/VFmu rth5lD1syQM05avh3y7yO956orfXBGHSVi4VRJa5pPWpHf1lgVq+AasdSDlWexMAygCc MFyrxbroJAa6ZpsxjCkkfOCYq7pN9cvGdIqXkGSwBN8JqcrcAL/5iE9beb6Ueyr7Yteq /+OA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc; bh=OBHWTDeArBkTWzCIzuAQjGAQVtG05fVWArCQgeOuV9k=; b=VLKlqMLFvzmYV1HdGBJ99K0OPDsG3CNCjYxGZpYrNBRfIz6v1pdgCKQxhB2enwxLUP dI7PZ905izcnwDqX8Lm59rJVlbHD8+8euvemszsuOYs9I6F3SeQMbWJz8H+JbavMNtUY 2Dloi7WvRJjSfRRkVhtQ6WpCL3b/2RzDBGOiTILyrEPC2SKypDHfnK1KavXJrEtYJz4Z 4XmX4jUa0Pf7P5vZKHvzqWuCrdmgetwbVDwm3oYyMpXGZq1rravUU89bRWotz8pyT+DV 3kjR+l8B5KPo4UBT/RBbwgntjmwGoTjJ3AxRrh24TmBMJKziTa7VLWSp8QQ/KC3SBAlk n18A== X-Gm-Message-State: ALyK8tKn7JigtFCOT7J73pq6kN/RKpzgL+Q6V2eWal36AKkcFgsCfvZncZ9JmXaMhm5gcxFTNPM7XGgtmUP+GiJn MIME-Version: 1.0 X-Received: by 10.157.15.73 with SMTP id 67mr549802ott.15.1465024715084; Sat, 04 Jun 2016 00:18:35 -0700 (PDT) Sender: sobomax@sippysoft.com Received: by 10.157.56.70 with HTTP; Sat, 4 Jun 2016 00:18:34 -0700 (PDT) Received: by 10.157.56.70 with HTTP; Sat, 4 Jun 2016 00:18:34 -0700 (PDT) In-Reply-To: <20160603171809.GX38613@kib.kiev.ua> References: <20160603050628.GV38613@kib.kiev.ua> <20160603171809.GX38613@kib.kiev.ua> Date: Sat, 4 Jun 2016 00:18:34 -0700 X-Google-Sender-Auth: 7Y1DwyWNkm8bt3LGpVvUbXDU4Gs Message-ID: Subject: Re: CLOCK_MONOTONIC / CLOCK_UPTIME is not really monotonic between threads From: Maxim Sobolev To: Konstantin Belousov , Adrian Chadd Cc: FreeBSD Current Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.22 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jun 2016 07:18:36 -0000 Yeah, indeed false positive, app error. Sorry for noise and thanks for feedback. -Max On Jun 3, 2016 10:18 AM, "Konstantin Belousov" wrote: > On Fri, Jun 03, 2016 at 08:04:29AM -0700, Maxim Sobolev wrote: > > Konstantin, > > > > Thanks for taking your time looking into it and sorry for somewhat messy > > problem report. I've been trying to fix that problem all day yesterday > > thinking it's just application logic that is broken and indeed has been > > able to find some bigger issues that were obscuring this one. But it got > > very frustrating when the bug popped out anew at a seemingly lower level > > now. The issue that triggered this is in some high level python code. > Which > > makes it quite difficult to narrow and isolate. There is still slight > > chance that it's something about threading within the python that screws > > this up somehow, however I don't quite see how that could lead to a > > consistent result that is just off by few hundred microseconds and not in > > some random garbage. > > > > So, I take from you message, that high level > > clock_gettime(CLOCK_MONOTONIC*) is supposed to be monotonic with respect > to > > the wall time even when called in different threads? I always though it > is, > > but was not 100% sure about that and wanted to confirm it before I dive > > deeper into this and spend more time writing a test case to expose this. > Yes, CLOCK_MONOTONIC should be monotonic across all processors. > Until the time travel is made possible, of course. > > > The test case you gave me is interesting, but somewhat low-level. What I > > would do if it comes to it, is to make something that uses pthreads and > > plain clock_gettime(2). Should not be too difficult to reproduce if it's > > real issue. > The test I give you verifies clock_gettime() in several threads going > backward. > > > > > P.S. I've also tried kern.timecounter.fast_gettime=0, made no difference. > > Assuming it does not take a reboot to test it. Neither does > > switching kern.timecounter.hardware, I've tested TSC-low(1000) > > ACPI-fast(900) HPET(950) i8254(0), all are the same. > I am almost sure this is app-level issue. > > To make me confident, run the test I provided. > >