Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp555139ybh; Tue, 10 Mar 2020 04:02:58 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuibvy2NxLmJh3G5LA/JbFnt1E0JSNCzegH4AHw2HHC2aQi6Skl2heySketJi6Fj3INwldD X-Received: by 2002:a05:6830:1581:: with SMTP id i1mr3236601otr.349.1583838178270; Tue, 10 Mar 2020 04:02:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583838178; cv=none; d=google.com; s=arc-20160816; b=gQhsuCKBnSXJcwAW+iDbv5YHiqrH6oeQZAhEoxqF3gKj2pZHNWfZjOKHpIeLiQag7l TM7HSzAK4RLUd4gbsmo8kWgAv9F9We48FSSE0bLdE1zNM/76wVp3zG6s1+I/0jFXR+bV LTOUBeTKEUHfnKjphoQP+aF9NzwmBbol0yvbLju8y9+abGig1eQ3+Y1KC4OlZKRmv/gA VuojNZu9F5ClcxBV/keqQh5VvISiIKgbRgYqCFYRjy1MEWkz7ceWhM3bJaFss6YoYObT IXhZxZaMkHHSN30auNVvbXfBmwVHL4OD0549LJfCFaFswYCs2UQj0oeHC4t29gjAMFLB njVQ== 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=mWgS6dMU5tMrc/GL9CRsn4GhiGcQeIzmywu6bIffRzY=; b=BQAcoRLRrvJkcmTWal8fdx6Jq2QMqOrVmV9/GDF1hSP03YE4d/w2tL1m8Ew68heuFB eViR0/RFD2VstjMQ+9xzbBPEcjFSqlMN+xNe3+Y6WLE1+k6+plyWbhF51koaGuaxrGY8 EQohBYGmQ0q3jgbCbj2HRNdZ6P47bpkrM9aev4fqPu8GHOlCrgsLIKadHoh3jjbeJ+LO P59ZW+gCQdDgzfxH9cnXVEnEZHG/szcINFPfLVi0u201idXXlA61yDyf/P9M+1h0oB6A CaRRRQAEGdnOGvH6ti+1kPdZjoxZKf6wK8u/836HDaj4OEltsnrg9YwpgDOzkReI6f+9 dGBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=rcrO3sAa; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c85si5013219oig.225.2020.03.10.04.02.43; Tue, 10 Mar 2020 04:02:58 -0700 (PDT) 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=fail header.i=@mg.codeaurora.org header.s=smtp header.b=rcrO3sAa; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726307AbgCJLBx (ORCPT + 99 others); Tue, 10 Mar 2020 07:01:53 -0400 Received: from mail26.static.mailgun.info ([104.130.122.26]:56609 "EHLO mail26.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726170AbgCJLBx (ORCPT ); Tue, 10 Mar 2020 07:01:53 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1583838113; h=Content-Transfer-Encoding: Content-Type: In-Reply-To: MIME-Version: Date: Message-ID: From: References: Cc: To: Subject: Sender; bh=mWgS6dMU5tMrc/GL9CRsn4GhiGcQeIzmywu6bIffRzY=; b=rcrO3sAaTU7C3h3HKrO8EyScWIoVRzFkct8/rv8ahPlntpIcdRgxWTcIQmK7h5M4MhQ9QRaz 6kuMnUSFLfuyUj0BN49JG9PhAu+LgDEuarK+BbOwTTXRhBcZaq/yWMRzzMSb4/E/tKhmWfRH niHRsCkmkuC5OiYTVj+fvnUr7+g= X-Mailgun-Sending-Ip: 104.130.122.26 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 mxa.mailgun.org with ESMTP id 5e67736a.7fb959c95ae8-smtp-out-n02; Tue, 10 Mar 2020 11:00:58 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id CC928C432C2; Tue, 10 Mar 2020 11:00:58 +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 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from [192.168.1.2] (unknown [183.83.137.78]) (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 24144C433CB; Tue, 10 Mar 2020 11:00:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 24144C433CB 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 v10 3/3] soc: qcom: rpmh: Invoke rpmh_flush() for dirty caches To: Doug Anderson Cc: Stephen Boyd , Matthias Kaehlcke , Evan Green , Bjorn Andersson , LKML , linux-arm-msm , Andy Gross , Rajendra Nayak , Lina Iyer , lsrao@codeaurora.org References: <1583238415-18686-1-git-send-email-mkshah@codeaurora.org> <1583238415-18686-4-git-send-email-mkshah@codeaurora.org> <92bf14b7-b7ae-3060-312e-74f57c1f9a63@codeaurora.org> From: Maulik Shah Message-ID: Date: Tue, 10 Mar 2020 16:30:52 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-GB Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/6/2020 3:50 AM, Doug Anderson wrote: > Hi, > > On Thu, Mar 5, 2020 at 3:30 AM Maulik Shah wrote: >>>> + spin_unlock_irqrestore(&ctrlr->cache_lock, flags); >>>> + return -EINVAL; >>> nit: why not add "int ret = 0" to the top of the function, then here: >>> >>> if (rpmh_flush(ctrl)) >>> ret = -EINVAL; >>> >>> ...then at the end "return ret". It avoids the 2nd copy of the unlock? >> Done. >>> Also: Why throw away the return value of rpmh_flush and replace it >>> with -EINVAL? Trying to avoid -EBUSY? ...oh, should you handle >>> -EBUSY? AKA: >>> >>> if (!psci_has_osi_support()) { >>> do { >>> ret = rpmh_flush(ctrl); >>> } while (ret == -EBUSY); >>> } >> Done, the return value from rpmh_flush() can be -EAGAIN, not -EBUSY. >> >> i will update the comment accordingly and will include below change as well in next series. >> >> https://patchwork.kernel.org/patch/11364067/ >> >> this should address for caller to not handle -EAGAIN. > A few issues, I guess. > > 1. I _think_ it's important that you enable interrupts between > retries. If you're on the same CPU that the interrupt is routed to > and you were waiting for 'tcs_in_use' to be cleared you'll be in > trouble otherwise. ...I think we need to audit all of the places that > are looping based on -EAGAIN and confirm that interrupts are enabled > between retries. Before your patch series the only looping I see was > in rpmh_invalidate() and the lock wasn't held. After your series it's > also in rpmh_flush() which is called under spin_lock_irqsave() which > will be a problem. I will take a look at interrupts part. > > 2. The RPMH code uses both -EBUSY and -EAGAIN so I looked carefully at > this again. You're right that -EBUSY seems to be exclusively returned > by things only called by rpmh_rsc_send_data() and that function > handles the retries. ...but looking at this made me find a broken > corner case with the "zero active tcs" case (assuming you care about > this case as per your other thread). Specifically if you have "zero > active tcs" then get_tcs_for_msg() can call rpmh_rsc_invalidate() > which can return -EAGAIN. That will return the -EAGAIN out of > tcs_write() into rpmh_rsc_send_data(). rpmh_rsc_send_data() only > handles -EBUSY, not -EAGAIN. > > -Doug Thanks Doug. I will have a patch to fix this. Thanks, Maulik -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation