Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp7626245rwl; Tue, 10 Jan 2023 03:23:18 -0800 (PST) X-Google-Smtp-Source: AMrXdXv2StrDLRQGbsKHt4Nm4oKKY7UJfPpi/AOTFOyZ4XuzBntExy1rf5+Ik6hKfLvnjBumk8Y2 X-Received: by 2002:a17:90a:4401:b0:21d:6327:ab6 with SMTP id s1-20020a17090a440100b0021d63270ab6mr68446699pjg.1.1673349798394; Tue, 10 Jan 2023 03:23:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673349798; cv=none; d=google.com; s=arc-20160816; b=a3Z8wOVoCaiWbbbWSarSd1A4n25yRGJS2NKy8FkePgsTehRepBf6NfDmvhys7wIPsM bMjyUoPqackWz+EeX6GouZsop4DyVThgDe0WNl2sKH32xy0g4Q3iRw88X8x+QFLJAapk pr2eaMOzrf8zoD18tQgkT8yC52JdCHH+MwZOLY7BTd/1NsQRG+kE/BfgOBIdfXpXM7Uz B617mh4A48ziQR3dzI62U2kReDMn9+KSYO5+ieQ/b+YFnX+b81K5gVurcI9RCMbwwMLV lBo/ioKaJfv0tVt589SlyL+E6QPNbHdWwbuptxwGaLs2V90z3H0R6vHr4/vB7jCawwOK 90EQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=6c08vsjnJMG4P8d0/aGvma3KfZjb0P93NvrL9pi60CY=; b=BK+xM8uPADzhHhXzND0434RB0jO6wIk/Hh9m0Hbtj59B5FUipLwyG199IVH1jsqFwG BMvkjgrBI1S27ukLBXSsLRriTJb7JRKGbc6NTNNcnLX4pGAqbtUKL/NI8Nsdd8HRnw0Z v9+WN7dN/wQnjaBXRDfJJTS96Kq52YvEe/mrchmIbj/OpLGjK4krNWXZq1YSMbAT1uf6 jvu1OErxHoiNnC4xXYn04q8TBAiO+FolAMj+EG1XFKLX9l6XXoge51kroFfHtxRAvnrW wMi/451mrsfyYGGI3FZzAA53JyIz8ra6gLMP6UpAQaeNPdKCzABZu3FCYT0BrFDsOSdD qfOw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bg7-20020a17090b0d8700b00225de00d4dfsi10996237pjb.118.2023.01.10.03.23.10; Tue, 10 Jan 2023 03:23:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232307AbjAJLLC (ORCPT + 53 others); Tue, 10 Jan 2023 06:11:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232301AbjAJLIz (ORCPT ); Tue, 10 Jan 2023 06:08:55 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B586712AA1 for ; Tue, 10 Jan 2023 03:08:53 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 849FE4B3; Tue, 10 Jan 2023 03:09:35 -0800 (PST) Received: from [10.57.37.155] (unknown [10.57.37.155]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 060B83F587; Tue, 10 Jan 2023 03:08:51 -0800 (PST) Message-ID: <6f89794a-ce14-439a-ce10-55ed175a10fe@arm.com> Date: Tue, 10 Jan 2023 11:08:50 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH v2 2/3] coresight: cti: Add PM runtime call in enable_store Content-Language: en-US To: Jinlong Mao , Suzuki K Poulose , coresight@lists.linaro.org, mike.leach@linaro.org Cc: Mathieu Poirier , Leo Yan , Alexander Shishkin , Greg Kroah-Hartman , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20230106152331.1374973-1-james.clark@arm.com> <20230106152331.1374973-3-james.clark@arm.com> <91bd54ff-f1e3-aa6b-8446-ad73916be6a7@arm.com> <487a882b-8c88-095a-b6b2-d76fddcaecc6@quicinc.com> From: James Clark In-Reply-To: <487a882b-8c88-095a-b6b2-d76fddcaecc6@quicinc.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/01/2023 05:56, Jinlong Mao wrote: > > On 1/10/2023 12:47 AM, Suzuki K Poulose wrote: >> On 06/01/2023 15:23, James Clark wrote: >>> From: Mao Jinlong >>> >>> In commit 6746eae4bbad ("coresight: cti: Fix hang in cti_disable_hw()") >>> PM runtime calls are removed from cti_enable_hw/cti_disable_hw. When >>> enabling CTI by writing enable sysfs node, clock for accessing CTI >>> register won't be enabled. Device will crash due to register access >>> issue. Add PM runtime call in enable_store to fix this issue. >>> >>> Fixes: 6746eae4bbad ("coresight: cti: Fix hang in cti_disable_hw()") >>> Signed-off-by: Mao Jinlong >>> [Change to only call pm_runtime_put if a disable happened] >>> Signed-off-by: James Clark >>> --- >>>   drivers/hwtracing/coresight/coresight-cti-sysfs.c | 13 +++++++++++-- >>>   1 file changed, 11 insertions(+), 2 deletions(-) >>> >>> diff --git a/drivers/hwtracing/coresight/coresight-cti-sysfs.c >>> b/drivers/hwtracing/coresight/coresight-cti-sysfs.c >>> index 6d59c815ecf5..71e7a8266bb3 100644 >>> --- a/drivers/hwtracing/coresight/coresight-cti-sysfs.c >>> +++ b/drivers/hwtracing/coresight/coresight-cti-sysfs.c >>> @@ -108,10 +108,19 @@ static ssize_t enable_store(struct device *dev, >>>       if (ret) >>>           return ret; >>>   -    if (val) >>> +    if (val) { >>> +        ret = pm_runtime_resume_and_get(dev->parent); >>> +        if (ret) >>> +            return ret; >>>           ret = cti_enable(drvdata->csdev); >>> -    else >>> +        if (ret) >>> +            pm_runtime_put(dev->parent); >>> +    } else { >>>           ret = cti_disable(drvdata->csdev); >>> +        if (!ret) >>> +            pm_runtime_put(dev->parent); >>> +    } >>> + >>>       if (ret) >>>           return ret; >>>       return size; >> >> Looks good to me. >> >> @Mao Jinolong, >> >> Are you able to test the patches 1 & 2 and confirm they solve your >> issue ? > > Hi Suzuki, > > Tested from my side. Patch 1 & 2 can solve the issue when enable CTI by > writing 1 to enable sysfs node. Thanks, I added your tested-by tag on patches 1 + 2.