Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp177533imj; Thu, 14 Feb 2019 18:02:25 -0800 (PST) X-Google-Smtp-Source: AHgI3IacxnZnBfo1Rc00DQzOJ2BuQHXAi9u+6SFuBKd3HbN8kbPTQ29282Un72nP9Ge6u7Uqkc8C X-Received: by 2002:a63:c0e:: with SMTP id b14mr6850417pgl.236.1550196145100; Thu, 14 Feb 2019 18:02:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550196145; cv=none; d=google.com; s=arc-20160816; b=0ScC7X8kmCELJW9y64kLi7CJbqIHcWS1yjuXDUKiOtsccnZ8oEd9vz1AJost1Lvs01 uWx/aWdJz2F6rWam3AQvoKXAMpvLMDYRGpF25N+ZM25k8BOQuswdjBQlXzBZLjjO1poR C9Kr1vh4jS7XGaDSgIMUGVbM5A2YUFi623Y8/DnOteqqZreqO2P1WUxia2n6ftdpNPZQ Sf3aofQpMnXtJvn+re0jSKFrcRpSbeQSuP6bbfc+vyrmVBAN79YDopM63kLXHtd3fw+R RaJhUiCL3SumbFTN6SexWWzWhHWX2Os8WiIe7VUGoVi1pLaX3lw5Bu4uN0f5exmBQYkm oC8A== 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:dkim-signature; bh=RN08I6AKaVchZKykU9iAboTLsRwihOJdMxf//APS2CI=; b=IOpGpX7ZMeOBu/JQlvKV07X5QvlS05gt8hZd2pDEPYx84c08BHXxMlKV8jH1mxUzi4 YB4lhixnuLN/S/2x7f2c/B1i7ZN/wBTAFVrIzizdNqXdQn3APNT5AjaHs+Qw5hDuDfDI oK3L97zrrnae2HCbnBTcjTutB7AucKQGAO9AOziOkPUQrxSjuyBmkLJev4Ml7jMh1XUt Nms7k8OZuYph91z2yzYNJYE0inZN/hgwPh0Yn+7dlSmxszaR7IsUbmakDNZMm5qj5p1T DQtHUPXnlVxuVwVreTVGqY2enm687EQLEMf6azruVZSgtas26iNgggG35A0LnZgdij/s 5rkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=gXYsCMMj; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 14si4050670pga.219.2019.02.14.18.02.09; Thu, 14 Feb 2019 18:02:25 -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=@chromium.org header.s=google header.b=gXYsCMMj; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438258AbfBNTHn (ORCPT + 99 others); Thu, 14 Feb 2019 14:07:43 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:36686 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726146AbfBNTHn (ORCPT ); Thu, 14 Feb 2019 14:07:43 -0500 Received: by mail-pl1-f194.google.com with SMTP id g9so3643205plo.3 for ; Thu, 14 Feb 2019 11:07:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=RN08I6AKaVchZKykU9iAboTLsRwihOJdMxf//APS2CI=; b=gXYsCMMjeYfJAfCG7smMdj7Sewkb7Dq6P58Z/EMK3VD42X9pSPGrW3+/iGHS5pSG/O OZn0RwKIBZ1EBYDMatXmJzdEo/s8RhAAk+Zvgh4OzjGPYrZEv9ZxmmQQi6TOJe8W4W2Y WsQg8+bOG2J8z/1gYfQYtR3WE6oRJnvy7DONY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=RN08I6AKaVchZKykU9iAboTLsRwihOJdMxf//APS2CI=; b=gcDLEfSzYX2yUiW/lyzV6vJIxYiWRvS2d7Cbtt73I1C+UbPE5Lsnaz+ftzMxc6pbCG nTIDFnimLcB9Y6P5DZAx7MS6jltq7w8zv918bM1jZ2A1GQ5mlM87K+jrbPEl2+4AW32A znyvNlKGLwu09EMS7Bd7myvBYOsqanulateNzdmEJrLunToUpnXhxgO19bkK/JqgM4Jr z2BkzadFSwDocJNTZlQ3pdyoM8J1xDuZA0mKrXA3Qxs2pe0475xaatayUMWH+OPGvqfp hnFFQqsCXW6+RgbSHFYWIUS00wFWItlJBDKU0Lzq3WocLYf+29AbkHYEYqu8eTPN34fz eEfw== X-Gm-Message-State: AHQUAuZ/ecmiT4Rlvk/E/43WGW0GD7FQKg4BXsnPg7QuvkBH7s1UssY9 iKfcPB86mPV+YR0tjDuIiMB3rQ== X-Received: by 2002:a17:902:5601:: with SMTP id h1mr5959711pli.160.1550171262651; Thu, 14 Feb 2019 11:07:42 -0800 (PST) Received: from localhost ([2620:15c:202:1:75a:3f6e:21d:9374]) by smtp.gmail.com with ESMTPSA id 184sm6182445pfe.106.2019.02.14.11.07.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Feb 2019 11:07:41 -0800 (PST) Date: Thu, 14 Feb 2019 11:07:41 -0800 From: Matthias Kaehlcke To: Lukasz Luba Cc: MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Thierry Reding , Jonathan Hunter , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org Subject: Re: [PATCH 4/4] PM / devfreq: Handle monitor start/stop in the devfreq core Message-ID: <20190214190741.GC117604@google.com> References: <20190214013042.254790-1-mka@chromium.org> <20190214013042.254790-5-mka@chromium.org> <1771fe9e-c107-f133-7b39-f4d7dbb004c5@partner.samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1771fe9e-c107-f133-7b39-f4d7dbb004c5@partner.samsung.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Lukasz, On Thu, Feb 14, 2019 at 07:01:36PM +0100, Lukasz Luba wrote: > Hi Matthias, > > I have compiled and run your changes on Odroid xu3 and v5.0-rc6. > There are kernel warnings because of mutex not held in function > devfreq_monitor_[start|stop]() in use cases: > 1) a few times during registration of new devices devfreq_add_device() > 2) poking the device from sysfs Thanks testing! I messed up carrying over changes from my v4.19 device kernel to the tree used for upstreaming :( Do you still see warnings with the below patch? Thanks Matthias diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index a42c37543c190..866fe711b43ca 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -440,7 +440,6 @@ static void devfreq_monitor_stop(struct devfreq *devfreq) mutex_lock(&devfreq->lock); devfreq->monitor_state = DEVFREQ_MONITOR_STOPPED; - mutex_unlock(&devfreq->lock); } /** @@ -596,7 +595,9 @@ static int governor_start(struct devfreq *devfreq) return err; } + mutex_lock(&devfreq->lock); devfreq_monitor_start(devfreq); + mutex_unlock(&devfreq->lock); return 0; } @@ -614,7 +615,9 @@ static int governor_stop(struct devfreq *devfreq) "mutex must *not* be held by the caller\n")) return -EINVAL; + mutex_lock(&devfreq->lock); devfreq_monitor_stop(devfreq); + mutex_unlock(&devfreq->lock); err = devfreq->governor->event_handler(devfreq, DEVFREQ_GOV_STOP, NULL); if (err) {