Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp11536795ybi; Thu, 25 Jul 2019 18:43:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqw60px0EK7nW0I1+SYLUbfwV0FFRh1Vsqru99uyIQoNvJ46+QpEHBfGG6GW7m5Yj13dnRAx X-Received: by 2002:a17:902:2baa:: with SMTP id l39mr94712587plb.280.1564105389435; Thu, 25 Jul 2019 18:43:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564105389; cv=none; d=google.com; s=arc-20160816; b=LB6g6kDSRAyeqQa5s/TBK/HWomt3jLWisf4j2r4EXnTvITsJxTYW2pSXulLXDyGw7V ZeZOzos3Gfplh4cbHfsQ6hqyHp63eAlKRO7IXlh0Tq2jjaKj/2/UpkcBdehGMyRR9I2a q+Xh5bCHiyO9qgwGDLazO21SNC7VWTQ9xCwrGPQgjb7ZymW1/ukBHQa5hBMCTklVOBZc f99Rgwgk9rpUvX7Qkv8JTsbnUBG41ZVo+n0iGDUcwf8zcqpnXks3NCwG5Gn6T6VaFvcC aLuVUACdExlRyPsiCB+S5Oao9OSC3N7LN2Ofk0Nnju0PiN0kY+DxGzVOGLeziyyDeheg E9Gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=4xZv/cnujU0oqDcp877dW2V6UxgQGvLsyyGAH+W7I5Q=; b=kNGAAf3qOm2JdZ+6sT3ht0HAGBxHhf1yG/IZ3p0I+dAFTo96d9fuzcd35sRi++q4RM rh+kusKfl6iuXRc1qV6pF5F135jFOprNUbck7lqg8/4L1VD3YIeIkKbq7hgEDc93/eKT WwtaZMtRKlyjSC2wuMXEtdPKksb/oLxRcfi2jwyJhkf2/z5gouxPnPFvoJbcEw8b4MHj xBNcxS1dok2JoVH5fqiBwz2J0mk9hgVIEjue9GI3lFu9JwUo1fIXRGPRnANZy7grl51p m+XY+2tAQIZyyFiMGlwJARFoJGYZYPTe55dlwmkEH/nmtAXwKsDyK/Dh1DK4oBPLc4mU 4khQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=qKSd1EDb; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a63si17649449pge.113.2019.07.25.18.42.54; Thu, 25 Jul 2019 18:43:09 -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=pass header.i=@google.com header.s=20161025 header.b=qKSd1EDb; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725944AbfGZBmW (ORCPT + 99 others); Thu, 25 Jul 2019 21:42:22 -0400 Received: from mail-ot1-f66.google.com ([209.85.210.66]:46433 "EHLO mail-ot1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725800AbfGZBmV (ORCPT ); Thu, 25 Jul 2019 21:42:21 -0400 Received: by mail-ot1-f66.google.com with SMTP id z23so25397442ote.13 for ; Thu, 25 Jul 2019 18:42:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4xZv/cnujU0oqDcp877dW2V6UxgQGvLsyyGAH+W7I5Q=; b=qKSd1EDbUaxk7Iml18aMNgKB1KOluUzbqTK8JoXGWgOObVnyonZySJSebDxiRunuzG ONV9GJmMyrbKV1mWeZVfLP8vBOai9WA5JH2ETG9fSWiZjygeP6B3wYHrbD9kaGqCJigF hHeBo47AFH/uGAExbpBWJfFRCd5rEVaa2/zoEpiWHzfs45skGgYWqW15xuFuU8qSDNN9 MaWTiHUQznOw7F7Ert6XCD9UZrFjEMo/tG7a5Yc37JAgzSedkrtRNQB1z32tqhcibVh1 c01SnJBiAu0lndpZProKdtv4Jh04By4fyCt74wCAJ8OiIghLfU0f61I7gDdy/XXG6a4Q 2zzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=4xZv/cnujU0oqDcp877dW2V6UxgQGvLsyyGAH+W7I5Q=; b=Bci8LsYNP/snMrap+hjIw3VdpTE7clJP90li/Uc5mfm7MLkyDalleF/hu/CwSLgeTJ iSJgELJJByV11EcpI6/ZsKQp6kvkIY1iIfYkvbJGDefE4C43GG7YXC2lb/sol6e2Jkiv edETBvn61ppFodYSMdHXfXvbYOu8hU6wrvoae2Q51EWOufxuFJD7mJwwcoK0DsdRT4yI o5JFHqY8ZXj1uIU1Y3fKGhz7DHTB4oLePdIoYXsHKXi26y/CaraDf6jGz7xC1s2Vslrt h03yHQEg7io2SLZta3InF16CaBPSu1FYFs066RRkUQVNqvsQvG7oKur3om+1f4e5mz3a T+Zw== X-Gm-Message-State: APjAAAX3+do143m9cxSkoas85F7FybwPRapZ3fNhuqlG1gMB8yG/3oe3 LJp0QdDw5hWDeKNuj3bIoI9ylsxrP3fSlHixi/TOzQ== X-Received: by 2002:a9d:6256:: with SMTP id i22mr46575918otk.139.1564105340461; Thu, 25 Jul 2019 18:42:20 -0700 (PDT) MIME-Version: 1.0 References: <20190717222340.137578-1-saravanak@google.com> <20190717222340.137578-3-saravanak@google.com> <20190723095316.t5ltprixxd5veuj7@vireshk-i7> <20190725025849.y2xyxmqmgorrny6k@vireshk-i7> <20190725053823.yqaxnk2a7geebmqw@vireshk-i7> In-Reply-To: <20190725053823.yqaxnk2a7geebmqw@vireshk-i7> From: Saravana Kannan Date: Thu, 25 Jul 2019 18:41:44 -0700 Message-ID: Subject: Re: [PATCH v3 2/5] OPP: Add function to look up required OPP's for a given OPP To: Viresh Kumar Cc: MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Viresh Kumar , Nishanth Menon , Stephen Boyd , "Rafael J. Wysocki" , Sibi Sankar , Android Kernel Team , Linux PM , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 24, 2019 at 10:38 PM Viresh Kumar wrote: > > On 24-07-19, 20:46, Saravana Kannan wrote: > > On Wed, Jul 24, 2019 at 7:58 PM Viresh Kumar wrote: > > > On 23-07-19, 17:23, Saravana Kannan wrote: > > > > > I almost said "not sure. Let me just compare pointers". > > > > I think (not sure) it has to do with the same OPP table being used to > > > > create multiple OPP table copies if the "shared OPP table" flag isn't > > > > set? > > > > Can you confirm if this makes sense? If so, I can add a comment patch > > > > that adds comments to the existing code and then copies it into this > > > > function in this patch. > > > > > > Right, that was the reason but we also need to fix ... > > > > I know I gave that explanation but I'm still a bit confused by the > > existing logic. If the same DT OPP table is used to create multiple in > > memory OPP tables, how do you device which in memory OPP table is the > > right one to point to? > > This is a bit broken actually, we don't see any problems right now but > may eventually have to fix it someday. > > We pick the first in-memory OPP table that was created using the DT > OPP table. This is done because the DT doesn't provide any explicit > linking to the required-opp device right now. > > Right now the required-opps is only used for power domains and so it > is working fine. It may work fine for your case as well. But once we > have a case we want to use required-opps in a single OPP table for > both power-domains and master/slave thing you are proposing, we may > see more problems. > > > > > > > + break; > > > > > > + } > > > > > > + > > > > > > + if (unlikely(i == src_table->required_opp_count)) { > > > > > > + pr_err("%s: Couldn't find matching OPP table (%p: %p)\n", > > > > > > + __func__, src_table, dst_table); > > > > > > + return NULL; > > > > > > + } > > > > > > + > > > > > > + mutex_lock(&src_table->lock); > > > > > > + > > > > > > + list_for_each_entry(opp, &src_table->opp_list, node) { > > > > > > + if (opp == src_opp) { > > > > > > ... this as well. We must be comparing node pointers here as well. > > > > Not really, if an in memory OPP entry is not part of an in memory OPP > > table list, I don't think it should be considered part of the OPP > > table just because the node pointer is the same. I think that's > > explicitly wrong and the above code is correct as is. > > I understand what you are saying, but because we match the very first > OPP table that was there in the list we need to match the DT node here > as well. > > Or somehow we make sure to have the correct in-memory OPP table being > pointed by the required-opp-table array. Then we don't need the node > pointer anywhere here. Ah, right. I'll fix this. -Saravana