From patchwork Fri Aug 18 18:50:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 110424 Delivered-To: patches@linaro.org Received: by 10.140.95.78 with SMTP id h72csp1287382qge; Fri, 18 Aug 2017 11:51:09 -0700 (PDT) X-Received: by 10.84.137.129 with SMTP id 1mr10647524pln.251.1503082269516; Fri, 18 Aug 2017 11:51:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503082269; cv=none; d=google.com; s=arc-20160816; b=NwzspAoYf1cyTB7teBI9e4dsg9bIFrtl0ADd7B40RH0LMNxmZQHHnC/+KdQNY2ko4m pyu3qWZSVd0FT/f1KDNTTilRfxhAgMF8oovVdtJwnLvcNl/9W+r2hbDbNWqaKtD+oaSO mtPVBn7AzC+Tb+Sn6rfwMo/7xWE1sqVzHtkiV8YueWpFaH8z+SSgElfoU2GQ55577MV0 gFPa2oRBsxMIUaHu1UJdpKW4ilDXvb8vV1/jJu4dl6kBViz5LihqRaQuNP3GJtfCHBDu YE/cf3BHgWj175InIkTnUwSQT11omfasV8V47jbNziJTHdfbNKmwfmL1oQTc40UsW2IR STrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=4JQsD0MbHudMQUKAbKtRPZ7c4+VDOeqtDyHFZfM28A0=; b=D0apAZpigZf9HKe8pYqclPR361iRQQAx0xgFSL1tlGsKjuvtkPgpQIYgg4GIT75g0T em+Wgg4i0kp25clep2NQg1MN7oOL8EyUM7BvZ+7U/Sis1IlF1cI0U5/OEP46VMXFnKmc SJmVMsN79ALMYOnr+34Klfv14V/C/OAWfvb0xZ0cOkErWUaRCw+CiKZAcSSm3LbsYok9 qagWj+Brk9d1C5XHaoJllAFvAXjER/G1cChjvmMMGg8B4T0xePDdM0iaPwirUekEAozl 173jRamxOY0SScnwi7KFlOh7DkTEzfMBMwLE5c6lJGujz2GZFMcTIGhVMYhE3ldVeCJA OwpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=h0aAvmbg; spf=pass (google.com: domain of john.stultz@linaro.org designates 2607:f8b0:400e:c05::233 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-pg0-x233.google.com (mail-pg0-x233.google.com. [2607:f8b0:400e:c05::233]) by mx.google.com with ESMTPS id e5si3993813pfg.282.2017.08.18.11.51.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Aug 2017 11:51:09 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 2607:f8b0:400e:c05::233 as permitted sender) client-ip=2607:f8b0:400e:c05::233; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=h0aAvmbg; spf=pass (google.com: domain of john.stultz@linaro.org designates 2607:f8b0:400e:c05::233 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by mail-pg0-x233.google.com with SMTP id t80so41911611pgb.5 for ; Fri, 18 Aug 2017 11:51:09 -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:in-reply-to:references; bh=4JQsD0MbHudMQUKAbKtRPZ7c4+VDOeqtDyHFZfM28A0=; b=h0aAvmbg8sDwuOs8B0S+c+rxO3a1oOSpVFNcPrKc80V+skeKHNz1koWVLMtDV056v9 xPTjT2xm/NbqCOIQO/TgJoNCQm+IwXvoGNW4zvdg2JQ+74alpjtgu7Sp2SuQrVL3SIVu JpNluVKQq6Tk3TQefdW+MpUJvHnuWb8cMI+zw= 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:in-reply-to :references; bh=4JQsD0MbHudMQUKAbKtRPZ7c4+VDOeqtDyHFZfM28A0=; b=cJp6fqk8TVB3+BMPxy0h1r83rOcdTAaE5qwHKA6bkppBwIZKtQZ1JADiLM0AN0ysdO 6o/mLn1uTt8BGrgHywhn+Ds9+hYkm2y6BpVeLbqZUbfm5QVzu+52BEH9tcKB3z03EKRM CCIsKFETJ3YgIaAVxhMLwZuxTJMIzYwCpANogF2aKQRWhZREPuYhJVeCh6UzhXyufJ1H wVHUDFR9AZQ6UEeUGR7LB7NgT+LdjfPt/1lPXHOoJVGSj8aeEyErRwqq/0Wx4TOegdWM Df7fKCSHBRVHT+pNOSZhVn5QL1ZkK2S+FifWtXF2Tc+ONWiZBWtkJvLQp8BXBaZa8KVr /6IQ== X-Gm-Message-State: AHYfb5jhAH4bNAE+EFTylKMf94XFtpMQnTtnKEzwJGEJQB82mSKxiXJJ sBiv3QLZesdrf9W071c= X-Received: by 10.99.174.70 with SMTP id e6mr5856690pgp.246.1503082269240; Fri, 18 Aug 2017 11:51:09 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:1002:83f0:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id l132sm12518790pfc.150.2017.08.18.11.51.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 18 Aug 2017 11:51:08 -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: [PATCH 1/6] kselftests: timers: freq-step: Define ADJ_SETOFFSET if device has older kernel headers Date: Fri, 18 Aug 2017 11:50:57 -0700 Message-Id: <1503082262-29450-2-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1503082262-29450-1-git-send-email-john.stultz@linaro.org> References: <1503082262-29450-1-git-send-email-john.stultz@linaro.org> On some systems, the kernel headers haven't been updated to include ADJ_SETOFFSET, so define it in the test if needed. 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 Signed-off-by: John Stultz --- tools/testing/selftests/timers/freq-step.c | 4 ++++ 1 file changed, 4 insertions(+) -- 2.7.4 diff --git a/tools/testing/selftests/timers/freq-step.c b/tools/testing/selftests/timers/freq-step.c index e8c6183..934a308 100644 --- a/tools/testing/selftests/timers/freq-step.c +++ b/tools/testing/selftests/timers/freq-step.c @@ -33,6 +33,10 @@ #define MAX_FREQ_ERROR 10e-6 #define MAX_STDDEV 1000e-9 +#ifndef ADJ_SETOFFSET + #define ADJ_SETOFFSET 0x0100 +#endif + struct sample { double offset; double time; From patchwork Fri Aug 18 18:50:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 110425 Delivered-To: patches@linaro.org Received: by 10.140.95.78 with SMTP id h72csp1287428qge; Fri, 18 Aug 2017 11:51:11 -0700 (PDT) X-Received: by 10.98.131.141 with SMTP id h135mr9565578pfe.271.1503082271349; Fri, 18 Aug 2017 11:51:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503082271; cv=none; d=google.com; s=arc-20160816; b=nC+uM5nNAeW4agW1f0vC6ZPkp/xfm0VntooCVymuXFHoSqkIntM0sDabQH1S2WrY3R BidbvrJsZndGfawIO0444omF2E02zoNgRzSSgGynx92yWl5JAIKKqqpXOnPq2vI6AXPv 0Ev2t4cOB61nrhUrE7/SKecdTK5JPeRzNA1x/02D+WpxLuVLTmf6Sfqr9Ns5YBz8k1qQ tdQHjABhmsTaIvX52+YhxQeddp/hGYM7wqex1X5Rndua+44L+d1B/FKKcY/vJbho0c0Z hFqFy0cONm0h7CJdHPn8V8bsAg/J5ZqRU2lJ8CEeU0eCys7rR5IxRBbKM/nOMOAN4mTP A/wQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=0wuykVnSMaqmuux4u1xAbmZwEdeZJhObHMydbhKS71Q=; b=N+L40n94MVu3jaoNOibUYtq9V/OsNa/J0bgw6EMcAnIK/Yk3mH2xXjc7i1OGn7fjgg bCTLqfxdkyyrtVceUiBW0+oAmgJH8vNKgBuCUhLgZjxCpCciXJXzDl0R1ouzhzZJ2HTl tk6hnHMG6qbko2ML89bvEaO150wO0C+ohLtFJwByOQX+CfxnXROs5HqNk5AK7q1eq/mo DAT8ss84ZAuBe9l8X/IGPetrANXGxFzhM7I0wbdOw2c66lM5+RDVqRwjyxMdBKH/QQhV jh00MGI1ekffK/0ikENik3hAz/KU1zb0x96SHbTwh+jPGnG5fXKcIUhHRgr9210UJEn4 og6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IAqO/oqT; spf=pass (google.com: domain of john.stultz@linaro.org designates 2607:f8b0:400e:c05::22b as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-pg0-x22b.google.com (mail-pg0-x22b.google.com. [2607:f8b0:400e:c05::22b]) by mx.google.com with ESMTPS id y18si2250519pfj.15.2017.08.18.11.51.11 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Aug 2017 11:51:11 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 2607:f8b0:400e:c05::22b as permitted sender) client-ip=2607:f8b0:400e:c05::22b; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IAqO/oqT; spf=pass (google.com: domain of john.stultz@linaro.org designates 2607:f8b0:400e:c05::22b as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by mail-pg0-x22b.google.com with SMTP id y129so69515520pgy.4 for ; Fri, 18 Aug 2017 11:51:11 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=0wuykVnSMaqmuux4u1xAbmZwEdeZJhObHMydbhKS71Q=; b=IAqO/oqTzhfWoedMcpYGUSZJKS+F9DGDIi6xB3ynSP2eryoruBSENlttEf+0JBlCSB Rdfjm3uKZ1zwEE02QkbpmOPJNG5o41wFB1NugSekhsawiqhGHGXWrFdZYY8LvwyGGw6S NkxZrFBEkbN9VGn0MBjNbgncPfQgyfRbFtHfg= 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=0wuykVnSMaqmuux4u1xAbmZwEdeZJhObHMydbhKS71Q=; b=aPxiOdqnGXneFNUvCVmeA3f35b8TOMpA/Dh3yv7Dm6wz7zO49eelbpOIBhcVK4oD5M LnIXG8tRIvGyS8t8O7M6PCSsObsdNH7XJFP8a0vyC4pOQkSOdptI5XdYckcTwuZ++3AO FHMBOScBH7gtTryR/oQ2blODKFkyi355+gvsifHvTmKrFbndMNngD6We2FD0YfVMypaH KsERmrtHekA2gVZYsgfO+H3DesOgz0KU2VpyCKCJu4BXqOiMgHuZ54mEWflJ9ETVZcz+ WAvnksTWaMM0/bw28r98Kw9Gc/ZBg7a/0Fsr4EduiRhoY71PPc0qPCI0RZ3dGt5bOgd8 6aHA== X-Gm-Message-State: AHYfb5jmYCOWyhUIPRhK/8GhdXtOEV3vAmN7URvqObkpDKgN9qGc13lh fsXIQGvjNC+6ozDV8O8= X-Received: by 10.99.110.9 with SMTP id j9mr9131753pgc.236.1503082271087; Fri, 18 Aug 2017 11:51:11 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:1002:83f0:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id l132sm12518790pfc.150.2017.08.18.11.51.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 18 Aug 2017 11:51:10 -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: [PATCH 2/6] kselftests: timers: freq-step: Fix build warning Date: Fri, 18 Aug 2017 11:50:58 -0700 Message-Id: <1503082262-29450-3-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1503082262-29450-1-git-send-email-john.stultz@linaro.org> References: <1503082262-29450-1-git-send-email-john.stultz@linaro.org> MIME-Version: 1.0 Fixes the following build warning: freq-step.c: In function ‘main’: freq-step.c:271:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ By returning the return values from ksft_success/fail. 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 Signed-off-by: John Stultz --- tools/testing/selftests/timers/freq-step.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.7.4 diff --git a/tools/testing/selftests/timers/freq-step.c b/tools/testing/selftests/timers/freq-step.c index 934a308..926828e 100644 --- a/tools/testing/selftests/timers/freq-step.c +++ b/tools/testing/selftests/timers/freq-step.c @@ -266,7 +266,7 @@ int main(int argc, char **argv) set_frequency(0.0); if (fails) - ksft_exit_fail(); + return ksft_exit_fail(); - ksft_exit_pass(); + return ksft_exit_pass(); } From patchwork Fri Aug 18 18:50:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 110426 Delivered-To: patches@linaro.org Received: by 10.140.95.78 with SMTP id h72csp1287459qge; Fri, 18 Aug 2017 11:51:13 -0700 (PDT) X-Received: by 10.84.209.169 with SMTP id y38mr10585571plh.230.1503082273077; Fri, 18 Aug 2017 11:51:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503082273; cv=none; d=google.com; s=arc-20160816; b=ZtBzim27v99cuJxe6HUTzEgl2HgaA7D7+0CK+/rvlexios39QJfh6j7ADGBWs6fsXo gPxzcDpGPuCOCjEJWj6hTLnP7NUsfyP6Yg82LpZC0XslJy87TEYTUbeAZ/doLT1/7d8l /yvCPHd14ftmCVY3M6AdXwZmPNnXbiyHFgqP/yI2KYIYrw4cyxNs9ALvad8ve13FQIlM xOTBD6qiHQxdswFpvOB6amuSliq0vKfJht5a+mythavcgIprIKyJOxDY4H1bOLLRNAka PLpEn4Wg4ZVDVjSOETtfg6djWzCgIHLeBWYHeCgg7d+GogUv+Ud7xaimITH7hryBfvvd lCOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=QfVHqPUFBghSkG6sK7geAV3zGjuR7j4SFAPl/ZGobkA=; b=m5VgMtZ5xKXJu+6Jmxhrdk7mzYAJd1q4muqyZ+N/RybjRNPZ0nuA+Vq840OnLsn0m6 O5jEafAN2Q5oapZkkOpnzr+dRsm01BK7VMwT2VaxnxJHOfBAuQAg3fpsid/6TBhufyxc ETllA1P8SPEoEf/PIpSsEoIdTITCzDcadUJWat1J9APujqlIugV/EnZSRXz9C/sU2vXN njFn8RxeUsgRI/bdAYG2IiM9hjdRAoAt+DJNpV/lvBQNrJcPQEGDxNYvVzLRU2j6ggkS s60w9H8sGilK8w854I70MrwNRVX98T9W9IHtFmvMO/Wi2T1bkWj8Y/FUf4fwT1zaewPQ Mjuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=G+fAw19A; spf=pass (google.com: domain of john.stultz@linaro.org designates 2607:f8b0:400e:c05::22d as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-pg0-x22d.google.com (mail-pg0-x22d.google.com. [2607:f8b0:400e:c05::22d]) by mx.google.com with ESMTPS id g68si3861191pgc.734.2017.08.18.11.51.12 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Aug 2017 11:51:13 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 2607:f8b0:400e:c05::22d as permitted sender) client-ip=2607:f8b0:400e:c05::22d; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=G+fAw19A; spf=pass (google.com: domain of john.stultz@linaro.org designates 2607:f8b0:400e:c05::22d as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by mail-pg0-x22d.google.com with SMTP id v189so69362662pgd.2 for ; Fri, 18 Aug 2017 11:51:12 -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:in-reply-to:references; bh=QfVHqPUFBghSkG6sK7geAV3zGjuR7j4SFAPl/ZGobkA=; b=G+fAw19A49IIiPIg1YQvrbWPXxkgn/SsS68apZiXtDG5yfUWSkBi9vVAxKoQBnhbbt 2Ty8Zq+3JEfhU6ETc7ZGLSdwZSb0/ftY751UTJfByIost9EnB0TAAVmux+9jVwe5xOoi /sIztn07iTeg+Zb5jJSlTPlsOTFQc7mODUXoY= 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:in-reply-to :references; bh=QfVHqPUFBghSkG6sK7geAV3zGjuR7j4SFAPl/ZGobkA=; b=BKLbDSQnkHfxDBpR89mGFXbkH+Kgm1jVwyMc+drK0coxcmtIIS/tizcB+dmqZdhCAg BRF0Rka/meXaVUfb1VuTwm/VbwJ6yQGSzTLcr23IyThgwO/chA/Q4EketDmKKkwIttNc WTIFMP1/JL12bGcG2I8eB6Ue7WJZf95CLFHmZ9VCY1qSvb57AdnhjEN+eikDTfDeIgUY 2Gdrcd1NiX1JdrIhyFFoRNqYoBIkUwXkcC8MzTOLZ+ol91Y3dJ4vxIv5Tiei+z5K2rrU IuwUjkHLpas/XnCDh5flyLuwsfdbyd1xXEj3gX36mANfo5q3fKuA/g3VCEOeSIbhU3lA uo6Q== X-Gm-Message-State: AHYfb5gqR+OBkl8v6y5/O76UpPfVxU5i8s7Q53mHZeiUxA9PhOsG58n6 +JhE/mRTsyW2Kld00rs= X-Received: by 10.98.35.82 with SMTP id j79mr9746535pfj.56.1503082272796; Fri, 18 Aug 2017 11:51:12 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:1002:83f0:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id l132sm12518790pfc.150.2017.08.18.11.51.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 18 Aug 2017 11:51:11 -0700 (PDT) From: John Stultz To: lkml Cc: Greg Hackmann , Thomas Gleixner , Ingo Molnar , Miroslav Lichvar , Richard Cochran , Prarit Bhargava , Stephen Boyd , Shuah Khan , linux-kselftest@vger.kernel.org, John Stultz Subject: [PATCH 3/6] kselftests: timers: set-timer-lat: Tweak reporting when timer fires early Date: Fri, 18 Aug 2017 11:50:59 -0700 Message-Id: <1503082262-29450-4-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1503082262-29450-1-git-send-email-john.stultz@linaro.org> References: <1503082262-29450-1-git-send-email-john.stultz@linaro.org> From: Greg Hackmann Rather than printing an error inside the alarm signal handler, set a flag that we check later. This keeps the test from spamming the console every time the alarm fires early. It also fixes the test exiting with error code 0 if this was the only test failure. 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 Signed-off-by: Greg Hackmann Signed-off-by: John Stultz --- tools/testing/selftests/timers/set-timer-lat.c | 33 +++++++++++++++++++------- 1 file changed, 25 insertions(+), 8 deletions(-) -- 2.7.4 diff --git a/tools/testing/selftests/timers/set-timer-lat.c b/tools/testing/selftests/timers/set-timer-lat.c index 4fc98c5..10c2e18 100644 --- a/tools/testing/selftests/timers/set-timer-lat.c +++ b/tools/testing/selftests/timers/set-timer-lat.c @@ -63,6 +63,7 @@ int alarmcount; int clock_id; struct timespec start_time; long long max_latency_ns; +int timer_fired_early; char *clockstring(int clockid) { @@ -115,12 +116,19 @@ void sigalarm(int signo) delta_ns -= NSEC_PER_SEC * TIMER_SECS * alarmcount; if (delta_ns < 0) - printf("%s timer fired early: FAIL\n", clockstring(clock_id)); + timer_fired_early = 1; if (delta_ns > max_latency_ns) max_latency_ns = delta_ns; } +void describe_timer(int flags) +{ + printf("%-22s %s ", + clockstring(clock_id), + flags ? "ABSTIME":"RELTIME"); +} + int do_timer(int clock_id, int flags) { struct sigevent se; @@ -136,6 +144,7 @@ int do_timer(int clock_id, int flags) max_latency_ns = 0; alarmcount = 0; + timer_fired_early = 0; err = timer_create(clock_id, &se, &tm1); if (err) { @@ -170,18 +179,26 @@ int do_timer(int clock_id, int flags) while (alarmcount < 5) sleep(1); - printf("%-22s %s max latency: %10lld ns : ", - clockstring(clock_id), - flags ? "ABSTIME":"RELTIME", - max_latency_ns); + describe_timer(flags); + printf("timer fired early: %7d : ", timer_fired_early); + if (!timer_fired_early) { + printf("[OK]\n"); + } else { + printf("[FAILED]\n"); + err = -1; + } + + describe_timer(flags); + printf("max latency: %10lld ns : ", max_latency_ns); timer_delete(tm1); if (max_latency_ns < UNRESONABLE_LATENCY) { printf("[OK]\n"); - return 0; + } else { + printf("[FAILED]\n"); + err = -1; } - printf("[FAILED]\n"); - return -1; + return err; } int main(void) From patchwork Fri Aug 18 18:51:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 110427 Delivered-To: patches@linaro.org Received: by 10.140.95.78 with SMTP id h72csp1287484qge; Fri, 18 Aug 2017 11:51:14 -0700 (PDT) X-Received: by 10.84.130.78 with SMTP id 72mr10560643plc.471.1503082274838; Fri, 18 Aug 2017 11:51:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503082274; cv=none; d=google.com; s=arc-20160816; b=WYqUPtZHpj5vw9PgqEMr3eFsqrxri2OL4HnCcgdo1fGldz1I6oQR8ycjDvM6m19aI5 fIXIABz3+nFhOq3O/sgtZPQf8vUIeBla2/q0XgbtV9SCVXZaOieGxDhhBEMt+lVFILfH xs4Go1/G2U6GA0HJ99Qo1lHP+u9csnVy26F4qRufZvoPNTP+1nFBuLBXOuBUS9BEB18Q YfTkIYP6aVm3OQhbxci2BjR4hLU8WJ5Ohtsyn6GReDyGAQ0hWmZsXJmo7mkyYf47WhOn ypw1zAX02FhTZ7KBynO25p2cf7ngYrJ6eE+5O1HXU9uH4mNVEjcVE1GZJCdySlg1H4a/ Qjmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=gnjP2QzQRYWEdHBGENV+8SgesivTywiIdive8zqkDwM=; b=oMIKdHMJKkeEHu1W8IASOa2//MyoShjYDE7q95SzR9o7PzYQ1BHgezFZPm96zlxJ0p 5wTHSKW/I7QTAENLamzyzjHKqDk1Yh5q6QfUUeCi0aZIRKo6H4Lo5BpYBsoviSWX/+KK JbueXavkvSsxg9r3UBPLKPFvGLtKeKbESZ5t7wGSfFYXTenQ1RIyywONx9gRxdoBeWCw ztfAidU+hEGPdwCq34PdVQTdBYZB7zXiGMwypXERiN3iJT394uHYeeRCxUH8Q/La4w1q E3FGYtwpl8S2Fv5rAADeWoSjPcAP6K5Fi4POF0nTMYdDGpUKGvc67vYIHuuG5Zs45B3Y egCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FlcruEGN; spf=pass (google.com: domain of john.stultz@linaro.org designates 2607:f8b0:400e:c05::229 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-pg0-x229.google.com (mail-pg0-x229.google.com. [2607:f8b0:400e:c05::229]) by mx.google.com with ESMTPS id m10si3907024pgs.819.2017.08.18.11.51.14 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Aug 2017 11:51:14 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 2607:f8b0:400e:c05::229 as permitted sender) client-ip=2607:f8b0:400e:c05::229; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FlcruEGN; spf=pass (google.com: domain of john.stultz@linaro.org designates 2607:f8b0:400e:c05::229 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by mail-pg0-x229.google.com with SMTP id t3so41497470pgt.0 for ; Fri, 18 Aug 2017 11:51:14 -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:in-reply-to:references; bh=gnjP2QzQRYWEdHBGENV+8SgesivTywiIdive8zqkDwM=; b=FlcruEGNXxbJMnd8l4G9aSlA3XHPodm8RvECdtGp1j+keKZjwOf4F6EGaDli6J+aCr IO2+5tX0XpVrqOtDRYuevp21Ae3F/9gVURzrQGJ2pSfPWj1B6xfQCXtB1/p6y/Z0XHin D5E0baEEdg+TA+d9im6jq31pMEnDtRXu5UrxI= 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:in-reply-to :references; bh=gnjP2QzQRYWEdHBGENV+8SgesivTywiIdive8zqkDwM=; b=dq0meHTlU9POtA+ux4GUw6LKfuPaE4RpKLc6NnRYh+5H/pBJrfrmVr+IR26N9IGz+Z ft6llRdIXQMmg2x/k8/1/gJbjH1g/TpP2TRYqhk1NRvw1BRjRGxE4+MVKML0UjzrdcWr vTsvioycLXVJaBy7sx3xQYHJ8yd9zDUxUX/n0ttXc4f85LFrbxM+kUxd6d4AMdgdSd0o 8JvUzjnwGMv1kXCKZwdKWa2i1YNIT4D6X4A4FIFMVhb2/cvH4IUu4sv+4Xu7MmPzyxDL akQddLMwdRdj2fhKG028AjqKF/c61YOlZNLZBbbVdboJS0FdaeUBRiHbd/jsNuLkdNId HTNA== X-Gm-Message-State: AHYfb5iHoeeoO7iVENErWn+sWHohD1tG6swtYUXZPuR//qomVWOzY1I7 7lrO6LkrllO2B6tunos= X-Received: by 10.98.34.201 with SMTP id p70mr9686241pfj.330.1503082274536; Fri, 18 Aug 2017 11:51:14 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:1002:83f0:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id l132sm12518790pfc.150.2017.08.18.11.51.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 18 Aug 2017 11:51:13 -0700 (PDT) From: John Stultz To: lkml Cc: Greg Hackmann , Thomas Gleixner , Ingo Molnar , Miroslav Lichvar , Richard Cochran , Prarit Bhargava , Stephen Boyd , Shuah Khan , linux-kselftest@vger.kernel.org, John Stultz Subject: [PATCH 4/6] kselftests: timers: set-timer-lat: Add one-shot timer test cases Date: Fri, 18 Aug 2017 11:51:00 -0700 Message-Id: <1503082262-29450-5-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1503082262-29450-1-git-send-email-john.stultz@linaro.org> References: <1503082262-29450-1-git-send-email-john.stultz@linaro.org> From: Greg Hackmann These testcases are motivated by a recent alarmtimer regression, which caused one-shot CLOCK_{BOOTTIME,REALTIME}_ALARM timers to become periodic timers. The new testcases are very similar to the existing testcases for repeating timers. But rather than waiting for 5 alarms, they wait for 5 seconds and verify that the alarm fired exactly once. 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 Signed-off-by: Greg Hackmann Signed-off-by: John Stultz --- tools/testing/selftests/timers/set-timer-lat.c | 86 ++++++++++++++++++++++---- 1 file changed, 73 insertions(+), 13 deletions(-) -- 2.7.4 diff --git a/tools/testing/selftests/timers/set-timer-lat.c b/tools/testing/selftests/timers/set-timer-lat.c index 10c2e18..15434da 100644 --- a/tools/testing/selftests/timers/set-timer-lat.c +++ b/tools/testing/selftests/timers/set-timer-lat.c @@ -20,6 +20,7 @@ */ +#include #include #include #include @@ -122,17 +123,17 @@ void sigalarm(int signo) max_latency_ns = delta_ns; } -void describe_timer(int flags) +void describe_timer(int flags, int interval) { - printf("%-22s %s ", + printf("%-22s %s %s ", clockstring(clock_id), - flags ? "ABSTIME":"RELTIME"); + flags ? "ABSTIME":"RELTIME", + interval ? "PERIODIC":"ONE-SHOT"); } -int do_timer(int clock_id, int flags) +int setup_timer(int clock_id, int flags, int interval, timer_t *tm1) { struct sigevent se; - timer_t tm1; struct itimerspec its1, its2; int err; @@ -146,7 +147,7 @@ int do_timer(int clock_id, int flags) alarmcount = 0; timer_fired_early = 0; - err = timer_create(clock_id, &se, &tm1); + err = timer_create(clock_id, &se, tm1); if (err) { if ((clock_id == CLOCK_REALTIME_ALARM) || (clock_id == CLOCK_BOOTTIME_ALARM)) { @@ -167,19 +168,23 @@ int do_timer(int clock_id, int flags) its1.it_value.tv_sec = TIMER_SECS; its1.it_value.tv_nsec = 0; } - its1.it_interval.tv_sec = TIMER_SECS; + its1.it_interval.tv_sec = interval; its1.it_interval.tv_nsec = 0; - err = timer_settime(tm1, flags, &its1, &its2); + err = timer_settime(*tm1, flags, &its1, &its2); if (err) { printf("%s - timer_settime() failed\n", clockstring(clock_id)); return -1; } - while (alarmcount < 5) - sleep(1); + return 0; +} - describe_timer(flags); +int check_timer_latency(int flags, int interval) +{ + int err = 0; + + describe_timer(flags, interval); printf("timer fired early: %7d : ", timer_fired_early); if (!timer_fired_early) { printf("[OK]\n"); @@ -188,10 +193,9 @@ int do_timer(int clock_id, int flags) err = -1; } - describe_timer(flags); + describe_timer(flags, interval); printf("max latency: %10lld ns : ", max_latency_ns); - timer_delete(tm1); if (max_latency_ns < UNRESONABLE_LATENCY) { printf("[OK]\n"); } else { @@ -201,6 +205,60 @@ int do_timer(int clock_id, int flags) return err; } +int check_alarmcount(int flags, int interval) +{ + describe_timer(flags, interval); + printf("count: %19d : ", alarmcount); + if (alarmcount == 1) { + printf("[OK]\n"); + return 0; + } + printf("[FAILED]\n"); + return -1; +} + +int do_timer(int clock_id, int flags) +{ + timer_t tm1; + const int interval = TIMER_SECS; + int err; + + err = setup_timer(clock_id, flags, interval, &tm1); + if (err) + return err; + + while (alarmcount < 5) + sleep(1); + + timer_delete(tm1); + return check_timer_latency(flags, interval); +} + +int do_timer_oneshot(int clock_id, int flags) +{ + timer_t tm1; + const int interval = 0; + struct timeval timeout; + fd_set fds; + int err; + + err = setup_timer(clock_id, flags, interval, &tm1); + if (err) + return err; + + memset(&timeout, 0, sizeof(timeout)); + timeout.tv_sec = 5; + FD_ZERO(&fds); + do { + err = select(FD_SETSIZE, &fds, NULL, NULL, &timeout); + } while (err == -1 && errno == EINTR); + + timer_delete(tm1); + err = check_timer_latency(flags, interval); + err |= check_alarmcount(flags, interval); + return err; +} + int main(void) { struct sigaction act; @@ -226,6 +284,8 @@ int main(void) ret |= do_timer(clock_id, TIMER_ABSTIME); ret |= do_timer(clock_id, 0); + ret |= do_timer_oneshot(clock_id, TIMER_ABSTIME); + ret |= do_timer_oneshot(clock_id, 0); } if (ret) return ksft_exit_fail(); From patchwork Fri Aug 18 18:51:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 110428 Delivered-To: patches@linaro.org Received: by 10.140.95.78 with SMTP id h72csp1287508qge; Fri, 18 Aug 2017 11:51:16 -0700 (PDT) X-Received: by 10.84.224.141 with SMTP id s13mr10581867plj.212.1503082276462; Fri, 18 Aug 2017 11:51:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503082276; cv=none; d=google.com; s=arc-20160816; b=dwB3ZdXFAyVCpGeM7kL3CC6CDmZH/jhdkR0DSIp+XfXqEK/iNdDQdx78sMlQVguDXZ 8vDmxPDUYzPNvMjUJM3hsOI6naNzq41ALjRDHac5+R7KzvqN/u+Yar25vzXlH7Bd4EN7 4+i0+qpw+RQTFLkDoQOELMgVbOuEO/DVytxPVG4NpLTMLeFwwTrdxa6NynBQoZtH7VlV +OUs5sq4yKBIqlSRTmz8tko+nDujMyibxFd2U0xLj5lPZepeSGLFCbW4iLUOOoAiYKB9 FrSGtlDK33qaeXJzzgsyUy4ShVj9wT3W1TQsUb4Im1PR9GDasmk2ufDUa8FotqbqFtMb nbTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=Atk1s46YfMqtYSkYRGUwmfIxXBXUjXC9ExCBXE98tdA=; b=x1WJFOrigl1h8P3wCTI6RuX7u8+TsVbE+N3+8aVGN5x9JR9r6Lhkc1naG5TDyra648 iXxycu9XQI3CzqxctGn2did/onitY9NSmuBeu+1o6Xf37GyYl32p0UAGTxvOlXBbbDEH d0wjeUwwWAZGzNampReFuxqMS3hqF2KyH2dmjfSQE9mX3KnRygkK1w566ECO1TC5G69t +sqKb4srBy9wUhOTulVVh8x6Oky+dRMV69Pu452UdrJDc9MnNAkAMQZ+JEUWzLvo6sWg QhinviZAjgCjchGEWFrPTh6QyrIh00U0UPunNM5hC78WfpF452j7lD77cTEVXZlMolQx ownA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SUI08Jcr; spf=pass (google.com: domain of john.stultz@linaro.org designates 2607:f8b0:400e:c05::22b as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-pg0-x22b.google.com (mail-pg0-x22b.google.com. [2607:f8b0:400e:c05::22b]) by mx.google.com with ESMTPS id q2si3812588pgn.692.2017.08.18.11.51.16 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Aug 2017 11:51:16 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 2607:f8b0:400e:c05::22b as permitted sender) client-ip=2607:f8b0:400e:c05::22b; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SUI08Jcr; spf=pass (google.com: domain of john.stultz@linaro.org designates 2607:f8b0:400e:c05::22b as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by mail-pg0-x22b.google.com with SMTP id t3so41497898pgt.0 for ; Fri, 18 Aug 2017 11:51:16 -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:in-reply-to:references; bh=Atk1s46YfMqtYSkYRGUwmfIxXBXUjXC9ExCBXE98tdA=; b=SUI08JcrcsKmWA/ObDTVmc971pM4rYvB4ClD+WlDWh5ukoj0OAquHAX8e6fjnh2rNF LvcT59dbiP1VvPca1SoH4VV6ncol5h0lI18qo+qwVALvpTOmB+un4IfUdXl6VIsLkqDg ao6uQd56tjgKuMjTNYU/FbRbxLqZ0btlFpshA= 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:in-reply-to :references; bh=Atk1s46YfMqtYSkYRGUwmfIxXBXUjXC9ExCBXE98tdA=; b=Si0sB+GX1jnhPEMFC4unq90DQ7n+Nqq4+5wd4jsoHwuSms2cLrq+rpuNNZIwS3BZL9 lZtwgleo4v3zRH2ugQQYnTbn1QVGm3JinYEiXCX7rSouGiDRYSVBE0Yg8lxXt77qH/Zh xobkO0zrM3+qnD0qU59TtjsFosiFkZ6YAuNVR0W0ZqiLIjh8PG2+zSFiGoYSc3cCCBTv I/hmUr2x1Fr4923irmXWaPxdruguJDrg/tDvKWTG7Dj4/OXjr+nDLiegyduQdovHRd2c 8tMDYH5E4eyXvVHpkggj7vgLhwUechXxQ2EhSrHYQANM1z4Dmd0gHWx8aiIOGeRqYxfb DAng== X-Gm-Message-State: AHYfb5i18w0iyrd0b0LpAg7WrTYQGp5/dCec6d2x0KGtL+qqqmcuqOyi XW4EnUaCCiL+NlhDuC8= X-Received: by 10.98.150.215 with SMTP id s84mr9860713pfk.109.1503082276201; Fri, 18 Aug 2017 11:51:16 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:1002:83f0:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id l132sm12518790pfc.150.2017.08.18.11.51.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 18 Aug 2017 11:51:15 -0700 (PDT) From: John Stultz To: lkml Cc: Stafford Horne , Thomas Gleixner , Ingo Molnar , Miroslav Lichvar , Richard Cochran , Prarit Bhargava , Stephen Boyd , John Stultz Subject: [PATCH 5/6] timekeeping: Use proper timekeeper for debug code Date: Fri, 18 Aug 2017 11:51:01 -0700 Message-Id: <1503082262-29450-6-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1503082262-29450-1-git-send-email-john.stultz@linaro.org> References: <1503082262-29450-1-git-send-email-john.stultz@linaro.org> From: Stafford Horne When CONFIG_DEBUG_TIMEKEEPING is enabled the timekeeping_check_update() function will update status like last_warning and underflow_seen on the timekeeper. If there are issues found this state is used to rate limit the warnings that get printed. This rate limiting doesn't really really work if stored in real_tk as the shadow timekeeper is overwritten onto real_tk at the end of every update_wall_time() call, resetting last_warning and other statuses. Fix rate limiting by using the shadow_timekeeper for timekeeping_check_update(). Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Miroslav Lichvar Cc: Richard Cochran Cc: Prarit Bhargava Cc: Stephen Boyd Fixes: commit 57d05a93ada7 ("time: Rework debugging variables so they aren't global") Signed-off-by: Stafford Horne Signed-off-by: John Stultz --- kernel/time/timekeeping.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.4 diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index cedafa0..8f58669 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -2066,7 +2066,7 @@ void update_wall_time(void) goto out; /* Do some additional sanity checking */ - timekeeping_check_update(real_tk, offset); + timekeeping_check_update(tk, offset); /* * With NO_HZ we may have to accumulate many cycle_intervals From patchwork Fri Aug 18 18:51:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 110429 Delivered-To: patches@linaro.org Received: by 10.140.95.78 with SMTP id h72csp1287536qge; Fri, 18 Aug 2017 11:51:18 -0700 (PDT) X-Received: by 10.98.153.72 with SMTP id d69mr9582820pfe.42.1503082278160; Fri, 18 Aug 2017 11:51:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503082278; cv=none; d=google.com; s=arc-20160816; b=JmPNnnDoOdrr6gHPPz/W+2XKd8fYF0gYYUfUcvXeRR8Lcd+i6abhLE1BuV4IMOSJVJ Tq8v2eF0pw+iStkKreFCG+PYoHkxZ4dN6bQauLqpJEsxfjWN3UE9XnZ40LoswWQGZDbd XAd5EVEShNOZKNVmQKyuwTf9twyPNBHeuXK8tnRnejYzc2YBHSIBTAr0d+HQ67/mBwJ2 k8OwEMxP2ZBMpk0+F91tbxuZu6xHjYix8WH3xUsCt3tQggFz6nIpivOKhJIoLletwCvb jiCQlrfa2hd4fyvzOhdeCYFFA6rk/imbns+OP5VJf0lkziLFC1+L0RUaQcgxDY2P9m9a qg2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=6pQAXFbmxJV7I+O44FkmresS14+0glnCnVod1cGQ8K4=; b=iYV8wpXt3mUlq7FpC8E5cwcgTMDD71AF708Caqq9NgTr214pWqBp3HstQELZED4Boy pZyqBhLfRCp6NKPDynBL3w/I2GVgOQpE1jQAguIKFsvJ6SCPEvYZAG+DqcWz+VMlZ8ov Ryek8URur64fT1ysWNcHvdm8SYgxjEvJBJuWPU3Q5miWu+6zMkffqxTV1htR1RzLnCEd 9IhSY9NoaKCyGrADBVaur+62opHadDclkS5O2v7NWItyQuXEDWQKmphSAWwX0YRyUvcc BZxRR7iY5T3S1drwatmqWbYb+BhamDNvWTPJQ7OnYs7cJFAwKd0tXPEayBI8btBW9xhY oxWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TkBkxZpK; spf=pass (google.com: domain of john.stultz@linaro.org designates 2607:f8b0:400e:c05::22e as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-pg0-x22e.google.com (mail-pg0-x22e.google.com. [2607:f8b0:400e:c05::22e]) by mx.google.com with ESMTPS id h3si4336095pln.575.2017.08.18.11.51.18 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Aug 2017 11:51:18 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 2607:f8b0:400e:c05::22e as permitted sender) client-ip=2607:f8b0:400e:c05::22e; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TkBkxZpK; spf=pass (google.com: domain of john.stultz@linaro.org designates 2607:f8b0:400e:c05::22e as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by mail-pg0-x22e.google.com with SMTP id t80so41913521pgb.5 for ; Fri, 18 Aug 2017 11:51:18 -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:in-reply-to:references; bh=6pQAXFbmxJV7I+O44FkmresS14+0glnCnVod1cGQ8K4=; b=TkBkxZpKqdU7aqNVdT/6CuQnLyCM7LbCNZaI0g+lNgmDZ3cbE1+8ocMC9qt1cgtIVR SfbCsxl3ty5/ukksvtJRVozs9q5Z8SCBBgmJsBV6UC8KJ2CKbRcZH0mrr/+dHO1obYbx i9247JtsBQGZDLSw+92ZC/9+rqYmiUPR94QuY= 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:in-reply-to :references; bh=6pQAXFbmxJV7I+O44FkmresS14+0glnCnVod1cGQ8K4=; b=RAzZZqGWAijsOixkpfcoLvpWUUz2LEU724Dppv6nfcWUnLxjzR5bhK2L8IdWkAuDE6 qfcGQdzQyklBPrONxfq6uG0MQaOkTCuRsGLq2lHurlDkXWs7jCuvtjOOto1A7L9FU0Ss ifeBzru/W5ECb0R4uh1zeJ6usHCGUF3QfLEGH3NzXiGk32WT3GxOTuuojpcJTdYeY/rj YTjamFRlGrcTWk2d179QOAKnyJKPJ0NfvCLs74Hbs3d1H9Pbf5FxWiGMzceSRdYMyCd6 /ZV1/RtDOzY6WcZNcopC/ELKxV/Wn9gVGre0vMJ/Cw1RXuA+UV/II/MM/JAYWoviX5wV t/nQ== X-Gm-Message-State: AHYfb5iQPOuIQ3K5n6p7H6QsWv8nrYxFqLdUHZfsOFnhacl1QWZDrD+m xkHeWSYQESN3/qF4poQ= X-Received: by 10.98.153.153 with SMTP id t25mr9610479pfk.224.1503082277886; Fri, 18 Aug 2017 11:51:17 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:1002:83f0:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id l132sm12518790pfc.150.2017.08.18.11.51.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 18 Aug 2017 11:51:16 -0700 (PDT) From: John Stultz To: lkml Cc: Geert Uytterhoeven , Thomas Gleixner , Ingo Molnar , Miroslav Lichvar , Richard Cochran , Prarit Bhargava , Stephen Boyd , John Stultz Subject: [PATCH 6/6] alarmtimer: Fix unavailable wake-up source in sysfs Date: Fri, 18 Aug 2017 11:51:02 -0700 Message-Id: <1503082262-29450-7-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1503082262-29450-1-git-send-email-john.stultz@linaro.org> References: <1503082262-29450-1-git-send-email-john.stultz@linaro.org> From: Geert Uytterhoeven Currently the alarmtimer registers a wake-up source unconditionally, regardless of the system having a (wake-up capable) RTC or not. Hence the alarmtimer will always show up in /sys/kernel/debug/wakeup_sources, even if it is not available, and thus cannot be a wake-up source. To fix this, postpone registration until a wake-up capable RTC device is added. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Miroslav Lichvar Cc: Richard Cochran Cc: Prarit Bhargava Cc: Stephen Boyd Signed-off-by: Geert Uytterhoeven Signed-off-by: John Stultz --- kernel/time/alarmtimer.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) -- 2.7.4 diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c index 0b8ff7d..73a2b47 100644 --- a/kernel/time/alarmtimer.c +++ b/kernel/time/alarmtimer.c @@ -56,9 +56,9 @@ static ktime_t freezer_delta; static DEFINE_SPINLOCK(freezer_delta_lock); #endif +#ifdef CONFIG_RTC_CLASS static struct wakeup_source *ws; -#ifdef CONFIG_RTC_CLASS /* rtc timer and device for setting alarm wakeups at suspend */ static struct rtc_timer rtctimer; static struct rtc_device *rtcdev; @@ -89,6 +89,7 @@ static int alarmtimer_rtc_add_device(struct device *dev, { unsigned long flags; struct rtc_device *rtc = to_rtc_device(dev); + struct wakeup_source *__ws; if (rtcdev) return -EBUSY; @@ -98,13 +99,20 @@ static int alarmtimer_rtc_add_device(struct device *dev, if (!device_may_wakeup(rtc->dev.parent)) return -1; + __ws = wakeup_source_register("alarmtimer"); + spin_lock_irqsave(&rtcdev_lock, flags); if (!rtcdev) { rtcdev = rtc; /* hold a reference so it doesn't go away */ get_device(dev); + ws = __ws; + __ws = NULL; } spin_unlock_irqrestore(&rtcdev_lock, flags); + + wakeup_source_unregister(__ws); + return 0; } @@ -860,7 +868,6 @@ static int __init alarmtimer_init(void) error = PTR_ERR(pdev); goto out_drv; } - ws = wakeup_source_register("alarmtimer"); return 0; out_drv: