Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp19838997ybl; Sat, 4 Jan 2020 10:22:20 -0800 (PST) X-Google-Smtp-Source: APXvYqydeAsp0HgWn739sVDgdFLaNUXMIYusVpl3CIbONq9RYxsLZdJO/LWly7NguzgC64xrFcgr X-Received: by 2002:a05:6830:1248:: with SMTP id s8mr104643450otp.202.1578162140279; Sat, 04 Jan 2020 10:22:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578162140; cv=none; d=google.com; s=arc-20160816; b=en3XKIAgtwU220ze5ib0DowAGvoYbwTbU9GsEF9A7WKZhvxI/HpwOB0ppflyoOn106 eVugu5Xrjiwf1ylHTIHrPOlQn/SRee8qBCy06MBdy27CNSI1JWZoW/MiTtAuSGmlTgT7 OuSwW6z/z2dm7Va/nIjf8v0rK4YNFvsSknGq1J46YStMmbUNQpW2VfWjP7j/aXkIM5Yb i5rMLTGQHcM5bBiSDK0cMTA0xsaOojCYWqGoM7ZcDixB2PzGJ3TwTRtxeKWaLZDc7xpA 0hPbvpnaRjpNwGQCGA9JANmX3haEYPC5UqCwhkiIlStskQxcJf3hfmb1cvmz0kjjdHKu Bijg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=0/0n1jTQzE6CvsRUj3o27x7AfJCImf+wcvBqh0aaImk=; b=k62qaDwaUYmnU64onxCzovVuXQrsI38eprOnGvKKK4j6HqjxCMLtin9447K5seYkjV ahWgz/mymSBSEHbmjAhUrvmBKSRIHPvxfGOY+N5960PQHwr7+UxZIksiwWks7V1R7F0z v1Th3Qo4la7eT5VQAUk29S8OntjmR40sHZT9pEJ4raiMmhNOfMj80VKNrrBZN/vPG7x6 +xTlNv2B8E/5ToC9NIlKGQ650HFzrySb9pWrJk6OL3V7voI3iU8mNeIJVwy33Qol3XMw SYnN5rXVoOZcO8JcO11fJTzIvkrJ3ClxR9BECB/VJqXvneTplmAHUDYlVZezS1YPbxCj fe4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hFkVpF4C; 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 l132si25660112oib.192.2020.01.04.10.22.07; Sat, 04 Jan 2020 10:22:20 -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=@kernel.org header.s=default header.b=hFkVpF4C; 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 S1726240AbgADSV0 (ORCPT + 99 others); Sat, 4 Jan 2020 13:21:26 -0500 Received: from mail.kernel.org ([198.145.29.99]:36924 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726118AbgADSVZ (ORCPT ); Sat, 4 Jan 2020 13:21:25 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B87E8222C4; Sat, 4 Jan 2020 18:21:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578162085; bh=OffE6GW1fEHEsKz4lJ2UtasvfPdaubXshXY9rYrJGGw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=hFkVpF4CJX1T67ffFbREBgsanbynhohqOoCBZyn4eKk7wE3YQXY1LqUrOH1ZS85GO qP0fXt6AlakACLEvz6FbVhYPVOEsUVf1OQDKgA0HBLBqE7Um/QEQiMkuEB/JwsETuJ 6fHnD1eXtpd3+0Xs3C948YuQhDcUXQfctb9GC80U= Date: Sat, 4 Jan 2020 19:21:23 +0100 From: Greg Kroah-Hartman To: =?utf-8?B?TWljaGHFgiBNaXJvc8WCYXc=?= Cc: "Rafael J. Wysocki" , Len Brown , Pavel Machek , Steven Rostedt , Ingo Molnar , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] PM-runtime: add tracepoints for usage_count changes Message-ID: <20200104182123.GA1485543@kroah.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jan 04, 2020 at 05:27:57PM +0100, Michał Mirosław wrote: > Add tracepoints to remaining places where device's power.usage_count > is changed. This helps debugging where and why autosuspend is prevented. > > Signed-off-by: Michał Mirosław > --- > drivers/base/power/runtime.c | 13 +++++++++++-- > include/trace/events/rpm.h | 6 ++++++ > 2 files changed, 17 insertions(+), 2 deletions(-) > > diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c > index 48616f358854..16134a69bf6f 100644 > --- a/drivers/base/power/runtime.c > +++ b/drivers/base/power/runtime.c > @@ -1006,8 +1006,10 @@ int __pm_runtime_idle(struct device *dev, int rpmflags) > int retval; > > if (rpmflags & RPM_GET_PUT) { > - if (!atomic_dec_and_test(&dev->power.usage_count)) > + if (!atomic_dec_and_test(&dev->power.usage_count)) { > + trace_rpm_usage_rcuidle(dev, rpmflags); Who and what is really going to use these tracepoints? And putting them in these if statements seems odd, are you sure that's the correct place? What do these show to userspace? > return 0; > + } > } > > might_sleep_if(!(rpmflags & RPM_ASYNC) && !dev->power.irq_safe); > @@ -1038,8 +1040,10 @@ int __pm_runtime_suspend(struct device *dev, int rpmflags) > int retval; > > if (rpmflags & RPM_GET_PUT) { > - if (!atomic_dec_and_test(&dev->power.usage_count)) > + if (!atomic_dec_and_test(&dev->power.usage_count)) { > + trace_rpm_usage_rcuidle(dev, rpmflags); > return 0; > + } > } > > might_sleep_if(!(rpmflags & RPM_ASYNC) && !dev->power.irq_safe); > @@ -1101,6 +1105,7 @@ int pm_runtime_get_if_in_use(struct device *dev) > retval = dev->power.disable_depth > 0 ? -EINVAL : > dev->power.runtime_status == RPM_ACTIVE > && atomic_inc_not_zero(&dev->power.usage_count); > + trace_rpm_usage_rcuidle(dev, 0); Why this one? > spin_unlock_irqrestore(&dev->power.lock, flags); > return retval; > } > @@ -1434,6 +1439,8 @@ void pm_runtime_allow(struct device *dev) > dev->power.runtime_auto = true; > if (atomic_dec_and_test(&dev->power.usage_count)) > rpm_idle(dev, RPM_AUTO | RPM_ASYNC); > + else > + trace_rpm_usage_rcuidle(dev, RPM_AUTO | RPM_ASYNC); Are you sure this is correct? These feel odd... thanks, greg k-h