Received: by 10.223.176.46 with SMTP id f43csp861283wra; Fri, 26 Jan 2018 08:03:15 -0800 (PST) X-Google-Smtp-Source: AH8x224wZP0CbyhX6kKtY95pOOOhzxdCsEREsJt3HHh5P5mQXNhQVC0g8RTVnVJCnEcY/XGX3XmY X-Received: by 10.99.67.133 with SMTP id q127mr16108300pga.365.1516982595076; Fri, 26 Jan 2018 08:03:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516982595; cv=none; d=google.com; s=arc-20160816; b=GTWYVXfl3m3+YhDf3lfeErB90MiYmN4Kup8FmWDDnO3SJyVENuTEwkuN2fYg6m8mOC ck66DGJY+Mq7Ebknoe6CsWooygb1dr5YM3yMp8Q4zOesLU3W20SWqO/EN7w1AHhKd8LT UecNsCBD3Fwvlrl5Nf/kv6JklKF7GS+lW7HwLA2wS0iTgvNjY6z1XR7oh3LZjP2vMvVg 7LDPN5uktkKf8IjCPXOxc91o/gezjfVQhTCn8UbBOuobVqaw0gPyEgJyJ/YCGnmZV49j EhGQrxCqJmJigmOodWPd2K6fR8M4BYhn44naQ9mm2ny48b1fO+3Qat1F+PKCfvUbDx6n CT0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=VzJVhM+xRNCl1Oaa7MNXQDUiMviJxsvy81y2cchbfZk=; b=rlnJMNjWYzcu69ipVYCzKoNfEJAsk+QzhwOyc0O/sv7Woqhs1tulXOzaH3mZXC8Y/b gNWmQhw4tBBLG0b3JKZl0s2ZDeXf8dobApyJWovH6IE0C7LRy9WY1RV+ahZufervlT5R BOZsO0+ZGFhmBo8L9P7vWFx1csxAj7H9W9JrxtOHW0SlTaw1EUGObnw8xid5aOpPUK/U OFUOLfrF+h5NAgczvnjDRlL4ogqQcl31PV3+KakZPXEebVwZhjTSCX5njGKnVQSHlsn2 g1MLuOKXnKm/3N1RGSP8PTtru0HSNEX5mruYhoUZQ6brHt7zgIkv76uMU0MnT1DMg21h 8k7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=I+poXRjz; 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 c81si6505548pfe.306.2018.01.26.08.03.00; Fri, 26 Jan 2018 08:03:15 -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=fail header.i=@gmail.com header.s=20161025 header.b=I+poXRjz; 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 S1753731AbeAZQBg (ORCPT + 99 others); Fri, 26 Jan 2018 11:01:36 -0500 Received: from mail-ot0-f193.google.com ([74.125.82.193]:42957 "EHLO mail-ot0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753751AbeAZQBe (ORCPT ); Fri, 26 Jan 2018 11:01:34 -0500 Received: by mail-ot0-f193.google.com with SMTP id s3so792583otc.9 for ; Fri, 26 Jan 2018 08:01:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=VzJVhM+xRNCl1Oaa7MNXQDUiMviJxsvy81y2cchbfZk=; b=I+poXRjzoyIZGLJE9o0QPype1KIO9CP4iHIwj7wQP5WQi3YM+mylaMeCLqnVdTBUhC EyLEER/fMWjHY/yv0jEBvW4WOeM0DQvpWjm5MkwI5AUEAWAGwOhnjILqRuzw0kvJmJek A+KnzshXrRomnjjlTv0A0rkGXlFqZS4UZ2jjOqALrvZ6IZhPxJEOhVi9WLAC868e9U1Y JyruLoZmFMEvilm7e6c1Hr+R3W2gE6gsWXi4ijS6JrBh/5LLTvVmUf7S8eMIBOw2IO+n yDgyBQK9ZGiNlXkFK8e9/w9MegPgQHdy9BS3ah1rUhe54Qwg8cYAs4z0n/rJDNoGJiG1 2f3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=VzJVhM+xRNCl1Oaa7MNXQDUiMviJxsvy81y2cchbfZk=; b=XhxRZPOiY2WofpAqil9spJbsl/USN1q8o1WgKuz4WeHaj7vk/XFwc8tkFtodpeqkNK 3mARCDFlU+BH6GF7j2tzDa8MmABwjHLEHjmyYiQpeKKwYjUiHZNL9H+8GWqESwL8KEVk lyA5gCSiJyI4WIHbOKbiuJ3yLqQhGAXu2wDJkq4uBZaM+6gImoB+74Efx4wJ0vS0PQGG kkkktQY5Vh0gEi6BDGGmNPKeuQfivAEZhxGg61cMZM01p//cR637VLXTNWffn21m2TOs bbLVtjRrSIMa3sO5/bG1FEBDuINKtQbISYLE9pykZW9Iob9teRa7iNVcvJlRj+bTQeGR k5wA== X-Gm-Message-State: AKwxytfMXhNz00tp7BxRfQ1TzJ8ZkmYxTB7LmZGTIecY4IIibgfhWW8O Ql4Nrg2PG6EoQ/Ys+LrO4IDgsl2CCq3m1t1wBbY= X-Received: by 10.157.50.5 with SMTP id t5mr13981663otc.172.1516982493232; Fri, 26 Jan 2018 08:01:33 -0800 (PST) MIME-Version: 1.0 Received: by 10.157.68.119 with HTTP; Fri, 26 Jan 2018 08:01:32 -0800 (PST) In-Reply-To: References: <20180126140033.ix2n7j62k6iccmdh@oak.lan> From: Arnd Bergmann Date: Fri, 26 Jan 2018 17:01:32 +0100 X-Google-Sender-Auth: I-pVyRCzOWn0da_uF99yTHY5RB8 Message-ID: Subject: Re: [PATCH] kdb: use ktime_get_seconds() instead of ktime_get_ts() To: Baolin Wang Cc: Daniel Thompson , Jason Wessel , Ingo Molnar , Mark Brown , kgdb-bugreport@lists.sourceforge.net, Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 26, 2018 at 3:20 PM, Baolin Wang wrote: > On 26 January 2018 at 22:00, Daniel Thompson wrote: >> On Fri, Jan 26, 2018 at 10:21:58AM +0100, Arnd Bergmann wrote: >>> On Fri, Jan 26, 2018 at 4:03 AM, Baolin Wang wrote: >>> >>> Using ktime_get_seconds() avoids locking problems, but I wonder what >>> would happen if we trigger the 'WARN_ON(timekeeping_suspended)' >>> from kdb. Is that a problem? If it is, we have to use ktime_get_mono_fast_ns() >>> and div_u64() instead. >> >> Normally a WARN_ON() doesn't triggered a kgdb_breakpoint() so (apart >> from bugs) we can start executing the warning. Unfortunately >> kdb_trap_printk isn't set when we call ktime_get_seconds() so printing >> the warning isn't safe. >> >> If we had no choice of time function we could work around by >> enabling printk() trapping for the call but since ktime_get_mono_fast_ns() >> already exists its probably best just to use that. >> > > If timekeeping_suspended is set, which means the system had been in > suspend state. So now we still need debugger the system? But cores > were already powered down. I'm not using kdb myself, but I would assume that trapping into the debugger during a suspend/resume bug is a very important scenario. > The ktime_get_mono_fast_ns() will access the the clocksource driver, > if the timekeeping is suspended following system suspend and the > clocksource is not SUSPEND_NONSTOP, we may meet some unexpected issue > to access the timer's register without clock. So I am not sure if > ktime_get_mono_fast_ns() can work well for this case. I misread the code the same way before, but as Thomas Gleixner pointed out, ktime_get_mono_fast_ns() will not call the clocksource driver when timekeeping is suspended. See halt_fast_timekeeper(). Arnd