From patchwork Wed Sep 12 08:28:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 10597055 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 38940112B for ; Wed, 12 Sep 2018 08:30:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 26B6F29541 for ; Wed, 12 Sep 2018 08:30:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1B2C42956C; Wed, 12 Sep 2018 08:30:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AE5CB29541 for ; Wed, 12 Sep 2018 08:30:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=JssVGdoJWp4XxDMbx26ZDc2G8IkNCR9ajNa05eVVsPI=; b=prF SaNsOReqtteCMZDf53e60a+Y+VQdz1zSX6bIK2kBScuBj2ORbxfD0A1o5YTMPeMBxPoJgmxu1bB11 +5/LH6Op7StbAfG1xcfWUSTz7zWOr/jyIOccwWDs6axuBGuKpEtL5S3+Yg+QGiEisjr0Z+sbxcimi ZtMiFkNnXCA9SmOx1xAJimYEOiU2KOlZhsGZHl3WcbIluhxkbFeDScNKiI6u8l5DNHxfnecseCw1q yEGxmhQpXXpP9/VEcFn09l3xTxqgzVq99Kfx+sEBY1LC5lCL+bFxs/EwypSxcKJTZsGor5Cm/B/1y 8Wr3GO2glQSh4pXCRkx2gRRkwR4+HlA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g00XM-0008QM-BA; Wed, 12 Sep 2018 08:30:12 +0000 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g00X8-0007wp-By for linux-arm-kernel@lists.infradead.org; Wed, 12 Sep 2018 08:30:10 +0000 Received: by mail-pl1-x642.google.com with SMTP id b12-v6so620253plr.8 for ; Wed, 12 Sep 2018 01:29:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=+OmOlv50znc2tgHYJkRyI/UDE2I0tRf5T900X5bNP9A=; b=Hkddc2GPFBgqNXe25RLszXjOCkWhh39MV/uIK+libyf+2PiTX8Tv83xlV8f4KE++hy mFsz5zsPuNv9qaknsyQu2vc9TJxOyqMTv4G0/GuWnFXLEfA1eoZ6HdXgqPeYVcFe6RDG XPsbPBpVtrzcEzID+tjXCuFW2o27bGo7o7W/k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=+OmOlv50znc2tgHYJkRyI/UDE2I0tRf5T900X5bNP9A=; b=ismJBj2J+PbTo3UU0ON2fRLjU95HvPI/rpkKhuFIldO5Uxem9NbxjzSbprMhIBcH4X lZA44n89UCl7jzaSphJbCqRCUJzrNUG8XI+6k4vVLH0sXqaJQFMxefLqeZ/kCBj1FHY9 tiLGTRHFQrjcn93C6326bxDFD8glKDTMuDs6Zddp4nE0h3CnpOB3byzyKSRkvEkn/S3B 78Wu7pe70+FrOw+gc9NntNfALOXbfRSyuQ2y7h07PYgePBvjIWAmIhUvG+tacb23ACVx qMJG0tW4TkPl3HPK1y2lXxi4O86v/N8DIikr0s3kseK1wARxpBIT4Ldp/BFOsQ0ChH5u Pf7A== X-Gm-Message-State: APzg51BjNFy2jAbzJVHGZK9tBsTJ4HOTWXY2uWowrliEkNWlzvPpAzXr 3QeKMV20gqVElavYs2ZiJFDNSQ== X-Google-Smtp-Source: ANB0VdYJqtfBY91TM0dX8B+b/jeNZQIaiOGXRvWI7one9MT1RMiE1cHpQpta7758x7zvDv69r31W7Q== X-Received: by 2002:a17:902:aa49:: with SMTP id c9-v6mr855934plr.195.1536740986604; Wed, 12 Sep 2018 01:29:46 -0700 (PDT) Received: from localhost ([122.171.64.45]) by smtp.gmail.com with ESMTPSA id w81-v6sm977560pfk.92.2018.09.12.01.29.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Sep 2018 01:29:45 -0700 (PDT) From: Viresh Kumar To: niklas.cassel@linaro.org, Andrew Lunn , Gregory Clement , Jason Cooper , Nishanth Menon , "Rafael J. Wysocki" , Sebastian Hesselbarth , Stephen Boyd , Viresh Kumar Subject: [PATCH 00/11] OPP: Don't create multiple OPP tables for devices sharing OPP table Date: Wed, 12 Sep 2018 13:58:39 +0530 Message-Id: X-Mailer: git-send-email 2.18.0.rc1.242.g61856ae69a2c X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180912_012958_487072_6A14E0B8 X-CRM114-Status: GOOD ( 11.60 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vincent Guittot , linux-pm@vger.kernel.org, Viresh Kumar , linux-kernel@vger.kernel.org, "4.18" , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Hello, Niklas Cassle recently reported some regressions with his Qcom cpufreq driver where he was getting some errors while creating the OPPs tables. After looking into it I realized that the OPP core incorrectly creates multiple OPP tables for the devices even if they are sharing the OPP table in DT. This happens when the request comes using different CPU devices. For example, dev_pm_opp_set_supported_hw() getting called using CPU0 and dev_pm_opp_of_add_table() getting called using CPU1. This series redesigns the internals of the OPP core to fix that. The redesign has simplified the core itself though. @Niklas: Can you please confirm that this series fixes the issues you have reported ? I have already tested it on Hikey960. Tested-by: Niklas Cassel Reported-by: Niklas Cassel Signed-off-by: Viresh Kumar --- viresh Viresh Kumar (11): OPP: Free OPP table properly on performance state irregularities OPP: Protect dev_list with opp_table lock OPP: Pass index to _of_init_opp_table() OPP: Parse OPP table's DT properties from _of_init_opp_table() OPP: Don't take OPP table's kref for static OPPs OPP: Create separate kref for static OPPs list cpufreq: mvebu: Remove OPPs using dev_pm_opp_remove() OPP: Don't remove dynamic OPPs from _dev_pm_opp_remove_table() OPP: Use a single mechanism to free the OPP table OPP: Prevent creating multiple OPP tables for devices sharing OPP nodes OPP: Pass OPP table to _of_add_opp_table_v{1|2}() drivers/cpufreq/mvebu-cpufreq.c | 9 +- drivers/opp/core.c | 147 ++++++++++++++++--------- drivers/opp/cpu.c | 11 +- drivers/opp/of.c | 186 +++++++++++++++++--------------- drivers/opp/opp.h | 19 ++-- include/linux/pm_opp.h | 6 ++ 6 files changed, 221 insertions(+), 157 deletions(-)