Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp1321431ybg; Wed, 29 Jul 2020 11:03:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzAI4NMwjelBO8z1X6vElwDL0zP7pxQbE1IEyuDYIAMS6RqZKXvbkaeL43SB1NSKCa7nyZv X-Received: by 2002:a17:906:7e4e:: with SMTP id z14mr16417347ejr.87.1596045838765; Wed, 29 Jul 2020 11:03:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596045838; cv=none; d=google.com; s=arc-20160816; b=S2lJ81X0xtpTQ4BnPbBL0TRwKNhV1NFfLGjIFNXJcnIcMn7N2tiXRWhMMasACU9Gwr kXYijH2dnhQtgTIambUJQ5uv2oJjpzvHC9+9jDlAdDz6gIeOlDR4BAVXU+bnNe9gMg4p NOdPF3DclT9mDQA/DBQwJz3sGsaBNeK7VlhuhU/pYYgJdqaJ938Q0xzV8+mIu3u57Gvh P58nCLlvQz4U2JRativB9/LAr6WPrU5/gzEhQBael3IjmVJGWuWx30PGcWeHjitVqFb/ qjnyT3Lvj+bqgf20F95lih8JKbX0ccudOyJMRJk0MZr0wLLsneGdblwQUJrKzgnrAvFF Qkpg== 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-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=7Fg1vKJS3H5jh+wjn/xw49NxzhVUYnMnmlb+Oe4mf7Y=; b=Z7d7+wlpyHsTsdSBHvhqklIQDYoqVmenFLFgNANTTdYZr9bUXLhDo+orFWFBgiDjBc ksQ7ceo0674gXV17cEid7elC+pWdBnUmCLW24JyKvaUW5ANxhmnkPTiXYmm0Mm5T+ghc jlJ8ogbDCH1qWBEMMYGBsHk9kfwoiDSM48eeqh6eniGWP0iQySjYEnff73hYUccCjDa4 EvsEEXP7pQ4/3VbEERV8n7gy2uf/8FybbA8cf8vW6rf0rJs5UWnoP48dp3Mz1ZFHcNJ2 EapC1O7gnPBb6kXDuXMD63edA1vinqoKJr1S2xeGSPt+UEAee+BjAIB0AXlM6B/DcDMo yF1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kDK1A5vL; 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 b1si1564814ejb.647.2020.07.29.11.03.36; Wed, 29 Jul 2020 11:03:58 -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=kDK1A5vL; 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 S1726825AbgG2SBb (ORCPT + 99 others); Wed, 29 Jul 2020 14:01:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726606AbgG2SBb (ORCPT ); Wed, 29 Jul 2020 14:01:31 -0400 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5754EC061794 for ; Wed, 29 Jul 2020 11:01:31 -0700 (PDT) Received: by mail-pf1-x441.google.com with SMTP id l2so6998853pff.0 for ; Wed, 29 Jul 2020 11:01:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=7Fg1vKJS3H5jh+wjn/xw49NxzhVUYnMnmlb+Oe4mf7Y=; b=kDK1A5vLlmS/z3Vg+YPyBmjuDb1ZO3FOFMg+2+2fXoCjZQNGiVWRf0YhABHnklf2wx e0MAT7jjJzJrSjKXWeyvG/5FHi0PHQPx+QcOe+8xykcQt21VBj+10iL0WtrVZ4z0VCad +/96WCno2ti/G7dhnRdIbraC0+r+kNs7Ykh4MvJ/KfSdgPIrSb9X2Mj5ngYDht4tOouO qL/jJ9lLmTpmt0I73Hp7NzjS0jVCEOkr7xQl0snLWbtSsK55P+SOeSK86DQydWe+6uc0 kMGuD66PBX1y38OcF9bc2tqR7v+uxerJUOVAf9U3lvKO2R7ZPipfXNtzS2Uv86foZYau 0nkA== 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; bh=7Fg1vKJS3H5jh+wjn/xw49NxzhVUYnMnmlb+Oe4mf7Y=; b=nOt7LOl1rpJTedCo4KYGJkUflf//Oeuybn8EMDoWW7+q3o5gFSD4nZ8PQmydOfgNye JMSv+isu3m7jFprRAvC0+uPFHQWDIqOfIp5xUXt5701foQQNvk5sFLBL3EGfr1QFhCVm jZowBXIdKJJaVsDdMu5mtJz6DP4Jgx1hW8rs/xBsLg9w+XjoG5AUWeCKct7Ygx/48eG1 ZsIKCdTjGa3hP6B5ftqNwIv8EjazGgPVJgUl0mhe4/Vz+G44qZVSTFMS4XBGC0eQ7MOV SvwzBuZvP+QSIL9T7q6t5Y/G/Ul4zxltLUf2swqcxDMekZs7OZv78ILV4UDbSC5y27Vd zQmw== X-Gm-Message-State: AOAM531PLUPBHhlfee1RoakQn+9iZ8ouQxM54x12ZSDS1HCrT3+VLrIU rdv6jaO2rYaaBYAJo4CR5jfMIWIzLbQ= X-Received: by 2002:a63:1a0c:: with SMTP id a12mr29769031pga.24.1596045690787; Wed, 29 Jul 2020 11:01:30 -0700 (PDT) Received: from xps15 (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id n15sm2931735pgs.25.2020.07.29.11.01.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2020 11:01:30 -0700 (PDT) Date: Wed, 29 Jul 2020 12:01:28 -0600 From: Mathieu Poirier To: Suzuki K Poulose Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, mike.leach@linaro.org, coresight@lists.linaro.org Subject: Re: [RFC PATCH 01/14] coresight: etm4x: Skip save/restore before device registration Message-ID: <20200729180128.GA3073178@xps15> References: <20200722172040.1299289-1-suzuki.poulose@arm.com> <20200722172040.1299289-2-suzuki.poulose@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200722172040.1299289-2-suzuki.poulose@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Suzuki, I have starte to review this - comments will be scattered over a few days. On Wed, Jul 22, 2020 at 06:20:27PM +0100, Suzuki K Poulose wrote: > Skip cpu save/restore before the coresight device is registered. > > Cc: Mathieu Poirier > Cc: Mike Leach > Signed-off-by: Suzuki K Poulose > --- > drivers/hwtracing/coresight/coresight-etm4x.c | 16 +++++++++++++++- > 1 file changed, 15 insertions(+), 1 deletion(-) > > diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c > index 6d7d2169bfb2..cb83fb77ded6 100644 > --- a/drivers/hwtracing/coresight/coresight-etm4x.c > +++ b/drivers/hwtracing/coresight/coresight-etm4x.c > @@ -1135,7 +1135,13 @@ static int etm4_cpu_save(struct etmv4_drvdata *drvdata) > { > int i, ret = 0; > struct etmv4_save_state *state; > - struct device *etm_dev = &drvdata->csdev->dev; > + struct coresight_device *csdev = drvdata->csdev; > + struct device *etm_dev; > + > + if (WARN_ON(!csdev)) > + return -ENODEV; > + > + etm_dev = &csdev->dev; > > /* > * As recommended by 3.4.1 ("The procedure when powering down the PE") > @@ -1261,6 +1267,10 @@ static void etm4_cpu_restore(struct etmv4_drvdata *drvdata) > { > int i; > struct etmv4_save_state *state = drvdata->save_state; > + struct coresight_device *csdev = drvdata->csdev; > + > + if (WARN_ON(!csdev)) > + return; Restore and save operations are only called from etm4_cpu_pm_notify() where the check for a valid drvdata->csdev is already done. > > CS_UNLOCK(drvdata->base); > > @@ -1368,6 +1378,10 @@ static int etm4_cpu_pm_notify(struct notifier_block *nb, unsigned long cmd, > > drvdata = etmdrvdata[cpu]; > > + /* If we have not registered the device there is nothing to do */ > + if (!drvdata->csdev) > + return NOTIFY_OK; Can you describe the scenario you've seen this happening in? Probably best to add it to the changelog. > + > if (!drvdata->save_state) > return NOTIFY_OK; > > -- > 2.24.1 >