From patchwork Fri Nov 8 20:34:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 178956 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp3245394ilf; Fri, 8 Nov 2019 12:36:22 -0800 (PST) X-Google-Smtp-Source: APXvYqyvVWaJornQLuHXJ1yvnD547ZOL7Jmo1+JWSSs2L+xvpkhrbpIUdmaKmhr5ksV2Vtnbi10d X-Received: by 2002:a17:906:52c4:: with SMTP id w4mr9786423ejn.99.1573245382239; Fri, 08 Nov 2019 12:36:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573245382; cv=none; d=google.com; s=arc-20160816; b=XKXl5E+zaW+JHpGfS/ockuKDDq5+TT3TrGowxHPmUDVjT2cLeKIDCSVCEQAZfasgXE V65y57sx7Cq25T2fXmuevLGqFLosiMbmQdRZvZJeKhIBDZ9nqisEVvBriu9ZygpVM3/W 1Z6RLjqAI7we70Ve+dxeFliA/7najYQzwkVBmfpsw+NDr0hYeNJHptsQM5GJPB81JHQl 3PzBSO4zlkkAuGmr5OgdxxUV1u9B8PI714/gzxDn+KeAhA3IcKxaRbsBwveQpE8KOr/B PL0LFvpD/FOLkY8fnaQ5e8QU4uK8P7PbgrZNGsUXmyEqdYkEGzOmSMCdq+0Rd3UPSgGT /jqw== 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:date:subject:cc:to:from; bh=lTwlL6UTv3w6PPy2PU/pmLBX5Tt3HdqSKCsb19DB07w=; b=IVFEXVuJRGNggwLUjNsEANxwkDAa7aniiXNFqacULHzPCioIdF6yTcb8zPmgIzQkiR nwaZfwi9SbIzltE94g/nIUxFIGJAgv/mOedPEwjZpZ+N67DTc3ZNc9wM8Vgznq9aGQ0a R2NYGWQmfQRu5vputHW79C/dAlM7pjAZ6cUOqVqzcVMwZ1vpd3Gy6pvHwpFFeFIIlAq/ uIFW8rZjoffGRDb/pryo8GMPG3aEkjPA17JphdEnzAlhqIvQdlnyY63R6n6X8LWQFJ0t QfLLVtBjf+iPNnCy0aiY5L+Rtf3Db+uYMuhncqGuWredFkWn7FsSE7vgUHIJVqQlCA47 zQkA== 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 dd5si4572508ejb.179.2019.11.08.12.36.22; Fri, 08 Nov 2019 12:36:22 -0800 (PST) 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 S1732130AbfKHUgS (ORCPT + 26 others); Fri, 8 Nov 2019 15:36:18 -0500 Received: from mout.kundenserver.de ([212.227.17.13]:52967 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727148AbfKHUgS (ORCPT ); Fri, 8 Nov 2019 15:36:18 -0500 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.145]) with ESMTPA (Nemesis) id 1N7yuz-1hpfJe1Cz5-014yOw; Fri, 08 Nov 2019 21:35:57 +0100 From: Arnd Bergmann To: y2038@lists.linaro.org, Corey Minyard , Arnd Bergmann , Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, Corey Minyard , openipmi-developer@lists.sourceforge.net Subject: [PATCH 4/8] ipmi: kill off 'timespec' usage again Date: Fri, 8 Nov 2019 21:34:27 +0100 Message-Id: <20191108203435.112759-5-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191108203435.112759-1-arnd@arndb.de> References: <20191108203435.112759-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:5h5zjTJTFS7NU7dR3OxD3RGZD81MiMNfiSZHg3//WQd5cEspSJc LIApSfiSz9Te28wkEE3ctR6BIBgRSUZv+L8WoFHniGGNul2rk23RWvU9J1joypQooUlQ9/Y DGmmNTguceLb02Y1evbVHD9ZTU8F11CtM7iKaUrqM2+zVzRGt7fUWskVkjFrWQxFHRWNCDP Wk8+4Q6wKeQ6K8pK07LrA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:TcWOuYfgQ1c=:5rJazEAWe8fZzBgGo5S7kS vEWFdfZBBTUpkp+pnxRlr2kLO4coolsU4UPvtSI/uWs6ncs2JIzQNkPtmpnxkSNYqY4aluw1Q +WUFzBe0iTFJFKK3OGgLW//tPpefDApoosfIVPfo6ZqSCOyaCypL59y8vqDdr/WVrpBtdN37d odZGiMdY5BAPDC5mMpXRE3MShieMhVrCIMBrJ+1qfeGSLSNZp3v2Wpm73FJeTVztusApsgWh1 uVoMimJy7Hy3SiRv1FRWJrpeZ03G/WVodq3+zpnppq47d2x8WwuKbyAsOm9Lj/kKsIoLjUzF6 +E3JzqvTv/oEMEK3MMvyHK8dnFvwAgm3RBGKlDRVJw63T+HnP33YXm1rs5oo1o+7rrLAqJlep NfRtxeJ3aShvYjGwpd3WB5Q92YPyB1Dqu81MtAgh0pAOlDImOXcdSVSuuVzqP7MqqiYE++mue CWV6DkqUrt5stJvHGqX9unK2mFM8Ga2ukfxYgB2YE4KqpS9LBpCw0RvWlI6CRLyZEiBIqiJbn A0bs+MvnRh37jz1HsGtAXmFM01joN1dktLIurvpV9iBgaeusR6eSNg9ixohYBwRVtUEs/pBnk BdD8VFtif50YujggMHE6LqfQIqaBEBn8XIVhFhgolWqn4nZOyjx4m0cmTF7vv2R+8MeVGQ1yI fQ7g5IH0MGfIK2GnlcSeTTSo88dcMo83TyzJmhrXvQoHTYIdOsX1S5RK+nHQWsXzdNF/LILJq GqeI0NScCQSLY1bZhOGnhhafLyEiMv65GDYeYBdU2+lsuX8kew1uHY61pmcRpmKVwydWkjvuZ IMn9bi1scc/juK2D5DpZRKZTlm8qjQ1TxO3kLdowUbQAO0ufELXvrEh50YL25ros262CVd7Pt 97v5Wkz54JcwT1EXeUGw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 'struct timespec' is getting removed from the kernel. The usage in ipmi was fixed before in commit 48862ea2ce86 ("ipmi: Update timespec usage to timespec64"), but unfortunately it crept back in. The busy looping code can better use ktime_t anyway, so use that there to simplify the implementation. Fixes: cbb19cb1eef0 ("ipmi_si: Convert timespec64 to timespec") Signed-off-by: Arnd Bergmann --- drivers/char/ipmi/ipmi_si_intf.c | 40 +++++++++++--------------------- 1 file changed, 13 insertions(+), 27 deletions(-) -- 2.20.0 Reviewed-by: Corey Minyard diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index 6b9a0593d2eb..c7cc8538b84a 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c @@ -265,10 +265,10 @@ static void cleanup_ipmi_si(void); #ifdef DEBUG_TIMING void debug_timestamp(char *msg) { - struct timespec t; + struct timespec64 t; - ktime_get_ts(&t); - pr_debug("**%s: %ld.%9.9ld\n", msg, (long) t.tv_sec, t.tv_nsec); + ktime_get_ts64(&t); + pr_debug("**%s: %lld.%9.9ld\n", msg, t.tv_sec, t.tv_nsec); } #else #define debug_timestamp(x) @@ -935,38 +935,25 @@ static void set_run_to_completion(void *send_info, bool i_run_to_completion) } /* - * Use -1 in the nsec value of the busy waiting timespec to tell that - * we are spinning in kipmid looking for something and not delaying - * between checks + * Use -1 as a special constant to tell that we are spinning in kipmid + * looking for something and not delaying between checks */ -static inline void ipmi_si_set_not_busy(struct timespec *ts) -{ - ts->tv_nsec = -1; -} -static inline int ipmi_si_is_busy(struct timespec *ts) -{ - return ts->tv_nsec != -1; -} - +#define IPMI_TIME_NOT_BUSY ns_to_ktime(-1ull) static inline bool ipmi_thread_busy_wait(enum si_sm_result smi_result, const struct smi_info *smi_info, - struct timespec *busy_until) + ktime_t *busy_until) { unsigned int max_busy_us = 0; if (smi_info->si_num < num_max_busy_us) max_busy_us = kipmid_max_busy_us[smi_info->si_num]; if (max_busy_us == 0 || smi_result != SI_SM_CALL_WITH_DELAY) - ipmi_si_set_not_busy(busy_until); - else if (!ipmi_si_is_busy(busy_until)) { - ktime_get_ts(busy_until); - timespec_add_ns(busy_until, max_busy_us * NSEC_PER_USEC); + *busy_until = IPMI_TIME_NOT_BUSY; + else if (*busy_until == IPMI_TIME_NOT_BUSY) { + *busy_until = ktime_get() + max_busy_us * NSEC_PER_USEC; } else { - struct timespec now; - - ktime_get_ts(&now); - if (unlikely(timespec_compare(&now, busy_until) > 0)) { - ipmi_si_set_not_busy(busy_until); + if (unlikely(ktime_get() > *busy_until)) { + *busy_until = IPMI_TIME_NOT_BUSY; return false; } } @@ -988,9 +975,8 @@ static int ipmi_thread(void *data) struct smi_info *smi_info = data; unsigned long flags; enum si_sm_result smi_result; - struct timespec busy_until = { 0, 0 }; + ktime_t busy_until = IPMI_TIME_NOT_BUSY; - ipmi_si_set_not_busy(&busy_until); set_user_nice(current, MAX_NICE); while (!kthread_should_stop()) { int busy_wait;