From patchwork Mon Jun 20 15:56:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102129 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp1579255qgy; Mon, 20 Jun 2016 08:56:41 -0700 (PDT) X-Received: by 10.98.72.80 with SMTP id v77mr12038717pfa.133.1466438201672; Mon, 20 Jun 2016 08:56:41 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e28si33938646pfk.242.2016.06.20.08.56.41; Mon, 20 Jun 2016 08:56:41 -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 S1755215AbcFTP4i (ORCPT + 30 others); Mon, 20 Jun 2016 11:56:38 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:58388 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753260AbcFTPzB (ORCPT ); Mon, 20 Jun 2016 11:55:01 -0400 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue001) with ESMTPA (Nemesis) id 0M9j7n-1b5zvR02Xf-00CvhE; Mon, 20 Jun 2016 17:54:50 +0200 From: Arnd Bergmann To: "Paul E. McKenney" Cc: Arnd Bergmann , Boqun Feng , Josh Triplett , linux-kernel@vger.kernel.org Subject: [PATCH] torture: use ktime_t consistently Date: Mon, 20 Jun 2016 17:56:40 +0200 Message-Id: <20160620155651.2497676-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:2yBTTrYe/AuqTA2JAp8Ju8w4DvtFVDNzAQR6QOvT/hgg7UE7+Vu BfdbuLq9YAh4xer50w5f1ySbqgTyxqJruOa6OzagOpj1kkF5gev7KQyIurGydoewHsYfRmo WhhJqXJxBHVb3JXh//5bhFhhQKmeIQ1lfI5Nfp1MA4jmR73YVxRJzkeVRGP1nW6Ic0ex8hU eaWuyKW87886pW6WlKjjg== X-UI-Out-Filterresults: notjunk:1; V01:K0:llKetQH8s/I=:TBuJcCam+BW7JfL33iUVFK WT8+I+UJ3gzf0G6k+rcrgygzS0Er1msPRiPuBZpSFOsvn/Ro7RRrbx2/xSNTyXlAdtstToBMy c90cS5D+15k1lw5vbG89d79Wk/dXZw+Pynz9hnlV63rfRCmMpy3n4E4wCbBNFpemVqF4iWWrc AcUjgo2X5FqUiVSdUh9Xj/cUVKyHH/MqdG8buVCAbIdDydJ0uBnMMdcb12bcUNGR9WM7aH7dc E6fNqVJCOGarZ9QsxujWN2edmB0J16EWyhYFbHz+ZGnMZiL9XnAdBmsl3XnwTyZWWF15B8Cu2 HkYVUcnv3XcEzUEvPECtVmWuXCL35640eavCgJPrlGMQU+RRZCsdiyFR5lZHVW4rF1NKovvf8 7I+Crc4D+8erBUSwmgx/uADDA3vN2jTanK50c1OGcVNi16zbKiCBKZ/1hXYcuB8t22AyB0KOx Lav1RIoBTjvw+6KKNJchmhr/2vBl2yLSooA9G9cgA9kjGXD5gPPU2oZJMMfssHN2GCst6bTqG XmkJtcosK2Bu++bZ/KEGyOegmMtItOpLNGlSZvjNSu6Tqaz1/ZAYeeWf7Oh3sUMdhVANeAyGH JvuX4vCfmqdVsLCu05biZYKJM5dydLD08lqdAnaudqK8ZgLQSWBqCgkDnQRZPwsd9u86FLd1y L/F1FmueGQUraVUqZOAGYg+e1J1MY3Avlwvc0gCWRpsE6PQnRgOUWunjmrXHRfHo+FVE= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A recent change accidentally introduced a 64-bit division in torture_shutdown, which fails to build on 32-bit architectures: kernel/built-in.o: In function `torture_shutdown': :(.text+0x4b29a): undefined reference to `__aeabi_uldivmod' This converts the function to use ktime_t instead, which also simplifies it a little. Signed-off-by: Arnd Bergmann Fixes: b4aa201e0c7c ("torture: Convert torture_shutdown() to hrtimer") --- kernel/torture.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) -- 2.9.0 diff --git a/kernel/torture.c b/kernel/torture.c index 55f0a317fbb5..bbcc92088bf9 100644 --- a/kernel/torture.c +++ b/kernel/torture.c @@ -448,7 +448,7 @@ EXPORT_SYMBOL_GPL(torture_shuffle_cleanup); */ static int shutdown_secs; /* desired test duration in seconds. */ static struct task_struct *shutdown_task; -static unsigned long shutdown_time; /* jiffies to system shutdown. */ +static ktime_t shutdown_time; /* time of system shutdown. */ static void (*torture_shutdown_hook)(void); /* @@ -471,24 +471,19 @@ EXPORT_SYMBOL_GPL(torture_shutdown_absorb); */ static int torture_shutdown(void *arg) { - unsigned long long delta; - unsigned long jiffies_snap; - ktime_t wait_duration; + ktime_t now, delta; VERBOSE_TOROUT_STRING("torture_shutdown task started"); - jiffies_snap = jiffies; - while (ULONG_CMP_LT(jiffies_snap, shutdown_time) && - !torture_must_stop()) { - delta = shutdown_time - jiffies_snap; + now = ktime_get(); + while (ktime_before(now, shutdown_time) && !torture_must_stop()) { + delta = ktime_sub(shutdown_time, now); if (verbose) pr_alert("%s" TORTURE_FLAG - "torture_shutdown task: %llu jiffies remaining\n", - torture_type, delta); - delta = delta * 1000ULL * 1000ULL * 1000ULL / HZ; - wait_duration = ns_to_ktime(delta); + "torture_shutdown task: %llu ms remaining\n", + torture_type, ktime_to_ms(delta)); set_current_state(TASK_INTERRUPTIBLE); - schedule_hrtimeout(&wait_duration, HRTIMER_MODE_REL); - jiffies_snap = jiffies; + schedule_hrtimeout(&delta, HRTIMER_MODE_REL); + now = ktime_get(); } if (torture_must_stop()) { torture_kthread_stopping("torture_shutdown"); @@ -518,7 +513,7 @@ int torture_shutdown_init(int ssecs, void (*cleanup)(void)) shutdown_secs = ssecs; torture_shutdown_hook = cleanup; if (shutdown_secs > 0) { - shutdown_time = jiffies + shutdown_secs * HZ; + shutdown_time = ktime_add(ktime_get(), ktime_set(ssecs, 0)); ret = torture_create_kthread(torture_shutdown, NULL, shutdown_task); }