From patchwork Thu Feb 28 11:53:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandrasekhar L X-Patchwork-Id: 10832839 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 D959915AC for ; Thu, 28 Feb 2019 11:54:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C261C2E302 for ; Thu, 28 Feb 2019 11:54:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B357B2E334; Thu, 28 Feb 2019 11:54:32 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 641AB2E302 for ; Thu, 28 Feb 2019 11:54:32 +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=aF/Ty42pkFqnCNu1fjv+9A10DRJeqAU3Dq2kdk8WqJs=; b=oxU BlSnrC7bW6AtcKnP8ZYeo4MW634oUhFLlNBt5BVlRTPWesDWOKxwNeMCCA/UKLOLXUb3bzx2HU5k8 U17mLJTD+eUXEigu+kcqQaBmgRBYO8LG2DbSZaWNiH6bdS+ivVJCD/z0wkAzBcB9rwG1zYS2tS171 RMKf43jSlr9wAZdn+TTAJ0qWUW6cqGq5UtVj0IqAu/JH3Li3x8GdMyNZjhLlexn3CjHJTS9B65tJt gQtFLe7+sGUcrD1shh4PTP71lzj9FUyItBtQzQE18fVxcpfbkLVEV2n8gcLZXMeHhjRxTCDIm9+EL piX/qJQOTedC/YiAU2MslwPjMlUMugw==; 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 1gzKGg-0005bK-BS; Thu, 28 Feb 2019 11:54:26 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gzKGd-0005az-EN for linux-arm-kernel@lists.infradead.org; Thu, 28 Feb 2019 11:54:24 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 9340D60DAA; Thu, 28 Feb 2019 11:54:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1551354862; bh=CSCCdtxZS56lrNPM8PJ19FKIo9nuVoJnK/SzeqZdvkA=; h=From:To:Cc:Subject:Date:From; b=NkZvSkH922+XLTDYGiAkYRjIhMLsN27SBfWJIOl79uTMh9Va+DW++ahMPcF8/qqVi 88KljvhsyyDERD6ZD/Zxw/xQeKdyKdu6SLHqi3fWFb5Afwf6rOQ9odXmSzDCGxhB2A qMM4xOF3b9Rdoh7O2J5JS8N3iUggoWSeN5GmMrDA= Received: from lingutla-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: clingutla@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 8C6B760A05; Thu, 28 Feb 2019 11:54:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1551354860; bh=CSCCdtxZS56lrNPM8PJ19FKIo9nuVoJnK/SzeqZdvkA=; h=From:To:Cc:Subject:Date:From; b=P7aEEG1QxljyQxwf5/3o0ymOcmJm7H4cOaw8glNowaeRJz3rR3uhL903CN1B1nmSK bzf9KQLxQNONdaWdrpk5LJkHQyYZZradgbciAcdeW2H5jKcZvxofzeWD9aHPkGTxTs zwTHu4UkN+I6NPC5HUzoxLTsCFFXMNgcNTmfmwN0= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 8C6B760A05 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=clingutla@codeaurora.org From: Lingutla Chandrasekhar To: will.deacon@arm.com, sudeep.holla@arm.com, catalin.marinas@arm.com, dietmar.eggemann@arm.com Subject: [PATCH] arch_topology: Update user supplied capacity to possible cpus in cluster Date: Thu, 28 Feb 2019 17:23:58 +0530 Message-Id: <1551354838-29902-1-git-send-email-clingutla@codeaurora.org> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190228_035423_502576_E1F2DEBF X-CRM114-Status: UNSURE ( 9.66 ) X-CRM114-Notice: Please train this message. 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: Lingutla Chandrasekhar , 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 With commit '5bdd2b3f0f8 ("arm64: topology: add support to remove cpu topology sibling masks")', when cpu hotplugged out, it resets the cpu information in its sibling CPUs. If user changes capacity of any cpu, then the new capacity applied to all online cpus in the cluster. If any hot plugged out cpu in the same cluster comes back to online, then that would have different/stale capacity value. Fix it by applying user supplied capacity to all possible cpus in the cluster. Signed-off-by: Lingutla Chandrasekhar diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index edfcf8d..dadc5d8 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -61,6 +61,7 @@ static ssize_t cpu_capacity_store(struct device *dev, int i; unsigned long new_capacity; ssize_t ret; + struct cpu_topology *icpu_topo, *this_topo = &cpu_topology[this_cpu]; if (!count) return 0; @@ -72,8 +73,15 @@ static ssize_t cpu_capacity_store(struct device *dev, return -EINVAL; mutex_lock(&cpu_scale_mutex); - for_each_cpu(i, &cpu_topology[this_cpu].core_sibling) + + for_each_possible_cpu(i) { + icpu_topo = &cpu_topology[i]; + + if (icpu_topo->package_id != this_topo->package_id) + continue; topology_set_cpu_scale(i, new_capacity); + } + mutex_unlock(&cpu_scale_mutex); schedule_work(&update_topology_flags_work);