mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jason Wessel <jason.wessel@windriver.com>
To: Baolin Wang <baolin.wang@linaro.org>, <daniel.thompson@linaro.org>
Cc: <mingo@kernel.org>, <arnd@arndb.de>, <broonie@kernel.org>,
	<kgdb-bugreport@lists.sourceforge.net>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] kdb: use ktime_get_seconds() instead of ktime_get_ts()
Date: Thu, 25 Jan 2018 21:31:59 -0600	[thread overview]
Message-ID: <4c5edb5b-8d48-3fb3-2068-2493df228ed2@windriver.com> (raw)
In-Reply-To: <b3c1e952cfff95e0289772d6af5ec2ebd6cc3141.1516935110.git.baolin.wang@linaro.org>

On 01/25/2018 09:03 PM, 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.
>
> Since kdb is only interested in the second field, we can use the
> ktime_get_seconds() to get the monotonic time without a lock,
> moreover we can remove the 'struct timespec', which is not y2038
> safe.
>
> Signed-off-by: Baolin Wang <baolin.wang@linaro.org>

Acked-by: Jason Wessel <jason.wessel@windriver.com>


Thanks.   Added to the kgdb-next branch for the next merge cycle.

Jason.

> ---
>   kernel/debug/kdb/kdb_main.c |    4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c
> index 69e70f4..f0fc6f7 100644
> --- a/kernel/debug/kdb/kdb_main.c
> +++ b/kernel/debug/kdb/kdb_main.c
> @@ -2486,10 +2486,8 @@ static int kdb_kill(int argc, const char **argv)
>    */
>   static void kdb_sysinfo(struct sysinfo *val)
>   {
> -	struct timespec uptime;
> -	ktime_get_ts(&uptime);
>   	memset(val, 0, sizeof(*val));
> -	val->uptime = uptime.tv_sec;
> +	val->uptime = ktime_get_seconds();
>   	val->loads[0] = avenrun[0];
>   	val->loads[1] = avenrun[1];
>   	val->loads[2] = avenrun[2];

  reply	other threads:[~2018-01-26  3:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-26  3:03 Baolin Wang
2018-01-26  3:31 ` Jason Wessel [this message]
2018-01-26  9:21 ` Arnd Bergmann
2018-01-26 14:00   ` Daniel Thompson
2018-01-26 14:20     ` Baolin Wang
2018-01-26 16:01       ` Arnd Bergmann
2018-01-29  1:49         ` Baolin Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4c5edb5b-8d48-3fb3-2068-2493df228ed2@windriver.com \
    --to=jason.wessel@windriver.com \
    --cc=arnd@arndb.de \
    --cc=baolin.wang@linaro.org \
    --cc=broonie@kernel.org \
    --cc=daniel.thompson@linaro.org \
    --cc=kgdb-bugreport@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®