Received: by 10.223.176.46 with SMTP id f43csp508559wra; Fri, 26 Jan 2018 02:26:45 -0800 (PST) X-Google-Smtp-Source: AH8x227unCJTw9suSvl18deR+WZ2JcybYE+vLGqdCqMYuKcGt1ZFsowob38ovY580s8EkSfpBSDK X-Received: by 10.99.1.151 with SMTP id 145mr15591908pgb.229.1516962405405; Fri, 26 Jan 2018 02:26:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516962405; cv=none; d=google.com; s=arc-20160816; b=WJdMAyJS5jLGl86DyXG8iX9/WqK0+AmfEoElGsJzDE/yOtsO7Ie/G+ydlPuc3+BZ0M z+wCQhDr6N/7vJBSz5i836njjyDazrdQ9WC+s/SLuLqovKCHvGFOMYOL/rvrguH8poMh nexpQQUuxNBMQ8OrV/oKNXRHtC8ujoL+Laj8DTUtP4Y65APkFq7jIp+sYrD0P0rk90nS P5RkSF9hSiRkwj7CYs/MJ75eNMCrxviQckXZPJJwy9NEPR76bHsIRQTvJROF+zZA0Zy7 1BduYQecNXunDU+4X9W4aLn66CUkZnFrtUqH6rLe0lGLAGbIwdx/x0xvx13mO2hHLKIb 30Uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=dBwSJQBreRTYUEsbGs5IwMzPH4h6mLVKNjFrpa4mi5Y=; b=XT8WkYv0cGetZV2YdIJh6zTl136PkCt97tBgVobOnNzViosuu0jQXyCnhMH353J0Ex 2L2C8yEF+KR04wFcr5+94OuIjb+mHdUDuHC6hsTWqThp0LVgLAJlm6C+kAgfAunvrb5w rnBrhz9Qukl8cYApz/5ob3J42mfvHAUOb1sx1pvCZiQ9bQzujBbccE0lW5Yx9TdfUE3R D1ZJC7rM48/H07BJVx2LGnFA9XBDheyGlE5ExDwNIzukkqBWd3TKi1hnJYcKBX2VjpFV 4L6X8xrR+WGfDZAyha82fgHUIKm3BfyC7E2MqBooa+4Sg2I97t7Ukll2bOuTZxA882HN RXGA== ARC-Authentication-Results: i=1; mx.google.com; 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 y11-v6si3558553plg.242.2018.01.26.02.26.30; Fri, 26 Jan 2018 02:26:45 -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; 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 S1753153AbeAZK0I (ORCPT + 99 others); Fri, 26 Jan 2018 05:26:08 -0500 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:40767 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752216AbeAZK0G (ORCPT ); Fri, 26 Jan 2018 05:26:06 -0500 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512) id 4327F8015C; Fri, 26 Jan 2018 11:26:05 +0100 (CET) Date: Fri, 26 Jan 2018 11:26:04 +0100 From: Pavel Machek To: Jia-Ju Bai Cc: rjw@rjwysocki.net, khilman@kernel.org, ulf.hansson@linaro.org, len.brown@intel.com, gregkh@linuxfoundation.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] base: power: domain: Replace mdelay with msleep Message-ID: <20180126102604.GB13775@amd> References: <1516955899-31810-1-git-send-email-baijiaju1990@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="GRPZ8SYKNexpdSJ7" Content-Disposition: inline In-Reply-To: <1516955899-31810-1-git-send-email-baijiaju1990@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --GRPZ8SYKNexpdSJ7 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri 2018-01-26 16:38:19, Jia-Ju Bai wrote: > After checking all possible call chains to genpd_dev_pm_detach() and > genpd_dev_pm_attach() here, > my tool finds that these functions are never called in atomic context, > namely never in an interrupt handler or holding a spinlock. > Thus mdelay can be replaced with msleep to avoid busy wait. >=20 > This is found by a static analysis tool named DCNS written by myself. Well, cond_resched() just after msleep certainly looks like that. Did the patch receive any testing? > Signed-off-by: Jia-Ju Bai > --- > drivers/base/power/domain.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c > index 0c80bea..f84ac72 100644 > --- a/drivers/base/power/domain.c > +++ b/drivers/base/power/domain.c > @@ -2144,7 +2144,7 @@ static void genpd_dev_pm_detach(struct device *dev,= bool power_off) > if (ret !=3D -EAGAIN) > break; > =20 > - mdelay(i); > + msleep(i); > cond_resched(); > } > =20 > @@ -2231,7 +2231,7 @@ int genpd_dev_pm_attach(struct device *dev) > if (ret !=3D -EAGAIN) > break; > =20 > - mdelay(i); > + msleep(i); > cond_resched(); > } > mutex_unlock(&gpd_list_lock); --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --GRPZ8SYKNexpdSJ7 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlprAjwACgkQMOfwapXb+vJlYACcCZMDA5fnbjAcpcs14r+abqYK 05oAnA+nCUBwmKUNZqAD1OtDU9otgPVV =1yYv -----END PGP SIGNATURE----- --GRPZ8SYKNexpdSJ7--