Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp5056970ima; Tue, 5 Feb 2019 05:48:49 -0800 (PST) X-Google-Smtp-Source: AHgI3IaLQOtAULs/FsgniOXRcLQStNdOIQ7ukhasEkEkagWIWCFlDSAoN8FV579ZByFWWejOwu30 X-Received: by 2002:a17:902:2c03:: with SMTP id m3mr5050474plb.6.1549374529624; Tue, 05 Feb 2019 05:48:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549374529; cv=none; d=google.com; s=arc-20160816; b=T4uJjJM6aZyCvempnPbzQAivUAEYSd0YO4fMzCIVFxhfqR0fPPPu0wOjog+3UmeMoZ pR+0lphOxCfqFm/Q20UhuertCdmkBbnYVTZyyEFpYY8y3z3swCispxd/1nU47V0V0pV+ rzxp2tMJZgRlG7sq3WwWruuz22eCfjpnXLywHiHJtVvTKnr2vAM1NQu/KbW4BuYlqOkG M89VSCjUxW0JkV7V8j6SvDKQyESp74LWZqhnrm/HpF4RqOsP31VSFcJiqfIlMfTBRxMY 2FDwilEyY2TTcks9QtJWSKK7eP71cxVKYsN8eK5H4mxYPNFcjrPEUenQP8ALrgq6/3lg TTFA== 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 :in-reply-to:references:mime-version:dkim-signature; bh=hGz+KaIHU6kdZjr70CxUzqvL/Y3JaHXrvpE3EZ2OZfE=; b=UT2yC91fskp3cxnUV3nxJXzuq6pTTdDG0pH2xWgSF3g+DYapqRf4uX7BDGfiLPx4jT rye6eMWnxtqWGiSHXkIQKueA9jrir2Rd7JNMwERFKw1H+/ZWFfBlioKLI+QFSQc4HC1f yOQTixAi8zuW4sQyepSQBcTWZ8pSeacW+vOWHyBK9FDwpDDh1u2qFrh9NTpeKgRCqEH9 LQk5cUcp5HBARmR95+v/AKlvXCXfXImxvNV0K0yqBL1lm8+hxYjmW7mGpsKuxduF+Sal +9cX7ypj6Sv3h79zhPuBkONdu/elGbfadgMUjKtaDNPNk6cK3IP5ckUQS3icW3316Ym+ jymw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="z0W/wiQn"; 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 u21si3149437pgg.463.2019.02.05.05.48.33; Tue, 05 Feb 2019 05:48:49 -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="z0W/wiQn"; 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 S1729627AbfBENkm (ORCPT + 99 others); Tue, 5 Feb 2019 08:40:42 -0500 Received: from mail-vs1-f68.google.com ([209.85.217.68]:35564 "EHLO mail-vs1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729340AbfBENkl (ORCPT ); Tue, 5 Feb 2019 08:40:41 -0500 Received: by mail-vs1-f68.google.com with SMTP id e7so2158100vsc.2 for ; Tue, 05 Feb 2019 05:40:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=hGz+KaIHU6kdZjr70CxUzqvL/Y3JaHXrvpE3EZ2OZfE=; b=z0W/wiQn7JYbpAZ1ol9zt74MyT0lCGqciOPnKnapYHSRPgPTaEviiqgcQ9K1b2wh8i yPZ6PBrJDufXLkOGem2jmlKPtpWVxIzf1uDzjPvacUf1hdtQttxrmYJbCd3PsU+jgzsP /v9+mWIvCCW0dXF8zXGP8fBTWUpy9lhOLqvMYHJTByxbSYRFYyiVoWBXFhgJQJwWHozm 56qIIc3lJvN0RS56QJuXMFYFYKv7MK7k940KjaYavrVhrCM2YZdtnm8hB+YXfcFQ+8FI pKoDyJ61mVVH5zD06oYLTuwtyADsD5UHJ2Z4GHNeoL1Os741Fq1WTl1wJOeBqx7P7ZvU PHsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=hGz+KaIHU6kdZjr70CxUzqvL/Y3JaHXrvpE3EZ2OZfE=; b=LyoA5jZiSCeOiEd/f9FMWbbRfnfUYlNE/6GLel8XwH21rAYRg+Gg4SvdP8NHXOF1+i BMLfutxaicWiAisnbJSxLOmBl0yT1928SbXMPmwgAIbH3qnEiJv3LZLjy9oG9xsT24U5 sipDJwtT2J+Mqu9FqFyxhVQioNsVVv5MDtnq26BDhoxfAr4O/TWsHQPEMM0+ldYC+A04 N/mjmgjXhM5GA8XP0eLz70xWiZAS4S0T4PY+x1FHhL8/Reu4vsiUZdpuXGPnVJZqG8DF lCPEdybWbXrecunklbwoYa9mflcWZO5Wsm1Ca4NZQa6mQBfd7+VHLAQOFoQcuZOvBuXd U2Mw== X-Gm-Message-State: AHQUAuZCRiCLGnucQhYCc6oPBn+VvUJUb8l0E1msWTTxMhtmTLB/zWTd ogS9eYBTlNvoiUXhhN0AUZJuboYGJxg1uuKF2nTAWA== X-Received: by 2002:a67:b245:: with SMTP id s5mr2002390vsh.200.1549374040188; Tue, 05 Feb 2019 05:40:40 -0800 (PST) MIME-Version: 1.0 References: <1548846984-2044-1-git-send-email-vincent.guittot@linaro.org> In-Reply-To: From: Ulf Hansson Date: Tue, 5 Feb 2019 14:40:04 +0100 Message-ID: Subject: Re: [PATCH v2 ] PM-runtime: fix deadlock with ktime To: Geert Uytterhoeven Cc: Vincent Guittot , Linux PM , Linux Kernel Mailing List , Linux ARM , linux-omap , "Rafael J. Wysocki" , Biju Das , Linux-Renesas 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 Tue, 5 Feb 2019 at 14:24, Geert Uytterhoeven wrote: > > Hi Ulf, > > On Wed, Jan 30, 2019 at 1:15 PM Ulf Hansson wrote: > > On Wed, 30 Jan 2019 at 12:16, Vincent Guittot > > wrote: > > > > > > A deadlock has been seen when swicthing clocksources which use PM runtime. > > > The call path is: > > > change_clocksource > > > ... > > > write_seqcount_begin > > > ... > > > timekeeping_update > > > ... > > > sh_cmt_clocksource_enable > > > ... > > > rpm_resume > > > > Hmm, isn't this already a problem in genpd then? > > > > In genpd's ->runtime_resume() callback (genpd_runtime_resume()) we > > call ktime_get() to measure the latency of running the callback. > > > > Or, perhaps irq_safe_dev_in_no_sleep_domain() returns true for the > > genpd + device in question, which means the ktime thingy is skipped. > > > > Geert? > > Correct. After adding > > dev_info(dev, "%s: pm_runtime_is_irq_safe = %d, > genpd_is_irq_safe(%s) = %d => %s\n", __func__, > pm_runtime_is_irq_safe(dev), genpd->name, genpd_is_irq_safe(genpd), > ret ? "true" : "false"); > > I see on R-Car M2-W: > > sh_cmt ffca0000.timer: irq_safe_dev_in_no_sleep_domain: > pm_runtime_is_irq_safe = 1, genpd_is_irq_safe(always-on) = 0 => true > > For all other devices, the result is false. Thanks for confirming! I guess we have been lucky so far. Anyway, if runtime PM core converts to use ktime_get_mono_fast_ns(), we should probably consider to convert genpd to this as well. Don't you think? Kind regards Uffe