Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp3062756pxa; Tue, 18 Aug 2020 05:49:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyoRG7s8EQ3wUZFTgwPInpyuGG6prsf/QsQnyoBKbGv/v9HaRVFaRkSysRPz5MsuyUJQmSE X-Received: by 2002:a17:906:b2d7:: with SMTP id cf23mr19922980ejb.113.1597754939912; Tue, 18 Aug 2020 05:48:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597754939; cv=none; d=google.com; s=arc-20160816; b=GWO2Nw/qC1b07wIb6yB53zlXcpeg00uQwOPDB4Tf2SlQPusQUVfh14/Z62c24p5GnC 2zHzZyMauUv/sOH+2EPhPcIxlOd2JybbA63kC61Z0vMveqC0uxeiztmSK8mobwrm1WMa 1PnZy7Xe0ABQqOxqX832CZImyH4lwf1yOG2l2/ww/gf4yao1UcxihNqPXf6yp8uZD6BT LHn8NTQZM3/BDhhyyW6D/Kiy56TVY/SlxZNMFz4QrDTxEGK7NZxD9j+bhHNr2KcXTBZP iWlGpQ4gNgHTrYOr2qp3tOXLO9XfZsEHSHXiVtbidnpJtQ9SC14xDUX4t9/MyxOOxCwT rr3w== 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=iMDbLvcB25l+0rawk4vmc0yRtmJgi9WjSy4299BGbcs=; b=RYv2XbQaV52NGNGr1ZdLb3ILZRjJ1w1jhRwwx+PFF4FviBkl/JyzOE9QGG/d17/chM vtrsgMt0UsmlJAvcBms0yeLq2Niiy7On0D69MQ2jAaQau7vwYPTtVRZISyVUoiL0SajY 7BLF1PJRvHHxeC913H0OoA1gC2opU0AFsyAFCwd9LO24rS1EHLnVzUqZFpL2LWZz3/u1 ohdHPtoi/dPs/agpEY6R4m1v6h6UAPyUINoGBy90giaO7O2J55lefCOzdsVEm3Plqi0e 0WS3jvAyvhQXmu8x9AcgqRL6MXUd5FcLkqGJE57lPUusKvuFIeUsbH/HmQrStCKQbOBl Z7GQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GHHSzarw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id z6si1515382ejo.605.2020.08.18.05.48.36; Tue, 18 Aug 2020 05:48:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GHHSzarw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1726640AbgHRMrn (ORCPT + 99 others); Tue, 18 Aug 2020 08:47:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726635AbgHRMrk (ORCPT ); Tue, 18 Aug 2020 08:47:40 -0400 Received: from mail-ej1-x642.google.com (mail-ej1-x642.google.com [IPv6:2a00:1450:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD812C061389 for ; Tue, 18 Aug 2020 05:47:39 -0700 (PDT) Received: by mail-ej1-x642.google.com with SMTP id m22so21871664eje.10 for ; Tue, 18 Aug 2020 05:47:39 -0700 (PDT) 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=iMDbLvcB25l+0rawk4vmc0yRtmJgi9WjSy4299BGbcs=; b=GHHSzarwU/3M7mBfkeWifUOEbKaiJJm9fviyvqJU+b34aCmyCR7vk8L3t9fzMMJOzd +m8lYUb98ryzLIxU9REN8lNS+fme8lBBvYvZAYaXl3kJucpQTOnC/0cFFwf7Aqr4nyt1 DoFon7sfFVbBK/ZZeSHeVgFgsDdMicF+IVE4qxamw62AhfAVhDYJ2PP+tObbJNBuYmia 5HzIYLLAaDjSelBVqoGZ3uHhW2kDZKr4TIDECKiRBav21VYF1nnJkGwgkCCj7Ctk4WNM rrLz4Dz4GdjsruFY5DHyW8uu5oUjX1corCHzLwQHVBUIF+3vn9hmKbgebX722Ph0xRvz Z1eQ== 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=iMDbLvcB25l+0rawk4vmc0yRtmJgi9WjSy4299BGbcs=; b=FiKews39EASpn/yprvOvjI2gCDcPdOg3NEt+BmMmhMSvOEnR26mtxnozodZZJW8GkX 8reneLQVqbkhZAUGPlTlCv5+zT3T3nR7+lHDHBQtV1p8ddq5FruB6sd2hdb8Su5vTG2h zVM/BcmDhLC8w4mQ4taE5DeGTK5dWkW3Sjp/wivp0YSyBCG+B1TuSx5FNlpO0GFeL/Iz 0ZkGgMnMUlzTiTBHzQMf/Zn+8ek9IeL+WMhZC5mmkK+En0x55r5hiNFkn5bZ7JvVUby8 O1vYOUj5VUkPi3dDRff38cVywxvjpcpx/xTEvifqV/8eIz0JVJSb7i3kJQ8O0cmOnh/p NlbA== X-Gm-Message-State: AOAM530uoXb/VSG7Bnh4ERDlVq+rE9T0sD1wGMWkMiVlGAYw6s6eDVFq kttOPV1FIZTcie96viA5ytCX+gfeDs2vFfNb5KH5tw== X-Received: by 2002:a17:906:3911:: with SMTP id f17mr20823127eje.56.1597754858249; Tue, 18 Aug 2020 05:47:38 -0700 (PDT) MIME-Version: 1.0 References: <20200818111057.19755-1-tingwei@codeaurora.org> <20200818111057.19755-2-tingwei@codeaurora.org> In-Reply-To: <20200818111057.19755-2-tingwei@codeaurora.org> From: Mike Leach Date: Tue, 18 Aug 2020 13:47:27 +0100 Message-ID: Subject: Re: [PATCH] coresight: cti: remove pm_runtime_get_sync() from CPU hotplug To: Tingwei Zhang Cc: Mathieu Poirier , Suzuki K Poulose , Alexander Shishkin , Greg Kroah-Hartman , tsoni@codeaurora.org, Sai Prakash Ranjan , Mao Jinlong , Coresight ML , linux-arm-kernel , 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 Tue, 18 Aug 2020 at 12:11, Tingwei Zhang wrote: > > Below BUG is triggered by call pm_runtime_get_sync() in > cti_cpuhp_enable_hw(). It's in CPU hotplug callback with interrupt > disabled. Pm_runtime_get_sync() calls clock driver to enable clock > which could sleep. Remove pm_runtime_get_sync() in cti_cpuhp_enable_hw() > since pm_runtime_get_sync() is called in cti_enabld and pm_runtime_put() > is called in cti_disabled. No need to increase pm count when CPU gets > online since it's not decreased when CPU is offline. > > [ 105.800279] BUG: scheduling while atomic: swapper/1/0/0x00000002 > [ 105.800290] Modules linked in: > [ 105.800327] CPU: 1 PID: 0 Comm: swapper/1 Tainted: G W > 5.9.0-rc1-gff1304be0a05-dirty #21 > [ 105.800337] Hardware name: Thundercomm Dragonboard 845c (DT) > [ 105.800353] Call trace: > [ 105.800414] dump_backtrace+0x0/0x1d4 > [ 105.800439] show_stack+0x14/0x1c > [ 105.800462] dump_stack+0xc0/0x100 > [ 105.800490] __schedule_bug+0x58/0x74 > [ 105.800523] __schedule+0x590/0x65c > [ 105.800538] schedule+0x78/0x10c > [ 105.800553] schedule_timeout+0x188/0x250 > [ 105.800585] qmp_send.constprop.10+0x12c/0x1b0 > [ 105.800599] qmp_qdss_clk_prepare+0x18/0x20 > [ 105.800622] clk_core_prepare+0x48/0xd4 > [ 105.800639] clk_prepare+0x20/0x34 > [ 105.800663] amba_pm_runtime_resume+0x54/0x90 > [ 105.800695] __rpm_callback+0xdc/0x138 > [ 105.800709] rpm_callback+0x24/0x78 > [ 105.800724] rpm_resume+0x328/0x47c > [ 105.800739] __pm_runtime_resume+0x50/0x74 > [ 105.800768] cti_starting_cpu+0x40/0xa4 > [ 105.800795] cpuhp_invoke_callback+0x84/0x1e0 > [ 105.800814] notify_cpu_starting+0x9c/0xb8 > [ 105.800834] secondary_start_kernel+0xd8/0x164 > [ 105.800933] CPU1: Booted secondary processor 0x0000000100 [0x517f803c] > > Fixes: e9b880581d55 ("coresight: cti: Add CPU Hotplug handling to CTI driver") > Signed-off-by: Tingwei Zhang > --- > drivers/hwtracing/coresight/coresight-cti.c | 3 --- > 1 file changed, 3 deletions(-) > > diff --git a/drivers/hwtracing/coresight/coresight-cti.c b/drivers/hwtracing/coresight/coresight-cti.c > index 869569eb8c7f..baba6af83440 100644 > --- a/drivers/hwtracing/coresight/coresight-cti.c > +++ b/drivers/hwtracing/coresight/coresight-cti.c > @@ -126,9 +126,7 @@ static int cti_enable_hw(struct cti_drvdata *drvdata) > static void cti_cpuhp_enable_hw(struct cti_drvdata *drvdata) > { > struct cti_config *config = &drvdata->config; > - struct device *dev = &drvdata->csdev->dev; > > - pm_runtime_get_sync(dev->parent); > spin_lock(&drvdata->spinlock); > config->hw_powered = true; > > @@ -148,7 +146,6 @@ static void cti_cpuhp_enable_hw(struct cti_drvdata *drvdata) > /* did not re-enable due to no claim / no request */ > cti_hp_not_enabled: > spin_unlock(&drvdata->spinlock); > - pm_runtime_put(dev->parent); > } > > /* disable hardware */ > -- > The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, > a Linux Foundation Collaborative Project > Reviewed-by Mike Leach -- Mike Leach Principal Engineer, ARM Ltd. Manchester Design Centre. UK