Received: by 10.223.176.5 with SMTP id f5csp4088372wra; Tue, 30 Jan 2018 01:50:29 -0800 (PST) X-Google-Smtp-Source: AH8x225P2Js6ZzYfo6PNRsh/heuO2I4FtAhdY37YfcRkTJGB3+LQA232Q1F8ewmxDfYGNynWUn/O X-Received: by 2002:a17:902:bcc6:: with SMTP id o6-v6mr23908693pls.4.1517305829654; Tue, 30 Jan 2018 01:50:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517305829; cv=none; d=google.com; s=arc-20160816; b=LrxtteBIriu/cv/uEd0yPXCE+ZMdu1p3NfOe9d19wJC0f6bmOpY8EQzuUj0Z1qfvld WAM9sU2XxG/J2k+TLv9mWjZg3TJ+R17r60V8ENpYeLNQWqFK54N57kHnDx02KkrHqDCC 3HAvxztD6IsMUHjotY+FWBkCbjGSdZLi4LFO3+FIqoJYwf8VBUCLSYU3sOApP1izf/eQ 0Gck0x44aGSm11tgHqbcJBiEkP1DXex1A4aP7qgrnuTu+UAK2ygZfXQZrqEHEMauO2i0 g6L6+K+6OR2SOq+8w0i50YzveZ37/KGn1Npc9QPqq7MImx75E3AeMYynjOjVlJwZwhb/ l6EQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=nNYjzn6kaIBD5NtI6cfJCces0iSFhU5bLd1Gm4Q6aPQ=; b=sNkoFQEmr3pgPxLWOOQjVDHuAO8SCJ+z/xc8b0/c9Y5VfiHUGBX5x9KP8rYQSlCRym ehYztBmA1aMq15mxqJCZpJwwqrNrKKCWY4TROutyGskUtmI60h+OzXMfa94myqd3m/qI OEPn/6wHUjLnj5FEcE0nKQpcnM3y69rg67dF2bkugI0ON1OBesnL+DCZaz5NIPQyJVcf JSMjTf/0D6DCfFU0Al2F4lMClneuxDA/IKGwJyrzn+CdaWVg6Lz7lbttFFeXHRKZHfYo PZ+zzyyofb5bpx/xvQKBgJxxTLW8XP1cf19opB6bQ8tPCeRtg7ZpDrjmDwVJNs93Yhul n8Qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Q6YXsts7; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 32-v6si754424pls.227.2018.01.30.01.50.14; Tue, 30 Jan 2018 01:50:29 -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; dkim=pass header.i=@linaro.org header.s=google header.b=Q6YXsts7; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751759AbeA3Js4 (ORCPT + 99 others); Tue, 30 Jan 2018 04:48:56 -0500 Received: from mail-wr0-f196.google.com ([209.85.128.196]:33683 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751671AbeA3Jsp (ORCPT ); Tue, 30 Jan 2018 04:48:45 -0500 Received: by mail-wr0-f196.google.com with SMTP id s5so10412880wra.0 for ; Tue, 30 Jan 2018 01:48:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=nNYjzn6kaIBD5NtI6cfJCces0iSFhU5bLd1Gm4Q6aPQ=; b=Q6YXsts7mlfH3YeV7W29ZASusE4LpL4SPA1O7wjfG7yNHGN7ptq1g0Gb9X+uugvsfb lVW1ZOmhK66mXwBbwGkSF2l7qRaRX61XCjPBiyQkTtg4Mi8NWX3J6ojYRJUkqz1CTHea Fi5fezFb3kEgQuy0GxzquPkXjgYOD8sR2Kf/4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=nNYjzn6kaIBD5NtI6cfJCces0iSFhU5bLd1Gm4Q6aPQ=; b=jH6B0Xww2VH8eDaRoZpSsBUGxY+5O4Ozr47U8/H63esOkUA4/i48IWIYyoLN5pvfp4 rKGNDuOJMiela0UD0KteYZCi47JZSeFPeYsL+Jj53g0YIKt5TSuD/9yH+qsAPSosAxF4 Eswa/V+lp7Z2+AGKdE1QAb1pxLrrsTvxXFbDRhmWFAd182dZB8gtdQAth7GcJJ+sZUhs nMKFY8tQutBS0len9bFFW2Bow6VWyEhMCC1/y7bmN9wqOhh+spo61iiorDQfkDwWsR+j 8GcO1pa8ZoeDmT5p3d7KwFhJvPjaY6kBScRnZRs8uco7HmCr8rEDTMMrjMjWeNpXLXXf YRlA== X-Gm-Message-State: AKwxytcQqKbJEfR1H5TLQPqDTtvM5MJ9RLOhuszyzRrzZQbal+dJ7Rna KRa6N3e5h6QPt40o0iI97vXOvA== X-Received: by 10.223.201.11 with SMTP id m11mr6169655wrh.112.1517305724268; Tue, 30 Jan 2018 01:48:44 -0800 (PST) Received: from oak.lan (cpc141214-aztw34-2-0-cust773.18-1.cable.virginm.net. [86.9.19.6]) by smtp.gmail.com with ESMTPSA id y55sm25799781wry.87.2018.01.30.01.48.43 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 30 Jan 2018 01:48:43 -0800 (PST) Date: Tue, 30 Jan 2018 09:48:41 +0000 From: Daniel Thompson To: Baolin Wang Cc: jason.wessel@windriver.com, mingo@kernel.org, arnd@arndb.de, broonie@kernel.org, kgdb-bugreport@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] kdb: use ktime_get_mono_fast_ns() instead of ktime_get_ts() Message-ID: <20180130094841.x47uqbb5co3pe5zi@oak.lan> References: <3f15868475cb4b32353885ee03c983209279fa81.1517192387.git.baolin.wang@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3f15868475cb4b32353885ee03c983209279fa81.1517192387.git.baolin.wang@linaro.org> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 29, 2018 at 10:22:51AM +0800, Baolin Wang wrote: > The kdb code will print the monotonic time by ktime_get_ts(), but > the ktime_get_ts() will be protected by a sequence lock, that will > introduce one deadlock risk if the lock was already held in the > context from which we entered the debugger. > > Thus we can use the ktime_get_mono_fast_ns() to get the monotonic > time, which is NMI safe access to clock monotonic. Moreover we can > remove the 'struct timespec', which is not y2038 safe. > > Signed-off-by: Baolin Wang Reviewed-by: Daniel Thompson > --- > Changes since v1: > - Use ktime_get_mono_fast_ns() instead of ktime_get_seconds(). > --- > kernel/debug/kdb/kdb_main.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c > index 69e70f4..bf1d0e0 100644 > --- a/kernel/debug/kdb/kdb_main.c > +++ b/kernel/debug/kdb/kdb_main.c > @@ -2486,10 +2486,10 @@ static int kdb_kill(int argc, const char **argv) > */ > static void kdb_sysinfo(struct sysinfo *val) > { > - struct timespec uptime; > - ktime_get_ts(&uptime); > + u64 uptime = ktime_get_mono_fast_ns(); > + > memset(val, 0, sizeof(*val)); > - val->uptime = uptime.tv_sec; > + val->uptime = div_u64(uptime, NSEC_PER_SEC); > val->loads[0] = avenrun[0]; > val->loads[1] = avenrun[1]; > val->loads[2] = avenrun[2]; > -- > 1.7.9.5 >