From patchwork Tue Jul 3 19:36:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 10505043 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D95E7601D3 for ; Tue, 3 Jul 2018 19:36:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C806028C69 for ; Tue, 3 Jul 2018 19:36:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BB1EE28DAB; Tue, 3 Jul 2018 19:36:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 53BF628C69 for ; Tue, 3 Jul 2018 19:36:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752488AbeGCTgd (ORCPT ); Tue, 3 Jul 2018 15:36:33 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:33573 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751646AbeGCTgb (ORCPT ); Tue, 3 Jul 2018 15:36:31 -0400 Received: by mail-pf0-f196.google.com with SMTP id b17-v6so1491858pfi.0 for ; Tue, 03 Jul 2018 12:36:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=pGrxGNn7UAs9qvT/dbK1Fzjj6AmfYYcIWE9WhtcC8u4=; b=Im2K1+9tDfAoMQklXs+XckHWYeAfa9jVIkxDJlq9bL8DealfUTb3gmzLozotNunVrF ZRQUtlXpTnGcxr2EuwxVMJUdlIQEeC1yv302LzsPfoS4Bd8VFqONnLC+U0YOp+PVs2nX U7JaHwAve4AlXrCh4N97pwWsUEu82b5+SXl+A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=pGrxGNn7UAs9qvT/dbK1Fzjj6AmfYYcIWE9WhtcC8u4=; b=IzqOhccvyblyyFJ+EAGKw6xq+LimHxB4qqeekE7EktCdOTsVKTsiVh7qlUbgmHGkIo PF/NU65vuN09MQ+L/bInoyQrKkeuj0LktVNA0k3pB7z0DVnfvwGfKi2PnoO74vKhrjSN 49L2GR1ZnWYRyKgnNuj3X1eltIWv8PzfXvIbVoR+F20NkTpZnXllqg19J+D5WetppPu4 SxfD1MiNuQZ1oXuPIFCfymy3Wsa+gUijNI1mz5E2naF2ecA8331BkxcR1ry5nObfIizO ZNNqOQANKUfk90yAfSPnnlMcenS0UdoUuZ9E9Aag61ewaW0nJtYobeLD8a53QM3cJHuj f5Rw== X-Gm-Message-State: APt69E0FnYBcTHE064H9ATMV5OeSpwkoqniO4bvDaYCnzqkF98RZPqt4 lztYAyCJu5mMepscMFbb+9cdvw== X-Google-Smtp-Source: AAOMgpd1uPsnKl5w9E3KnqgSwtPJKxQ4b9uPNlJKN32ZiTDu6PWOyoYWqyzU0DssKQcZhq3hdoVh3w== X-Received: by 2002:a63:ec14:: with SMTP id j20-v6mr8514017pgh.28.1530646591108; Tue, 03 Jul 2018 12:36:31 -0700 (PDT) Received: from localhost.localdomain ([2601:1c2:600:5100:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id e10-v6sm3132905pgv.48.2018.07.03.12.36.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 03 Jul 2018 12:36:30 -0700 (PDT) From: John Stultz To: lkml Cc: John Stultz , Thomas Gleixner , Ingo Molnar , Miroslav Lichvar , Richard Cochran , Prarit Bhargava , Stephen Boyd , Shuah Khan , linux-kselftest@vger.kernel.org Subject: [RFC][PATCH] selftest: timers: Tweak raw_skew to SKIP when ADJ_OFFSET is in progress Date: Tue, 3 Jul 2018 12:36:27 -0700 Message-Id: <1530646587-12101-1-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In the past we've warned when ADJ_OFFSET was in progress, usually caused by ntpd or some other time adjusting daemon running in non steady sate, which can cause the skew calculations to be incorrect Thus, this patch sets a flag which we check when we fail so that we don't cause false negatives. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Miroslav Lichvar Cc: Richard Cochran Cc: Prarit Bhargava Cc: Stephen Boyd Cc: Shuah Khan Cc: linux-kselftest@vger.kernel.org Suggested-by: Miroslav Lichvar Signed-off-by: John Stultz --- tools/testing/selftests/timers/raw_skew.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/timers/raw_skew.c b/tools/testing/selftests/timers/raw_skew.c index ca6cd14..d3fc453 100644 --- a/tools/testing/selftests/timers/raw_skew.c +++ b/tools/testing/selftests/timers/raw_skew.c @@ -94,6 +94,7 @@ int main(int argv, char **argc) struct timespec mon, raw, start, end; long long delta1, delta2, interval, eppm, ppm; struct timex tx1, tx2; + int adj_offset_bad = 0; setbuf(stdout, NULL); @@ -108,8 +109,10 @@ int main(int argv, char **argc) start = mon; delta1 = diff_timespec(mon, raw); - if (tx1.offset) + if (tx1.offset) { printf("WARNING: ADJ_OFFSET in progress, this will cause inaccurate results\n"); + adj_offset_bad = 1; + } printf("Estimating clock drift: "); sleep(120); @@ -134,6 +137,10 @@ int main(int argv, char **argc) printf(" %lld.%i(act)", ppm/1000, abs((int)(ppm%1000))); if (llabs(eppm - ppm) > 1000) { + if (adj_offset_bad) { + printf(" [SKIP]\n"); + return ksft_exit_skip("ADJ_OFFSET in progress. Shutdown NTPd or other time steering daemons\n"); + } printf(" [FAILED]\n"); return ksft_exit_fail(); }