Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965015AbbGVB3l (ORCPT ); Tue, 21 Jul 2015 21:29:41 -0400 Received: from v094114.home.net.pl ([79.96.170.134]:44582 "HELO v094114.home.net.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S964964AbbGVB3f (ORCPT ); Tue, 21 Jul 2015 21:29:35 -0400 From: "Rafael J. Wysocki" To: Viresh Kumar Cc: "Rafael J. Wysocki" , Russell King - ARM Linux , Lists linaro-kernel , "linux-pm@vger.kernel.org" , open list Subject: Re: [PATCH] cpufreq: Avoid double addition/removal of sysfs links Date: Wed, 22 Jul 2015 03:56:21 +0200 Message-ID: <6175136.CkGk6PGZKa@vostro.rjw.lan> User-Agent: KMail/4.11.5 (Linux/4.1.0-rc5+; KDE/4.11.5; x86_64; ; ) In-Reply-To: References: <20150718163149.GP7557@n2100.arm.linux.org.uk> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="utf-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1714 Lines: 39 On Wednesday, July 22, 2015 01:15:01 AM Rafael J. Wysocki wrote: > Hi VIresh, > > On Mon, Jul 20, 2015 at 11:47 AM, Viresh Kumar wrote: > > Consider a dual core (0/1) system with two CPUs: > > - sharing clock/voltage rails and hence cpufreq-policy > > - CPU1 is offline while the cpufreq driver is registered > > > > - cpufreq_add_dev() is called from subsys callback for CPU0 and we > > create the policy for the CPUs and create link for CPU1. > > - cpufreq_add_dev() is called from subsys callback for CPU1, we find > > that the cpu is offline and we try to create a sysfs link for CPU1. > > So the problem is that the cpu_is_offline(cpu) check in > cpufreq_add_dev() matches two distinct cases: (1) the CPU was not > present before and it is just being hot-added and (2) the CPU is > initially offline, but present, and this is the first time its device > is registered. In the first case we can expect that the CPU will > become online shortly (although that is not guaranteed too), but in > the second case that very well may not happen. > > We need to be able to distinguish between those two cases and your > patch does that, but I'm not sure if this really is the most > straightforward way to do it. It looks like we need a mask of related CPUs that are present. Or, alternatively, a mask of CPUs that would have been related had they been present. That's sort of what your patch is adding, but not quite. Thanks, Rafael -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/