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=-1.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS, URIBL_BLOCKED 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 722ACC43381 for ; Fri, 8 Mar 2019 11:45:36 +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 3F88520851 for ; Fri, 8 Mar 2019 11:45:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="BbGDoTmh" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3F88520851 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-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.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=+/NeTNxzMqOVzkq7ptI8pepJJrSGddXzN/DlzVDpqJw=; b=BbGDoTmhFmmGG9NrjV8KBh656 AeVh/0lk1FbsqyY80ITs2TJew+Qsol8agiMqn/SBiAlrD2ofFNtOuMc5D63ST5aiLKwET5M8vtsG2 zcdEhUdztKcSaF85p7PmAFTahKKQXmb6/jI3wVcB1yQBkhKEDW3jHefm4mbD/N40pyvHH1HdutiFl TX+xebDR4TVIE2T6ulQrqJIprD6vtZrTqMf9lxwA6nKTQm5Dhm+hr9ifsjiIYP0JaExcU9l6lLQW1 Hs6sFT2HoT0/mqqN/0oUwcagGTcMM32Ek6bPwR4/EvdPTNsRrVf5O3WYXdaZrdJYUUFauqNKjKYJ/ 6qd+gyvlQ==; 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 1h2DwJ-0005L7-9Y; Fri, 08 Mar 2019 11:45:23 +0000 Received: from foss.arm.com ([217.140.101.70]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h2DwE-0005Gg-S1 for linux-arm-kernel@lists.infradead.org; Fri, 08 Mar 2019 11:45:20 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2318680D; Fri, 8 Mar 2019 03:45:16 -0800 (PST) Received: from [0.0.0.0] (e107985-lin.cambridge.arm.com [10.1.194.38]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B83443F706; Fri, 8 Mar 2019 03:45:13 -0800 (PST) Subject: Re: [PATCH v1] arch_topology: Make cpu_capacity sysfs node as ready-only To: Lingutla Chandrasekhar , quentin.perret@arm.com, sudeep.holla@arm.com, gregkh@linuxfoundation.org References: <20190306152254.GB19434@e105550-lin.cambridge.arm.com> <1551886073-16217-1-git-send-email-clingutla@codeaurora.org> From: Dietmar Eggemann Message-ID: Date: Fri, 8 Mar 2019 12:45:11 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <1551886073-16217-1-git-send-email-clingutla@codeaurora.org> Content-Language: en-GB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190308_034518_912671_93505FA4 X-CRM114-Status: GOOD ( 12.62 ) 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: catalin.marinas@arm.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, jeremy.linton@arm.com, morten.rasmussen@arm.com, linux-arm-kernel@lists.infradead.org Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 3/6/19 4:27 PM, Lingutla Chandrasekhar wrote: [...] > @@ -51,37 +50,7 @@ static ssize_t cpu_capacity_show(struct device *dev, > static void update_topology_flags_workfn(struct work_struct *work); > static DECLARE_WORK(update_topology_flags_work, update_topology_flags_workfn); > > -static ssize_t cpu_capacity_store(struct device *dev, > - struct device_attribute *attr, > - const char *buf, > - size_t count) > -{ > - struct cpu *cpu = container_of(dev, struct cpu, dev); > - int this_cpu = cpu->dev.id; > - int i; > - unsigned long new_capacity; > - ssize_t ret; > - > - if (!count) > - return 0; > - > - ret = kstrtoul(buf, 0, &new_capacity); > - if (ret) > - return ret; > - if (new_capacity > SCHED_CAPACITY_SCALE) > - return -EINVAL; > - > - mutex_lock(&cpu_scale_mutex); Since we can't write to cpu_scale from here anymore, we could get rid of cpu_scale_mutex. topology_normalize_cpu_scale()->topology_set_cpu_scale() is now only called from: [ 0.202628] topology_normalize_cpu_scale+0x28/0x30 [ 0.207529] init_cpu_topology+0x168/0x1e8 [ 0.211644] smp_prepare_cpus+0x2c/0x108 [ 0.215585] kernel_init_freeable+0x104/0x518 [ 0.219963] kernel_init+0x18/0x110 [ 0.223469] ret_from_fork+0x10/0x1c for dts capacity-dmips-mhz properties and [ 3.130180] topology_normalize_cpu_scale.part.0+0xac/0xd0 [ 3.135619] init_cpu_capacity_callback+0x100/0x178 [ 3.140459] notifier_call_chain+0x5c/0xa0 [ 3.144522] blocking_notifier_call_chain+0x64/0x88 [ 3.149363] cpufreq_set_policy+0xd8/0x3c8 [ 3.153427] cpufreq_init_policy+0x78/0xc8 for cpufreq max frequency related adjustments to cpu capacity. The mutex was introduced for the sysfs interface here: https://lore.kernel.org/lkml/1468932048-31635-8-git-send-email-juri.lelli@arm.com > - for_each_cpu(i, &cpu_topology[this_cpu].core_sibling) > - topology_set_cpu_scale(i, new_capacity); > - mutex_unlock(&cpu_scale_mutex); > - > - schedule_work(&update_topology_flags_work); > - > - return count; > -} > - > -static DEVICE_ATTR_RW(cpu_capacity); > +static DEVICE_ATTR_RO(cpu_capacity); > > static int register_cpu_capacity_sysctl(void) > { > Tested-by: Dietmar Eggemann on Arm64 Juno with v5.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel