Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp5197097imm; Tue, 16 Oct 2018 06:43:35 -0700 (PDT) X-Google-Smtp-Source: ACcGV61Cl5cdr3nrv8RljIM7ynEyuIYw4FyKdRxbo4sUHeuYLJwftO45nLZFkXN3vr1VmqlOKvBZ X-Received: by 2002:a62:1ccb:: with SMTP id c194-v6mr21905145pfc.203.1539697415631; Tue, 16 Oct 2018 06:43:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539697415; cv=none; d=google.com; s=arc-20160816; b=E7o9uRuzsTKMu/7Tckpi8p847dcNSxlBGKOqkxRhFob7TwYJz5GumLZXGBP4Ootmp/ h3PYSYMTDzIU5fo3Wt+s/BqO7NjYfBvKDU38icrFRdO2uYSdv0VbEPRqSWiTvP+vBG7S 3Zz0rXHXdwzmS2Ti0qNBZxC5rKblCcwyi2Y/UzzyvzgFylEjGcs/1cvNjDLdpdsIFLcD 5GlGfCjoFikWPwAJpmpLZzo7C7t4IF2VwQ5mc3SyzFGwk+B5VgWNFigghZ+qlyezDoE8 Y/NOPCRwlgBIrXuI/CLRgTa0pFrcbFYOwP8EYNhcuJqIDFmZxXrtgF/aopfmw3j1IMlU CduQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=MMJm2fL+B5FcY4CbkBjGWLMAU1BrPuDoK0KjtXpjEMM=; b=Cn4r89POW+hZU6GxYQbhBunHn1KpLGowzwrHhRAftyd8F5ArlAyz1iT1uTaxGbOzvQ WObpBJHJM3NFN1+MmNwXRagFWOKIK5IGZqc9i/IJxcbMUo9p25Ma66/7i2zo9d4HP7JM Y25nxCUyaNAim9/tA8Rdo/PVyjj8b9OB5iLSWW94Me28/pstoogtoOvVc/RHhbCc75y+ SkHYahU1/v+aJ3PHAONnRHYmSBw/O8Jo4qLkuNAeRHYsYCCQ0zq8bc9Gc//BaG1b8IpA tGDsdPFwC9V8vNjg33uQ2FDCw1SuL7muCktvFzSDZPmGKqEbXeB1PQIYKSHr05a19FEP abKg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n32-v6si13563141pgm.469.2018.10.16.06.43.19; Tue, 16 Oct 2018 06:43:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727266AbeJPVci (ORCPT + 99 others); Tue, 16 Oct 2018 17:32:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:35888 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727002AbeJPVci (ORCPT ); Tue, 16 Oct 2018 17:32:38 -0400 Received: from gandalf.local.home (cpe-66-24-56-78.stny.res.rr.com [66.24.56.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 00CB720881; Tue, 16 Oct 2018 13:42:05 +0000 (UTC) Date: Tue, 16 Oct 2018 09:42:04 -0400 From: Steven Rostedt To: Joel Fernandes Cc: LKML Subject: Re: [PATCH] tracing: Use trace_clock_local() for looping in preemptirq_delay_test.c Message-ID: <20181016094204.363b8dd4@gandalf.local.home> In-Reply-To: <20181016094005.654275a9@gandalf.local.home> References: <20181016094005.654275a9@gandalf.local.home> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Joel, Can you Ack this patch. I want to push it upstream as without it, your preemptirq latency test fails on one of my boxes. Causing my automated tests to fail (I get by with removing the test from the automation). -- Steve On Tue, 16 Oct 2018 09:40:05 -0400 Steven Rostedt wrote: > From: "Steven Rostedt (VMware)" > > The preemptirq_delay_test module is used for the ftrace selftest code that > tests the latency tracers. The problem is that it uses ktime for the delay > loop, and then checks the tracer to see if the delay loop is caught, but the > tracer uses trace_clock_local() which uses various different other clocks to > measure the latency. As ktime uses the clock cycles, and the code then > converts that to nanoseconds, it causes rounding errors, and the preemptirq > latency tests are failing due to being off by 1 (it expects to see a delay > of 500000 us, but the delay is only 499999 us). This is happening due to a > rounding error in the ktime (which is totally legit). The purpose of the > test is to see if it can catch the delay, not to test the accuracy between > trace_clock_local() and ktime_get(). Best to use apples to apples, and have > the delay loop use the same clock as the latency tracer does. > > Cc: Joel Fernandes (Google) > Cc: stable@vger.kernel.org > Fixes: f96e8577da102 ("lib: Add module for testing preemptoff/irqsoff latency tracers") > Signed-off-by: Steven Rostedt (VMware) > --- > kernel/trace/preemptirq_delay_test.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/kernel/trace/preemptirq_delay_test.c b/kernel/trace/preemptirq_delay_test.c > index f704390db9fc..d8765c952fab 100644 > --- a/kernel/trace/preemptirq_delay_test.c > +++ b/kernel/trace/preemptirq_delay_test.c > @@ -5,12 +5,12 @@ > * Copyright (C) 2018 Joel Fernandes (Google) > */ > > +#include > #include > #include > #include > #include > #include > -#include > #include > #include > #include > @@ -25,13 +25,13 @@ MODULE_PARM_DESC(test_mode, "Mode of the test such as preempt or irq (default ir > > static void busy_wait(ulong time) > { > - ktime_t start, end; > - start = ktime_get(); > + u64 start, end; > + start = trace_clock_local(); > do { > - end = ktime_get(); > + end = trace_clock_local(); > if (kthread_should_stop()) > break; > - } while (ktime_to_ns(ktime_sub(end, start)) < (time * 1000)); > + } while ((end - start) < (time * 1000)); > } > > static int preemptirq_delay_run(void *data)