Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp358430ybm; Thu, 28 May 2020 04:47:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyvFSutEdBJB6G9oTeZy8FsxeEQDM73SBvRl1NZtia3EbwFttkGMq0/1lSLJXYlNo5kLmiN X-Received: by 2002:a50:d6d0:: with SMTP id l16mr2781588edj.317.1590666454415; Thu, 28 May 2020 04:47:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590666454; cv=none; d=google.com; s=arc-20160816; b=FuUiNkMKQXOy+7AvXp6D+sJRiU8iZ6ZgJ13DRgLqlo9wJJ/OFUhjUhWY1DILUtMSHt jdkmOFlVk5JxTWC5Tt4qYDffg4Aky0HN6vSZXGONWL8q5oSQJMgXyntqSzA3mzh7jqRU RgtKgi8Ohp5JttD6VSICswGnxhOKy2w1+PJjHRRpN6JEVU+TaWBlXCBk55AV3fJrSU2h wWx83uC5zNFQf4zlvArzZMnZit7/Rq0MwdSxmUALPBG5ZFcOGG87VC0s7EueqHiB393F JYNxxgeHy114RkbsNI5grj8r6WSPuUbeL62t+WiqrSPuxvPpl01oz2073eKEHfKiD7va GYqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dmarc-filter :dkim-signature; bh=JYWh63enojmkl0ZbDpI0xeE7+snpo5O8ecFvr5K/Ll0=; b=TFm9ZoVz0SUnGIlHlhxjXZUeGdq9goQDESkf6Rt6C9yUoZWH5pJttawG/9rTDLnieC h/j6tmOZPalNqxXGsZUlvKDBxm9RY+T0Fn5YAOI9kpy9e/SoNimAWsZUFgROyl5Yr8ao hnR6RYKBU+ThTbS1oDVKqnw0k5+bLt9zoprWyzAbI9uxwsgnjJ8nfY372ORc/plm43Jz OuvB3pMM8twNo7vO3Nn0ElW+tztLWU/4pR9Et/0ZEiY9Fx2Rqng/6qQEqTI53V4U7raN 4bd0matYiiWPzT+HQkWS2OU360qx2iJKmIMwT9W2UAsfLpCzI5SNHUrNlSxcv91VTPoZ k23Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=kAVsMU+9; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j24si3703014ejd.160.2020.05.28.04.47.11; Thu, 28 May 2020 04:47:34 -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=fail header.i=@mg.codeaurora.org header.s=smtp header.b=kAVsMU+9; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388491AbgE1Lot (ORCPT + 99 others); Thu, 28 May 2020 07:44:49 -0400 Received: from mail27.static.mailgun.info ([104.130.122.27]:40116 "EHLO mail27.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388444AbgE1Lot (ORCPT ); Thu, 28 May 2020 07:44:49 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1590666288; h=Content-Transfer-Encoding: Content-Type: In-Reply-To: MIME-Version: Date: Message-ID: From: References: Cc: To: Subject: Sender; bh=JYWh63enojmkl0ZbDpI0xeE7+snpo5O8ecFvr5K/Ll0=; b=kAVsMU+9FaajaVmpzgXEvKubMWhfGZpp6IrUrMDtqirQLeOlJYcApLe75KAXrQKZGU0d4hoZ l4hBy3uX1wpjnxnB2DMRU2otR8gZLGQS2SyD6iPAq/UkKhdMxugbb4/DLC+bId7XF1lfwu0G Ces3e6p8l8VbUO5cC3IQS0t9PI8= X-Mailgun-Sending-Ip: 104.130.122.27 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n05.prod.us-east-1.postgun.com with SMTP id 5ecfa42ccb04586933eae81d (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Thu, 28 May 2020 11:44:44 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id E7E1FC43387; Thu, 28 May 2020 11:44:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from [192.168.43.129] (unknown [106.222.4.139]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mkshah) by smtp.codeaurora.org (Postfix) with ESMTPSA id 77B07C433C9; Thu, 28 May 2020 11:44:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 77B07C433C9 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=mkshah@codeaurora.org Subject: Re: [PATCH v3 2/2] soc: qcom: rpmh-rsc: Timeout after 1 second in write_tcs_reg_sync() To: Douglas Anderson , Andy Gross , Bjorn Andersson Cc: mka@chromium.org, joe@perches.com, swboyd@chromium.org, evgreen@chromium.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org References: <20200415095953.v3.1.Ic70288f256ff0be65cac6a600367212dfe39f6c9@changeid> <20200415095953.v3.2.I8550512081c89ec7a545018a7d2d9418a27c1a7a@changeid> From: Maulik Shah Message-ID: Date: Thu, 28 May 2020 17:14:36 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <20200415095953.v3.2.I8550512081c89ec7a545018a7d2d9418a27c1a7a@changeid> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Doug, During suspend-resume with this change on sc7180 using latest linux-next, below warning was reported. WARNING: CPU: 0 PID: 5324 at kernel/time/timekeeping.c:754 ktime_get+0x94/0x9c  ktime_get+0x94/0x9c  write_tcs_reg_sync+0x4c/0x130  tcs_invalidate+0x64/0xa4  rpmh_rsc_invalidate+0x20/0x38  rpmh_flush+0x58/0x1ec  rpmh_rsc_cpu_pm_callback+0xe4/0x144  notifier_call_chain+0x58/0x90  __atomic_notifier_call_chain+0x48/  cpu_pm_notify+0x40/0x6c  cpu_pm_enter+0x34/0x7c  cpu_pm_suspend+0x10/0x20  syscore_suspend+0x128/0x2a4  suspend_devices_and_enter+0x5e0/0x8a0 This seems to be because timekeeping is already suspend by this time. Thanks, Maulik On 4/15/2020 10:30 PM, Douglas Anderson wrote: > If our data still isn't there after 1 second, shout and give up. > > Reported-by: Joe Perches > Signed-off-by: Douglas Anderson > Reviewed-by: Stephen Boyd > --- > > Changes in v3: > - The register should be hex. > > Changes in v2: > - Patch ("Timeout after 1 second") new for v2. > > drivers/soc/qcom/rpmh-rsc.c | 12 +++++++----- > 1 file changed, 7 insertions(+), 5 deletions(-) > > diff --git a/drivers/soc/qcom/rpmh-rsc.c b/drivers/soc/qcom/rpmh-rsc.c > index ce39d8399312..e09d1ada0cd2 100644 > --- a/drivers/soc/qcom/rpmh-rsc.c > +++ b/drivers/soc/qcom/rpmh-rsc.c > @@ -10,6 +10,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -175,12 +176,13 @@ static void write_tcs_reg(const struct rsc_drv *drv, int reg, int tcs_id, > static void write_tcs_reg_sync(const struct rsc_drv *drv, int reg, int tcs_id, > u32 data) > { > + u32 new_data; > + > writel(data, tcs_reg_addr(drv, reg, tcs_id)); > - for (;;) { > - if (data == readl(tcs_reg_addr(drv, reg, tcs_id))) > - break; > - udelay(1); > - } > + if (readl_poll_timeout_atomic(tcs_reg_addr(drv, reg, tcs_id), new_data, > + new_data == data, 1, USEC_PER_SEC)) > + pr_err("%s: error writing %#x to %d:%#x\n", drv->name, > + data, tcs_id, reg); > } > > /** -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation