From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D114FC07E9C for ; Mon, 12 Jul 2021 04:14:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BBE77610A7 for ; Mon, 12 Jul 2021 04:14:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231868AbhGLERF (ORCPT ); Mon, 12 Jul 2021 00:17:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230105AbhGLERD (ORCPT ); Mon, 12 Jul 2021 00:17:03 -0400 Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D29EC0613E5 for ; Sun, 11 Jul 2021 21:14:16 -0700 (PDT) Received: by mail-pf1-x434.google.com with SMTP id 17so15200754pfz.4 for ; Sun, 11 Jul 2021 21:14:16 -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:user-agent; bh=3Q0y1C5hmnwnQuxDAoytzYjEDb+K9YOferT1UplBZDI=; b=mIMX1rWpwGJdN1eOOWJekhKvqJvi8fqfCurK24etfPBQ3MNdHzoGTzb8dLf537YaMf VYnRRelfS+FEYLLPanap81YpLvmegkqQILEuLWAusJt1DfXQp//aIGzIpG8eiXKVKq94 N8Tapznrsw9dTw45i1ReNKBXTOb8SwTS3v9QyBMZlFEQMSiATM9jmv62CGsRbU2gdgDl DS8n1b1xc9LNDaG3hFAXD0u/QxNDThcbaPihffTEe/jfw4HOMfCJMXaG4Dfmarqp+To0 l3olzEI3bCFUgDd0yFNwn6IUvksz4ROK5/dG1aC7U98QzKcqEPLAu5NKizbHdBKfDP/9 tGZw== 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:user-agent; bh=3Q0y1C5hmnwnQuxDAoytzYjEDb+K9YOferT1UplBZDI=; b=n8WXU0OJGpz0W0IAFLn7LeV+wZTiR8NecBLL0oadFdj6ZsNgGyuhf68Mvwzax8BxQ2 2vuh89vIz/AZkFwI+spve5ecTuMYbPKBXLvkCGwdjR+LsF73nL7WXEJInCs0D95tMZN0 SmLkeFyRoOLxkBB4456ZK7NJgEcZq+jpZ3cZlPZNmoOiFD8YyWaoJzkUssqoqVR7f8G6 mZ5tlJRyV5QJY2YKn2BfOjhZ2TBfFqmpJuaH7qj+igyTn3x7Ti3u+HN3SxVBjtxBm6Yn IVn4HT9/6ygD2z09fq4fp/hM+TmmP4Q2pRheJ75eBcFxpn1IcUAzgWnxluCbZOoitvX/ 3JAw== X-Gm-Message-State: AOAM530nkZvnn1Km4x20f/a/JLKpSGx5gcxJbPA/W5SOgNFBSAfxa7MU IISrpo2lzCP9G7cydCli5175Ig== X-Google-Smtp-Source: ABdhPJyhGDSTLIqfaiJ1pTy10h6u43OBRhm+KFRTRb2fTgsRTuCnLZO0JlcC2ljGmflX5/NyBp/vTg== X-Received: by 2002:a62:fb13:0:b029:309:8d89:46b2 with SMTP id x19-20020a62fb130000b02903098d8946b2mr50395923pfm.67.1626063255619; Sun, 11 Jul 2021 21:14:15 -0700 (PDT) Received: from localhost ([106.201.108.2]) by smtp.gmail.com with ESMTPSA id 18sm18419305pje.22.2021.07.11.21.14.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Jul 2021 21:14:14 -0700 (PDT) Date: Mon, 12 Jul 2021 09:44:08 +0530 From: Viresh Kumar To: Ionela Voinescu Cc: Kevin Wangtao , Leo Yan , Jassi Brar , zhongkaihua@huawei.com, Dmitry Osipenko , Viresh Kumar , Nishanth Menon , Stephen Boyd , linux-pm@vger.kernel.org, Vincent Guittot , Rafael Wysocki , Sibi Sankar , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 03/13] opp: Keep track of currently programmed OPP Message-ID: <20210712041408.5dgtwcp55pgt7twn@vireshk-i7> References: <96b57316a2a307a5cc5ff7302b3cd0084123a2ed.1611227342.git.viresh.kumar@linaro.org> <20210707102410.GA4357@arm.com> <20210708075353.ivsuc4y47i6bbhgz@vireshk-i7> <20210709085704.GA10180@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210709085704.GA10180@arm.com> User-Agent: NeoMutt/20180716-391-311a52 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09-07-21, 09:57, Ionela Voinescu wrote: > On Thursday 08 Jul 2021 at 13:23:53 (+0530), Viresh Kumar wrote: > > On 07-07-21, 11:24, Ionela Voinescu wrote: > > > Now comes the interesting part: what seems to fix it is a call to > > > clk_get_rate(opp_table->clk) in _set_opp(), which is what basically > > > happened before this patch, as _find_current_opp() was always called. > > > I do not need to do anything with the returned frequency. > > > > Wow, thanks for narrowing it down this far :) > > > > I had a quick look and this is what I think is the problem here. > > > > This platform uses mailbox API to send its frequency change requests to another > > processor. And the way it is written currently, I don't see any guarantee > > whatsoever which say > > > > "once clk_set_rate() returns, the frequency would have already changed". > > > > I think what was strange to me was that the frequency never seems to > change, there isn't just a delay in the new frequency taking effect, as > I would expect in these cases. Or if there is a delay, that's quite large > - at least a second. No idea on what the firmware is doing behind the scene :) > > And this may exactly be the thing you are able to hit, luckily because of this > > patchset :) > > > > As a quick way of checking if that is right or not, this may make it work: > > > > diff --git a/drivers/mailbox/hi3660-mailbox.c b/drivers/mailbox/hi3660-mailbox.c > > index 395ddc250828..9856c1c84dcf 100644 > > --- a/drivers/mailbox/hi3660-mailbox.c > > +++ b/drivers/mailbox/hi3660-mailbox.c > > @@ -201,6 +201,9 @@ static int hi3660_mbox_send_data(struct mbox_chan *chan, void *msg) > > > > /* Trigger data transferring */ > > writel(BIT(mchan->ack_irq), base + MBOX_SEND_REG); > > + > > + hi3660_mbox_check_state(chan); > > + > > I gave this a try an it does work for me. Good, so that kind of proves what I was suspecting. The mailbox driver looks buggy here. > > -------------------------8<------------------------- > > > > As a proper fix, something like this (not even compile tested) is required I > > believe as I don't see the clients would know if the transfer is over. Cc'ing > > mailbox guys to see what can be done. > > > > I'll give this a try as well when there is consensus. I might even try to > review it, if the time allows. Sure, lets see what the platform guys think about this first. Kevin, Kaihua ? -- viresh From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD7A3C07E99 for ; Mon, 12 Jul 2021 04:16:01 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A29AB610CD for ; Mon, 12 Jul 2021 04:16:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A29AB610CD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ovOZ02W2mVAdHIt/QJCTBKjx5rvO3FmBmhigihTfWD0=; b=KLr4+IWs0HusRw yMCGLTPXWCx6xFyPCsSpNXfgJvMmjaEkZdeoPvkJ7ZVHkX1uZxgoOEIensv3Kxe9ML1o+edBazgcJ kB6wP7m4warguFklDnTCpzFsZ8S+ETevQjUqfVIwYWjYsYsuR6pVKH6ukpRC3mIYdUgHD3Bsnhb6n mdU+fy5l0HAGQ7t/Tbqgxbu5zAMRY9KQdOSFzhZC1kG9ZjHM4OMuY+5txptjpQAiiyT4kut3cZpfk vWDHhbNDyNlMBcSQKlOqvvfZkre/Mwpn9qi+jtZ9gvpkkm9ehaE69etCYjUqTnkXTQbHJIriTJbAN trvjKZBW9MKht+UAj3aA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m2nKm-005qnS-44; Mon, 12 Jul 2021 04:14:20 +0000 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m2nKj-005qmr-2D for linux-arm-kernel@lists.infradead.org; Mon, 12 Jul 2021 04:14:18 +0000 Received: by mail-pf1-x42b.google.com with SMTP id j9so9508824pfc.5 for ; Sun, 11 Jul 2021 21:14:16 -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:user-agent; bh=3Q0y1C5hmnwnQuxDAoytzYjEDb+K9YOferT1UplBZDI=; b=mIMX1rWpwGJdN1eOOWJekhKvqJvi8fqfCurK24etfPBQ3MNdHzoGTzb8dLf537YaMf VYnRRelfS+FEYLLPanap81YpLvmegkqQILEuLWAusJt1DfXQp//aIGzIpG8eiXKVKq94 N8Tapznrsw9dTw45i1ReNKBXTOb8SwTS3v9QyBMZlFEQMSiATM9jmv62CGsRbU2gdgDl DS8n1b1xc9LNDaG3hFAXD0u/QxNDThcbaPihffTEe/jfw4HOMfCJMXaG4Dfmarqp+To0 l3olzEI3bCFUgDd0yFNwn6IUvksz4ROK5/dG1aC7U98QzKcqEPLAu5NKizbHdBKfDP/9 tGZw== 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:user-agent; bh=3Q0y1C5hmnwnQuxDAoytzYjEDb+K9YOferT1UplBZDI=; b=ZcbF3xrF4N54HP9egWFj6BYFUC4mRdHQgvj66PgevPabTQbPagfV0P/Vy/jOjGMI6L ykzrpR3k1OB0pG1un6j0IdBbfw0w8+fBz4tprflEZiaLLQNpvOMh0p74ewZ8gVFPf3iv 0oZwaaI179pQnOdKmDb+wz9hS6nNwUrcJ/ffhwnEHsDnDvZvLhm7UmmEMepu5NujYZaR LZNl4F68YuXtdKgBD1aO0y+CgBN3WsVzUFr7FPSbeoyN/8Dt4QoXCnwZ9jqWsKOcp35e qK7ITtBuMGEbkqNH5M8mB7XzzfHG+dELEaPq59f9mNnimt4LHFx/efC86qCengHA6NcZ 6J9A== X-Gm-Message-State: AOAM530WWr0c4TGXxtvV+en20JPn9X1e+IafcT5rH1L1j/WirSgIcEPv cku6PUXoFJFB6RYHKHxFmiaMyQ== X-Google-Smtp-Source: ABdhPJyhGDSTLIqfaiJ1pTy10h6u43OBRhm+KFRTRb2fTgsRTuCnLZO0JlcC2ljGmflX5/NyBp/vTg== X-Received: by 2002:a62:fb13:0:b029:309:8d89:46b2 with SMTP id x19-20020a62fb130000b02903098d8946b2mr50395923pfm.67.1626063255619; Sun, 11 Jul 2021 21:14:15 -0700 (PDT) Received: from localhost ([106.201.108.2]) by smtp.gmail.com with ESMTPSA id 18sm18419305pje.22.2021.07.11.21.14.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Jul 2021 21:14:14 -0700 (PDT) Date: Mon, 12 Jul 2021 09:44:08 +0530 From: Viresh Kumar To: Ionela Voinescu Cc: Kevin Wangtao , Leo Yan , Jassi Brar , zhongkaihua@huawei.com, Dmitry Osipenko , Viresh Kumar , Nishanth Menon , Stephen Boyd , linux-pm@vger.kernel.org, Vincent Guittot , Rafael Wysocki , Sibi Sankar , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 03/13] opp: Keep track of currently programmed OPP Message-ID: <20210712041408.5dgtwcp55pgt7twn@vireshk-i7> References: <96b57316a2a307a5cc5ff7302b3cd0084123a2ed.1611227342.git.viresh.kumar@linaro.org> <20210707102410.GA4357@arm.com> <20210708075353.ivsuc4y47i6bbhgz@vireshk-i7> <20210709085704.GA10180@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210709085704.GA10180@arm.com> User-Agent: NeoMutt/20180716-391-311a52 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210711_211417_190591_76B441E3 X-CRM114-Status: GOOD ( 34.74 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 09-07-21, 09:57, Ionela Voinescu wrote: > On Thursday 08 Jul 2021 at 13:23:53 (+0530), Viresh Kumar wrote: > > On 07-07-21, 11:24, Ionela Voinescu wrote: > > > Now comes the interesting part: what seems to fix it is a call to > > > clk_get_rate(opp_table->clk) in _set_opp(), which is what basically > > > happened before this patch, as _find_current_opp() was always called. > > > I do not need to do anything with the returned frequency. > > > > Wow, thanks for narrowing it down this far :) > > > > I had a quick look and this is what I think is the problem here. > > > > This platform uses mailbox API to send its frequency change requests to another > > processor. And the way it is written currently, I don't see any guarantee > > whatsoever which say > > > > "once clk_set_rate() returns, the frequency would have already changed". > > > > I think what was strange to me was that the frequency never seems to > change, there isn't just a delay in the new frequency taking effect, as > I would expect in these cases. Or if there is a delay, that's quite large > - at least a second. No idea on what the firmware is doing behind the scene :) > > And this may exactly be the thing you are able to hit, luckily because of this > > patchset :) > > > > As a quick way of checking if that is right or not, this may make it work: > > > > diff --git a/drivers/mailbox/hi3660-mailbox.c b/drivers/mailbox/hi3660-mailbox.c > > index 395ddc250828..9856c1c84dcf 100644 > > --- a/drivers/mailbox/hi3660-mailbox.c > > +++ b/drivers/mailbox/hi3660-mailbox.c > > @@ -201,6 +201,9 @@ static int hi3660_mbox_send_data(struct mbox_chan *chan, void *msg) > > > > /* Trigger data transferring */ > > writel(BIT(mchan->ack_irq), base + MBOX_SEND_REG); > > + > > + hi3660_mbox_check_state(chan); > > + > > I gave this a try an it does work for me. Good, so that kind of proves what I was suspecting. The mailbox driver looks buggy here. > > -------------------------8<------------------------- > > > > As a proper fix, something like this (not even compile tested) is required I > > believe as I don't see the clients would know if the transfer is over. Cc'ing > > mailbox guys to see what can be done. > > > > I'll give this a try as well when there is consensus. I might even try to > review it, if the time allows. Sure, lets see what the platform guys think about this first. Kevin, Kaihua ? -- viresh _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel