From patchwork Sun Jan 23 18:38:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 12721087 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 09EF4C433F5 for ; Sun, 23 Jan 2022 18:41:48 +0000 (UTC) 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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Jqw4fpp2Vvb/GaLCepcZmHPmdrv0XT4pIrfA23nlXzA=; b=LrZNHlV7XG+6ys 6xiu+1SQTxuGR6/Z8qB77wv+raIH7AZO+Y/Rtv2qHpyZ2DrVRF1CREZh5rDZ70tcrm8Zdmkr3obZS yrINVyBee4l8uLRWX6VM0EDdWJ3w/sShDsxo5tBnVcUkeefM1S29sYGD/WuJdwd0sCi6NNR1DqdFX qj8JU/D9sJp52OvptgiUka2nhdzla9mWczvWPAlkgV1J6JqaBWy7IwUzqpyyvRngt6vhVrEC1UvSD gbR8U/7MH8KH2k/+2c7Kn2lnKDvJDagEY4F5Rqws4Me9KhQXix8liXNrbWn83E9wu3wDIpb279hXH SKieC20QkFe2fB35HSCA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nBhmu-001ZEX-CI; Sun, 23 Jan 2022 18:40:28 +0000 Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nBhmq-001ZDQ-0I for linux-arm-kernel@lists.infradead.org; Sun, 23 Jan 2022 18:40:25 +0000 Received: by mail-pg1-x52a.google.com with SMTP id j10so1013318pgc.6 for ; Sun, 23 Jan 2022 10:40:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=QmvdvRYrU0pccxZjPQvOPFahs5Q0IVqksGfZERujS/w=; b=fEMWqJ0non1/1G7N6hoyBkFO73hoqLatan184u4QZ+CXOWfIxa+mKWmDZWQ330NtrL 79a4csmu1WrP8S5N3nNrCuH8lsqH8E0i37IaLhihnfxVCBlGpZ2fIrpdpj0Sf/sxDVCm SD1AIe7Vg0kK9S/RYVeb5lJ1TkJynGTztkTNtNc6fjgN8wXC13OCBbb3Yjz2/2uYMPif zlhj6Q8IPowwVu8vMseCCqQVQa4umcM/Hzid4RgLiZfxYjowX4xiAAPFyMkcjLChRCh+ JugaXNORXRbfPA4WwAdsVX5PX3vxTJsaiYITdOJiuCO+CTZSTYJLrDCdMCbCYWgff9A+ TYkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QmvdvRYrU0pccxZjPQvOPFahs5Q0IVqksGfZERujS/w=; b=DNmg/upSfXaFixfiWyitRem3aKUgSiZN5E2nOIx6HON5ufCwOPYhZQjkBgPlkX4fQb cS68YAUz65XVLY+Pq7M1Nh39tTrEO8kK0HEmj/Vdy2heSbrLq+P+isEWyOLHEZr7MD/2 NVw4EAs/RLRSxBqbZDGtv88G7Zi0mBDf2eN+dUCwh3PzknFht2nBTvE8SKNfXdc3NjHV LIDJZ1QI3C5g5MqcaHOP8OznKN9Dn/uvpn2bChNTqvQ5E8+pmmqqwV1Ph+Eq0YtFaVzk OhQSFaYxcn8vRcqKpjyEcsskvmuf9CWb70lR1sc0+xcPUQJp2PXJ6IePd82ZW6lXjRem GLvA== X-Gm-Message-State: AOAM531hdawCwXbwiHpYkHY+zjcK7CXPliIV+BhY/bwu751AR7zBILrp O/PPdoAYfvBbIw0J3BdYejI= X-Google-Smtp-Source: ABdhPJxe9Mdrm++g1fWsFijEPfG65qpS18BjZ5G1v3x54Dtr9GF+uWdZkbmUM6P3YG36cjhhM695Fg== X-Received: by 2002:a63:7543:: with SMTP id f3mr9431653pgn.360.1642963223187; Sun, 23 Jan 2022 10:40:23 -0800 (PST) Received: from localhost (searspoint.nvidia.com. [216.228.112.21]) by smtp.gmail.com with ESMTPSA id y42sm5575467pfw.157.2022.01.23.10.40.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Jan 2022 10:40:22 -0800 (PST) From: Yury Norov To: Yury Norov , Andy Shevchenko , Rasmus Villemoes , Andrew Morton , =?utf-8?b?TWljaGHFgiBNaXJvc8WC?= =?utf-8?b?YXc=?= , Greg Kroah-Hartman , Peter Zijlstra , David Laight , Joe Perches , Dennis Zhou , Emil Renner Berthing , Nicholas Piggin , Matti Vaittinen , Alexey Klimov , linux-kernel@vger.kernel.org, Will Deacon , Mark Rutland , Shaokun Zhang , Qi Liu , Khuong Dinh , linux-arm-kernel@lists.infradead.org Subject: [PATCH 11/54] perf: replace bitmap_weight with bitmap_empty where appropriate Date: Sun, 23 Jan 2022 10:38:42 -0800 Message-Id: <20220123183925.1052919-12-yury.norov@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220123183925.1052919-1-yury.norov@gmail.com> References: <20220123183925.1052919-1-yury.norov@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220123_104024_071338_DD3FF0FC X-CRM114-Status: GOOD ( 15.28 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org In some places, drivers/perf code calls bitmap_weight() to check if any bit of a given bitmap is set. It's better to use bitmap_empty() in that case because bitmap_empty() stops traversing the bitmap as soon as it finds first set bit, while bitmap_weight() counts all bits unconditionally. Signed-off-by: Yury Norov --- drivers/perf/arm-cci.c | 2 +- drivers/perf/arm_pmu.c | 4 ++-- drivers/perf/hisilicon/hisi_uncore_pmu.c | 2 +- drivers/perf/xgene_pmu.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/perf/arm-cci.c b/drivers/perf/arm-cci.c index 54aca3a62814..96e09fa40909 100644 --- a/drivers/perf/arm-cci.c +++ b/drivers/perf/arm-cci.c @@ -1096,7 +1096,7 @@ static void cci_pmu_enable(struct pmu *pmu) { struct cci_pmu *cci_pmu = to_cci_pmu(pmu); struct cci_pmu_hw_events *hw_events = &cci_pmu->hw_events; - int enabled = bitmap_weight(hw_events->used_mask, cci_pmu->num_cntrs); + bool enabled = !bitmap_empty(hw_events->used_mask, cci_pmu->num_cntrs); unsigned long flags; if (!enabled) diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c index 295cc7952d0e..a31b302b0ade 100644 --- a/drivers/perf/arm_pmu.c +++ b/drivers/perf/arm_pmu.c @@ -524,7 +524,7 @@ static void armpmu_enable(struct pmu *pmu) { struct arm_pmu *armpmu = to_arm_pmu(pmu); struct pmu_hw_events *hw_events = this_cpu_ptr(armpmu->hw_events); - int enabled = bitmap_weight(hw_events->used_mask, armpmu->num_events); + bool enabled = !bitmap_empty(hw_events->used_mask, armpmu->num_events); /* For task-bound events we may be called on other CPUs */ if (!cpumask_test_cpu(smp_processor_id(), &armpmu->supported_cpus)) @@ -785,7 +785,7 @@ static int cpu_pm_pmu_notify(struct notifier_block *b, unsigned long cmd, { struct arm_pmu *armpmu = container_of(b, struct arm_pmu, cpu_pm_nb); struct pmu_hw_events *hw_events = this_cpu_ptr(armpmu->hw_events); - int enabled = bitmap_weight(hw_events->used_mask, armpmu->num_events); + bool enabled = !bitmap_empty(hw_events->used_mask, armpmu->num_events); if (!cpumask_test_cpu(smp_processor_id(), &armpmu->supported_cpus)) return NOTIFY_DONE; diff --git a/drivers/perf/hisilicon/hisi_uncore_pmu.c b/drivers/perf/hisilicon/hisi_uncore_pmu.c index a738aeab5c04..358e4e284a62 100644 --- a/drivers/perf/hisilicon/hisi_uncore_pmu.c +++ b/drivers/perf/hisilicon/hisi_uncore_pmu.c @@ -393,7 +393,7 @@ EXPORT_SYMBOL_GPL(hisi_uncore_pmu_read); void hisi_uncore_pmu_enable(struct pmu *pmu) { struct hisi_pmu *hisi_pmu = to_hisi_pmu(pmu); - int enabled = bitmap_weight(hisi_pmu->pmu_events.used_mask, + bool enabled = !bitmap_empty(hisi_pmu->pmu_events.used_mask, hisi_pmu->num_counters); if (!enabled) diff --git a/drivers/perf/xgene_pmu.c b/drivers/perf/xgene_pmu.c index 2b6d476bd213..88bd100a9633 100644 --- a/drivers/perf/xgene_pmu.c +++ b/drivers/perf/xgene_pmu.c @@ -867,7 +867,7 @@ static void xgene_perf_pmu_enable(struct pmu *pmu) { struct xgene_pmu_dev *pmu_dev = to_pmu_dev(pmu); struct xgene_pmu *xgene_pmu = pmu_dev->parent; - int enabled = bitmap_weight(pmu_dev->cntr_assign_mask, + bool enabled = !bitmap_empty(pmu_dev->cntr_assign_mask, pmu_dev->max_counters); if (!enabled) From patchwork Sun Jan 23 18:38:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 12721088 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 9F1AFC433FE for ; Sun, 23 Jan 2022 18:41:58 +0000 (UTC) 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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=wYKeZuoecTxzBaNH6L1QKe645P77L12Jc7nHPgVh/GI=; b=uilFeOLShchBhJ ZsBUzvkdFtuU2N284T6Yid31LfOGlUUNju6hs3BhLvGqpdo2k4mJxTI3S18WSc75fRWE5rCW7BHFz abhysp8/eMnc7bRNFcEAHN5bVm1nPxMNpFMfMbRL6Y+cOw2JQWIRoTg6RtXC/xAlEUJN2hX9Ljioe YodwdjGzyb2/PsouN5xDTHrRKft3irpjOHV35GO0Y0y3Y/ZrcXmLLtN1w/JVAsoDCgaX5iOt/pKy6 QKAsuDXbkSCRqMd1KnZjNrMfMCPvKxyKbOESxG/jAclek8096jmCXpFXlfllGgcxHWMtg8IRUkbIi jU4UoZRHxRHxkpyC83uQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nBhnA-001ZIo-Me; Sun, 23 Jan 2022 18:40:44 +0000 Received: from mail-pg1-x52e.google.com ([2607:f8b0:4864:20::52e]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nBhn8-001ZHH-3O for linux-arm-kernel@lists.infradead.org; Sun, 23 Jan 2022 18:40:43 +0000 Received: by mail-pg1-x52e.google.com with SMTP id e16so3847373pgn.4 for ; Sun, 23 Jan 2022 10:40:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=eBCqVqROfO1n2GtvmaN8kb1rlmDqWZOnUSJDskEB5Oo=; b=mJpgWld2B5wbHhAvTMo/0gMGWx3ZGMwlFDlFyfSZigS6cUmCqMZhCmhhnpUtMwHQvy U7vEWX2yv0mK4/592AvEUhGR8Bcq1qSOtPDaE68Fcx0iEHXFXSw+JfHNJwvdbsEQU8Nk Tzi0/XyxcEtaa0BR1NACnnrVqmbASiYnUX6wAv39ETD9AwBjexOS8Dq6D28L55v1DIeA z8LGQVXZcM/fQX5tf8gJB52u4N9LngjlLpLvLwTz9zLbczSKPpNuB1og0VOis8OQopte HszK8h97b+7fUeV0fxI+/kNFpek6zXMX2TbaxxRH0Jpoxd5rkk3XDT7S9kduvAKZlNGN xX/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eBCqVqROfO1n2GtvmaN8kb1rlmDqWZOnUSJDskEB5Oo=; b=kisC+bunSBhdcNAdQqEmP0s6f+EaU0Yl+83QSgoCCeAjxLcd8hlgGjymUX9rcQ/xx4 TmKmX0YWTEh4ZFHCUL33Jg297FFQ/+yjemJsOztpc5TKZbsrxT8PViFss6y0zwlJcc1r orcjzthsXdixCF53SoZcr5SBst6sHPoHtTrTIXG1uSTUsKcVVdouFKoQ7dUcyJr4q0FM tjM1CVqorK5p0hQdVJPFW0tfm6xkNEfj5X/vQtXOWCwwexTGP2fJMwkk6Bxv8SZDs+h0 uPzLNCj7/jP31JSDnPxrnLBd7mDQHMe3IsHvHDGIw2qAm+JbetNNc8kSsalpKfaSmDLr CNMQ== X-Gm-Message-State: AOAM532vXEOvqzxPzBUhOquBpgOtZVTWeroyQVIaze9g+IxU41dDmRYW teS0B05Ozl7DR8ZUWJei5kQ= X-Google-Smtp-Source: ABdhPJwRbsW8Pwf2wNB+Tms82WHgGwFZKC0sf8JW2mhyRDN3TsdWwUbRPyPzecSyKFotLcUKv7t4fA== X-Received: by 2002:a62:4c3:0:b0:4c2:7817:7360 with SMTP id 186-20020a6204c3000000b004c278177360mr11429381pfe.24.1642963238546; Sun, 23 Jan 2022 10:40:38 -0800 (PST) Received: from localhost (searspoint.nvidia.com. [216.228.112.21]) by smtp.gmail.com with ESMTPSA id h5sm13043609pfi.111.2022.01.23.10.40.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Jan 2022 10:40:38 -0800 (PST) From: Yury Norov To: Yury Norov , Andy Shevchenko , Rasmus Villemoes , Andrew Morton , =?utf-8?b?TWljaGHFgiBNaXJvc8WC?= =?utf-8?b?YXc=?= , Greg Kroah-Hartman , Peter Zijlstra , David Laight , Joe Perches , Dennis Zhou , Emil Renner Berthing , Nicholas Piggin , Matti Vaittinen , Alexey Klimov , linux-kernel@vger.kernel.org, Andy Gross , Bjorn Andersson , "Rafael J. Wysocki" , Viresh Kumar , Sudeep Holla , Cristian Marussi , linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 16/54] cpufreq: replace cpumask_weight with cpumask_empty where appropriate Date: Sun, 23 Jan 2022 10:38:47 -0800 Message-Id: <20220123183925.1052919-17-yury.norov@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220123183925.1052919-1-yury.norov@gmail.com> References: <20220123183925.1052919-1-yury.norov@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220123_104042_179730_9332F300 X-CRM114-Status: GOOD ( 14.87 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org drivers/cpufreq calls cpumask_weight() to check if any bit of a given cpumask is set. We can do it more efficiently with cpumask_empty() because cpumask_empty() stops traversing the cpumask as soon as it finds first set bit, while cpumask_weight() counts all bits unconditionally. Signed-off-by: Yury Norov Reviewed-by: Sudeep Holla (for SCMI cpufreq driver) --- drivers/cpufreq/qcom-cpufreq-hw.c | 2 +- drivers/cpufreq/scmi-cpufreq.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c index 05f3d7876e44..95a0c57ab5bb 100644 --- a/drivers/cpufreq/qcom-cpufreq-hw.c +++ b/drivers/cpufreq/qcom-cpufreq-hw.c @@ -482,7 +482,7 @@ static int qcom_cpufreq_hw_cpu_init(struct cpufreq_policy *policy) } qcom_get_related_cpus(index, policy->cpus); - if (!cpumask_weight(policy->cpus)) { + if (cpumask_empty(policy->cpus)) { dev_err(dev, "Domain-%d failed to get related CPUs\n", index); ret = -ENOENT; goto error; diff --git a/drivers/cpufreq/scmi-cpufreq.c b/drivers/cpufreq/scmi-cpufreq.c index 1e0cd4d165f0..919fa6e3f462 100644 --- a/drivers/cpufreq/scmi-cpufreq.c +++ b/drivers/cpufreq/scmi-cpufreq.c @@ -154,7 +154,7 @@ static int scmi_cpufreq_init(struct cpufreq_policy *policy) * table and opp-shared. */ ret = dev_pm_opp_of_get_sharing_cpus(cpu_dev, priv->opp_shared_cpus); - if (ret || !cpumask_weight(priv->opp_shared_cpus)) { + if (ret || cpumask_empty(priv->opp_shared_cpus)) { /* * Either opp-table is not set or no opp-shared was found. * Use the CPU mask from SCMI to designate CPUs sharing an OPP From patchwork Sun Jan 23 18:39:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 12721089 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id CBD7DC433EF for ; Sun, 23 Jan 2022 18:42:57 +0000 (UTC) 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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=YOlw6cdpvzhw8RBtVaBXM90Nvw5Umv0MzgCq438SBjc=; b=lFwhv/2dX7ILEP Cr6b3so5nXfshdMsELvllAYpG0f9Dc0X2+28KhIgCxLLyVd+r6XpVoZwT/7YSe/6HgpHhnG8Qn042 fZ6FF40t0RTKVPHpE/xMaMJfYON+H1hHUbuGnZbRN4TaykbBl0xkuM6BtZpJg8hP6JekZWYF3jdHA 6AanTM6IkPczRgcIm+1ba2yU6x3xm7eY8VJSuO/gRn4B9zays5scxx1U6GVqayNzZiPEgn5u79jQt bBbJVlXcg7w+RCJr/wy4Cu2+R7eHlrtL565OdagbZ3mRvSDpcaN0lz9imgBcOJaKgNvQPGW3s9nZn Z3A8fOtQ0d3FKZsTNi/A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nBho2-001ZgP-Th; Sun, 23 Jan 2022 18:41:39 +0000 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nBhnz-001ZeH-N6 for linux-arm-kernel@lists.infradead.org; Sun, 23 Jan 2022 18:41:37 +0000 Received: by mail-pf1-x42c.google.com with SMTP id v74so10524003pfc.1 for ; Sun, 23 Jan 2022 10:41:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=T5W4tcAlu9II6TGKyllSre1cwbBZX0+vG2XX1glXT5Y=; b=VC3JAELl4Bcc9x72apcbabSCxL7VtVtW52zOXinf9qQcKr8OiQhjNNZMIrMJHzF88t PBbjx7GVOfENmdJpobQoYLoM0+q14MmtfuHhOG+fjHB0cOXMjZCKVaz6bk6JD+LNKC5B 5NUZ3S71+7ggjbktRx126GlRhxpUMjYhaZ2jbXFyzl5Lj7tIXclBHF9agDV7w5Qy9DhE XHds+SdkFGGW/BxKpgXgtqSdEdTmoAGhhKG9P7xJgfG1bWErw0ZgZPmTOwklfWyoaD2b xRSYuTXb3JFgXIhYF7+jekASh+2hU6RWDE3TB0a2Q1knyPegNCjOVKr8ZN8q72lZ8YSV A6cQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=T5W4tcAlu9II6TGKyllSre1cwbBZX0+vG2XX1glXT5Y=; b=lBziQvetFRLjMKoJSFZv/1Ea5CmP3qaTZRGb9Tq14q3xB7isSdYHLMngTIMbsXXRdq xacAmECI6LusSbk/MJfzEMoW/WafDIeShZc+THXetkSdtqV1MC8lThBeMBS8vPdIYf/t Eo19zFxAk+tYCmo2REJiuySpUQy17z3ISB1PEcpU7cC+OLyf8wuhcsRL6TfXHWKtDfhV IDYjLf85/mtXNUATQ2Wz1xzisMIkrUP9e8f0g3D3Gk9v+zomuEZEATHVHp1mOggvKPIT Sc3VxFe0d8x3zLSGRzGhM+NpPldDysbjUpcGswrBlcQMi7lps9UpZs/+SMsLDCwbkfWz 6INw== X-Gm-Message-State: AOAM532Imym4ueVmveFrytBjoLpCgnKDnHkk5nbPr0Ev/A3PmhaZZ6IH EqyPYLlGQVFM0klBa3KiVfU= X-Google-Smtp-Source: ABdhPJxNACDhw+pefiza8oco2JDFigwtzNjUitC28s8922ZKmIrgEEtXSDugjM9DU6Y1rqgheHdTqQ== X-Received: by 2002:a63:9347:: with SMTP id w7mr9366776pgm.84.1642963294566; Sun, 23 Jan 2022 10:41:34 -0800 (PST) Received: from localhost (searspoint.nvidia.com. [216.228.112.21]) by smtp.gmail.com with ESMTPSA id k12sm14285241pfc.107.2022.01.23.10.41.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Jan 2022 10:41:34 -0800 (PST) From: Yury Norov To: Yury Norov , Andy Shevchenko , Rasmus Villemoes , Andrew Morton , =?utf-8?b?TWljaGHFgiBNaXJvc8WC?= =?utf-8?b?YXc=?= , Greg Kroah-Hartman , Peter Zijlstra , David Laight , Joe Perches , Dennis Zhou , Emil Renner Berthing , Nicholas Piggin , Matti Vaittinen , Alexey Klimov , linux-kernel@vger.kernel.org, Will Deacon , Mark Rutland , linux-arm-kernel@lists.infradead.org Subject: [PATCH 34/54] perf: replace bitmap_weight with bitmap_weight_eq for ThunderX2 Date: Sun, 23 Jan 2022 10:39:05 -0800 Message-Id: <20220123183925.1052919-35-yury.norov@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220123183925.1052919-1-yury.norov@gmail.com> References: <20220123183925.1052919-1-yury.norov@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220123_104135_781380_CE5B9F8F X-CRM114-Status: GOOD ( 12.89 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org tx2_uncore_event_start() calls bitmap_weight() to compare the weight of bitmap with a given number. We can do it more efficiently with bitmap_weight_eq because conditional bitmap_weight may stop traversing the bitmap earlier, as soon as condition is met. Signed-off-by: Yury Norov --- drivers/perf/thunderx2_pmu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/perf/thunderx2_pmu.c b/drivers/perf/thunderx2_pmu.c index 05378c0fd8f3..ebfa66b212c7 100644 --- a/drivers/perf/thunderx2_pmu.c +++ b/drivers/perf/thunderx2_pmu.c @@ -623,8 +623,8 @@ static void tx2_uncore_event_start(struct perf_event *event, int flags) return; /* Start timer for first event */ - if (bitmap_weight(tx2_pmu->active_counters, - tx2_pmu->max_counters) == 1) { + if (bitmap_weight_eq(tx2_pmu->active_counters, + tx2_pmu->max_counters, 1)) { hrtimer_start(&tx2_pmu->hrtimer, ns_to_ktime(tx2_pmu->hrtimer_interval), HRTIMER_MODE_REL_PINNED); From patchwork Sun Jan 23 18:39:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 12721090 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 36EDAC433FE for ; Sun, 23 Jan 2022 18:43:18 +0000 (UTC) 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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=BXQ8eBxtHQVIg/6Kp8U5Q2Vbb+UhpAMAL/trgaiZwuQ=; b=YaMtWsD6GvA4Ud kwTQijKNLxP75BVXBHI2aLaVHka56jN/FQW6vx3hrcw6JcHvJ86tbTjpxcBLmuphiFMg/CjgwuvxH MfCPimIrpPMUKerd1lJicXzfQPWNpEVF+gj7ecN3SYnFOOttbp7U6ZMK4vlBdrsbnkeTmPDfRbAMQ foD8pmT1VLjYEBGgSF519xm5jA3u7M60XIiflM6w9xpYYBZ1AL1zmrI5q/n6YHxxVTB/TLHjUs9QP UYHzbpYyyI2cy2U7qJNrscrOfSa0SOnueh0ybMEjMu2El86tRnr4QpJOOBdFLULK6pDQSpCLqpd3p Wamry3kCZqSH5JIITxcg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nBhoR-001Zsr-Ui; Sun, 23 Jan 2022 18:42:04 +0000 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nBhoO-001Zqw-OS for linux-arm-kernel@lists.infradead.org; Sun, 23 Jan 2022 18:42:02 +0000 Received: by mail-pj1-x1031.google.com with SMTP id pf13so14154198pjb.0 for ; Sun, 23 Jan 2022 10:42:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=SXSPpkBNjFI2449vR4ZOBpkrXqfQ1QSZDhxzDBOLdyY=; b=eiPAXI/WjLAblkhca2uJhe8/W1CRBsKo7ESuVXB0ckdjmDbHwcwgeLa2vXoJEA0fxt Lk59qbjVjcrnZW1unyX5auKxG1xSZWfPJLHePY7jbbfw6OU/1dAOiaW9oqdl3dEpJ3Xn sakgCeMBvaAp3NPshZro4hIL2pKSOLMTNpsTpVv9/0QG/GJwtcdeptM9Yq4T2QuU6dXK UTfY8b5LygRS843t6y5kmY8IYWkURJI+hhQfQcy71BSS5so3P9u58xxmG18sNMn9oYSq pafGE5mVfB/hgq0mIoQ+ZMVlM2mnFF+ic2R7UXat+e/IHhEQ+9l8LdM2qfjQ5lJdjt7W AaWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SXSPpkBNjFI2449vR4ZOBpkrXqfQ1QSZDhxzDBOLdyY=; b=h3Q03h1OEG8U/5FKM46xRPolNsh1z1cluIGQZ64i70Io/8S86VwIoeSULAb1C9xG59 vya3KM8fbXdcD6HYX6S5ZXRjtyg7AMq3+aEvZQ35ujJIBZAV1vGtVIiVMsM4Y06Itgja POpBqJc1Y+4Nmyvu+xDBTTlpmOvq4qc0Zt/Tte0Wp+x9Y66qMEuKFUM0DxkDMu22//V2 Mh3B3dEFtuY4RAGZSqRGhQbfQjI+7W8mSZQE6gOr1pV6agwYwQT/Ew4pzB2eTiHTrG+l oIuC8GRSNk+m03QkAMUdbNjGq9ihj3B4YnJV2uHA40MmKhiSPTYoaOk6tCkLmZ11Ufrw azsQ== X-Gm-Message-State: AOAM531oXk0tflTnFFTwjTtBUjUrkDBc0PdEkgD16Pc9FzOTOzyidsN3 eA2kM7yHYZO+E4RF93Uw1NE= X-Google-Smtp-Source: ABdhPJyKnDsoQFq8L/+C1ePy3bLtIDZz3wYrVC6GemjQIHFlwG9Gr4xw7tsDXE/Qezv8iRphFZXolQ== X-Received: by 2002:a17:90a:8807:: with SMTP id s7mr9725127pjn.223.1642963319695; Sun, 23 Jan 2022 10:41:59 -0800 (PST) Received: from localhost (searspoint.nvidia.com. [216.228.112.21]) by smtp.gmail.com with ESMTPSA id mi6sm12051532pjb.40.2022.01.23.10.41.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Jan 2022 10:41:59 -0800 (PST) From: Yury Norov To: Yury Norov , Andy Shevchenko , Rasmus Villemoes , Andrew Morton , =?utf-8?b?TWljaGHFgiBNaXJvc8WC?= =?utf-8?b?YXc=?= , Greg Kroah-Hartman , Peter Zijlstra , David Laight , Joe Perches , Dennis Zhou , Emil Renner Berthing , Nicholas Piggin , Matti Vaittinen , Alexey Klimov , linux-kernel@vger.kernel.org, Mark Rutland , Lorenzo Pieralisi , linux-arm-kernel@lists.infradead.org Subject: [PATCH 42/54] firmware: pcsi: replace cpumask_weight with cpumask_weight_eq Date: Sun, 23 Jan 2022 10:39:13 -0800 Message-Id: <20220123183925.1052919-43-yury.norov@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220123183925.1052919-1-yury.norov@gmail.com> References: <20220123183925.1052919-1-yury.norov@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220123_104200_821484_779977ED X-CRM114-Status: GOOD ( 12.81 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org down_and_up_cpus() calls cpumask_weight() to compare the weight of cpumask with a given number. We can do it more efficiently with cpumask_weight_{eq, ...} because conditional cpumask_weight may stop traversing the cpumask earlier, as soon as condition is met. Signed-off-by: Yury Norov --- drivers/firmware/psci/psci_checker.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/firmware/psci/psci_checker.c b/drivers/firmware/psci/psci_checker.c index 116eb465cdb4..90c9473832a9 100644 --- a/drivers/firmware/psci/psci_checker.c +++ b/drivers/firmware/psci/psci_checker.c @@ -90,7 +90,7 @@ static unsigned int down_and_up_cpus(const struct cpumask *cpus, * cpu_down() checks the number of online CPUs before the TOS * resident CPU. */ - if (cpumask_weight(offlined_cpus) + 1 == nb_available_cpus) { + if (cpumask_weight_eq(offlined_cpus, nb_available_cpus - 1)) { if (ret != -EBUSY) { pr_err("Unexpected return code %d while trying " "to power down last online CPU %d\n", From patchwork Sun Jan 23 18:39:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 12721091 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 0277CC433FE for ; Sun, 23 Jan 2022 18:43:24 +0000 (UTC) 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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=z0s76UkwYbs7OGFR0PrBAFxSlYWbPZcusuBvQGbvqfc=; b=Z+pT4WDL1hJ5Ql keZg8jm3kavb3jCFgdmmvvuExb8H5TbKTDV5YqpD7JvfBgvT4ZKGGjGJNg21DmC2zIY21A2j8V5v8 1eMRR0tqcsX4KgTjJEwemxKZxC4ubTMBUWxjfWYVaYtApnWHGGW3OOA2SF7U3pSyZcGU0ZRy0k59t +jyaPjQuu+tz4FwmQMmzYR9sRThHwIzxElzCXPJYLqxVgrut04NuGR7kVSgpFboHdV0AOZSPzJ6Kw RdcC/u4UaS3heVwzfIosaJ4HOoELuOhLWa27lwWqUsVYxcHenwPeIDi9REV7yewXVqkkO/gGKvflS caHBYJ819KT1PqF1dSTw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nBhof-001Zzf-TS; Sun, 23 Jan 2022 18:42:18 +0000 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nBhob-001Zxi-4M for linux-arm-kernel@lists.infradead.org; Sun, 23 Jan 2022 18:42:14 +0000 Received: by mail-pl1-x62a.google.com with SMTP id e8so13482140plh.8 for ; Sun, 23 Jan 2022 10:42:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=VqjN8AVE4l1jGj4WKwwteMJXfvhHCp8LxE1b5uVHyhI=; b=C1SMT8g72QpJmf2bGBlHtrMJyAm02anZRdJPiD2hXPa8KnxyJmdZw8KHlGAX0+WQGc BZHWyBl2a5DTg8aenBofL3Pa+LSa4prxrtnLXqzJa+qJVVLWS9YDxbbC4POYvOHztAqw IyapelEZ/75WdLGC84xm+UEAL5Cev9xJG06mFRsDSpCKQLMoLxgo8eFVJQqILZ1wkvcj /C5aH5KAaWIXgqOmeQebx/JlfxVpZJzkpasVbNS7lD3Xygu7Dq/lNJpvZKtbbQBFVMYy bxtmSmEeLKDAfMNUeFJyK+ebz4bFvez0SDfycUa2ySgs5dFSDYB8Y/ANERmbRLt77Z2M N4zA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VqjN8AVE4l1jGj4WKwwteMJXfvhHCp8LxE1b5uVHyhI=; b=haDRk8zjzkLPsdBTe8XSX6IeNjp7E/1OUcACaAzI47MOF0t4YgsY7OknA3aalfugsh cRQbKdy8QyWQ+0piyX+xwAdXj9vDvWt50wEqhTOcRW7sYsc7rZHO1332uhC6y33sW3wO 4Mmbz8YuFvZ3bW+6NGTz0q1SWw3133s3azy1Y0xDt1n7paTX2CCyo5mlhhUVVlaMCRcm 5LFjT1EmN3o/g0ycJNgGzXnEdeG7FAvX5zC7h+QK4NvwSKupK1tK3kU265EqsJoKovB8 aPpajvGqGGssuy63VE4uHWVdJFCq+/8cvCAxMnfD+yut9g8HqjvbzYBB1BfjtbxxKt8a 4HGg== X-Gm-Message-State: AOAM530oiINniPv/vCFwiuBcBMthxh3ftcIBweoyHgjJ0uE9JH6C55q/ uc9Bs27T6E1hixoes6Dt7CA= X-Google-Smtp-Source: ABdhPJyR3LEGx3dQjXbO/uCCX9t/QjIgjrhqlzEDELiIFsGeBhAD2N532FLMhxMOd5s6FzXSuCmH2g== X-Received: by 2002:a17:902:d883:b0:14a:4ba5:6e72 with SMTP id b3-20020a170902d88300b0014a4ba56e72mr12062149plz.27.1642963332593; Sun, 23 Jan 2022 10:42:12 -0800 (PST) Received: from localhost (searspoint.nvidia.com. [216.228.112.21]) by smtp.gmail.com with ESMTPSA id q140sm10315902pgq.7.2022.01.23.10.42.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Jan 2022 10:42:12 -0800 (PST) From: Yury Norov To: Yury Norov , Andy Shevchenko , Rasmus Villemoes , Andrew Morton , =?utf-8?b?TWljaGHFgiBNaXJvc8WC?= =?utf-8?b?YXc=?= , Greg Kroah-Hartman , Peter Zijlstra , David Laight , Joe Perches , Dennis Zhou , Emil Renner Berthing , Nicholas Piggin , Matti Vaittinen , Alexey Klimov , linux-kernel@vger.kernel.org, Li Yang , linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 46/54] soc: replace cpumask_weight with cpumask_weight_lt Date: Sun, 23 Jan 2022 10:39:17 -0800 Message-Id: <20220123183925.1052919-47-yury.norov@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220123183925.1052919-1-yury.norov@gmail.com> References: <20220123183925.1052919-1-yury.norov@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220123_104213_217399_EA75272A X-CRM114-Status: GOOD ( 11.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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org qman_test_stash() calls cpumask_weight() to compare the weight of cpumask with a given number. We can do it more efficiently with cpumask_weight_lt because conditional cpumask_weight may stop traversing the cpumask earlier, as soon as condition is met. Signed-off-by: Yury Norov --- drivers/soc/fsl/qbman/qman_test_stash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/soc/fsl/qbman/qman_test_stash.c b/drivers/soc/fsl/qbman/qman_test_stash.c index b7e8e5ec884c..28b08568a349 100644 --- a/drivers/soc/fsl/qbman/qman_test_stash.c +++ b/drivers/soc/fsl/qbman/qman_test_stash.c @@ -561,7 +561,7 @@ int qman_test_stash(void) { int err; - if (cpumask_weight(cpu_online_mask) < 2) { + if (cpumask_weight_lt(cpu_online_mask, 2)) { pr_info("%s(): skip - only 1 CPU\n", __func__); return 0; }