Received: by 10.223.176.5 with SMTP id f5csp2367757wra; Sun, 28 Jan 2018 19:02:28 -0800 (PST) X-Google-Smtp-Source: AH8x226OAUQcZ88zBZp8Gpxu4P0PsMhfvIf90d8gSeb5gNBqeWXlPMRaXzaT3OhyOb/SrHsfQvip X-Received: by 10.98.47.193 with SMTP id v184mr25036264pfv.90.1517194948215; Sun, 28 Jan 2018 19:02:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517194948; cv=none; d=google.com; s=arc-20160816; b=gTLoEafZutjzSTWAeqrQ1OG6hDmNMtoRYQ4jXlmqXsqKH59wYjRBKsoXxe4XSk3yU0 fxGSN2EX5m6q+zy1Ix+7ws8mMuvi/gVy5qxGqBxEbUI+4W/k0oq4ZQrhjh+UPXJWmwna OnM9uCw9TOFrAjFo4C6CMya1016hwtddkEkT5J78PxkztNfBwwetdrdRrWEwDaTi/5CV pYpUeZfAnsPTd6Dl91QISPRzLqcaduiyzbadiIw+V64QBgEB/96gKbXC8C4x09zXJ2AF fL3ZlNFFUYJs8YRWJYiSFlu1QigG0ImA4CaJGJwjavsxSQzsCkQAH/82UU911pVC5Ft9 f0eg== 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=BKG+XoIGq/BDHiulZqgWv2NeB0vKzhw89T6R2e6q+Qg=; b=c4DkoNdX8ngoTh+3vQl37ZE8bGjczAr44Q5O1VHJdcroeKp9nBJZOrIZae6lbngusp il4sXIJsckdgOdyqWHyHF+OMSNO63U3WkhIAStjUcNekkUiTYvYbd2SOHxTBz5eFT6dm 3zR+7DFaB06fbF+aOqjMzEgiw2yslIKwl0MZBQqW68ZhhbKiu0ZCZivz1q98m7OKbXzf TC6Pc3N6IsCtMTD3RFJQSSrggE4VOSn6/7jWBOZ8gGNWPSz7X2qQWQbLWINjeG3tLG7F 0nsww/iTIDnVnG+CnrRPEkupvazDj6tubL1zHbh65CDs8A3s+OnBB3Bmkvzq8/pmvlys qIrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eO0f1btD; 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 u10si556678pgp.222.2018.01.28.19.02.13; Sun, 28 Jan 2018 19:02:28 -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=eO0f1btD; 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 S1754662AbeA2BtW (ORCPT + 99 others); Sun, 28 Jan 2018 20:49:22 -0500 Received: from mail-ot0-f193.google.com ([74.125.82.193]:32889 "EHLO mail-ot0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754643AbeA2BtS (ORCPT ); Sun, 28 Jan 2018 20:49:18 -0500 Received: by mail-ot0-f193.google.com with SMTP id d7so5130259oti.0 for ; Sun, 28 Jan 2018 17:49:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=BKG+XoIGq/BDHiulZqgWv2NeB0vKzhw89T6R2e6q+Qg=; b=eO0f1btDbvyjVzPB/JOSKScRmMkEN16+3IHMe9GMcN65FXtu2ou+XcCZ9ofF6UDpPc QZ45JHOwyyMAbrsfzZLIvZXx1/chHPymOU1g2RGqK4mGwpcwHqN60Uw7qbRLGECIt6Kc /GDkFI9Z7pnd+9qV7I3v1kjy/lfRDqTzIiK3s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=BKG+XoIGq/BDHiulZqgWv2NeB0vKzhw89T6R2e6q+Qg=; b=B8pFJKuobgkqlAagv8gRO0WhAzwsxhTYfWIopS910Ov9r7gRTFk+VAH12YOyTWXUJa szmzlwYLJneVGyHrZevD/0oNO7nyioqzP0IQPNoFLloJvXJKxAUH/bix8qRsj4iqiQGH ESZGAXv7gey0/Hc0ZrtE0CgjeFsCDpvsg9pP/9qLI6eIWrEf2uPPVJx4ZEPM8wrX95ql 9sp3ZngMlRiWLkW+qko7Tx2vQ89bur11actllWtwDNkYZnFC9AJPqLa1ukmAR508ISez acKjEAz9+xmskt8tdjEqqSkX/QpcMnxFgCZrXXVAg++LgbFy9lrPb32CWgA5rtk8lIEp vz8g== X-Gm-Message-State: AKwxytfySyEW06uHe27ozqqsK/XVQzdQueFBfjHtVhneYIr7jidkxHpj Ql8STzsW4ME3OZ/uZifkmpgxxRLqwOi96FsDW6hzURtJ5nQ= X-Received: by 10.157.15.97 with SMTP id 88mr17114976ott.223.1517190558077; Sun, 28 Jan 2018 17:49:18 -0800 (PST) MIME-Version: 1.0 Received: by 10.157.28.174 with HTTP; Sun, 28 Jan 2018 17:49:17 -0800 (PST) In-Reply-To: References: <20180126140033.ix2n7j62k6iccmdh@oak.lan> From: Baolin Wang Date: Mon, 29 Jan 2018 09:49:17 +0800 Message-ID: Subject: Re: [PATCH] kdb: use ktime_get_seconds() instead of ktime_get_ts() To: Arnd Bergmann 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 27 January 2018 at 00:01, Arnd Bergmann wrote: > 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(). Ah, I missed halt_fast_timekeeper() too, thanks for pointing it out. Now I think ktime_get_mono_fast_ns() can work for this case. Jason, could you drop the previous patch? I will respin v2 to use ktime_get_mono_fast_ns() as Arnd suggested. Thanks. -- Baolin.wang Best Regards