Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp2912624ybc; Thu, 14 Nov 2019 00:45:32 -0800 (PST) X-Google-Smtp-Source: APXvYqyytVG98vQoWSa8BfQAbItTCoclC/HWOU+RoMGQTBHKwY9BOcClsemgd2vW7SE7T4NgByKs X-Received: by 2002:a05:6402:1146:: with SMTP id g6mr8623353edw.215.1573721131947; Thu, 14 Nov 2019 00:45:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573721131; cv=none; d=google.com; s=arc-20160816; b=plh3bSIXoLUf3dQw3sX3tJ8P7JRLwEb0xTrnc1tATO++/3iuKjizSfpzivs3L9aRDK Z3qteRasiyJG7+yJ86JEkR+roSY7HILGr4iX7hY8NXW6P5dKGts3dNvZzyWHg4GIHUA2 ltC5RrSobEOF9IknHsI0EgbzrAQCBVTmKxc+3qaK4Dx82atrEvNyY3vNvmfrUwHUihn1 B3LuRwS+cvDHfo1sI5A4GbYCKu/oVhi+DZFpVhN+QcVXYk30CVxBYQ23TFDFYspUzkaF nJXAx9zZ8xWrimSXi3wn3ayFEcdjkH0Az6g7MWSP7dKHcgUGk6Iib0iKYtfh9wYvUs4H n4fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=dtXf1cklkEILsdJe1BKmSn+H2sUj3L7wyP1UZ92tPKI=; b=TqE4EtMKZt9sujXr2DNgZe73Y+yxcFQI+sgvCbqYUxNmMPAI5HLZvb4/U24mPNlq7H qPVtoGW2vXhnyNJniynzUweNN+kV4PeAaa1n6Fh9qwpE/Bg//TRDZkdpyy/CQuEpzaLc QIbQFxhQ1Pp9xFsTCeama3Qf3nI1TBQjvP7SiLA3nTtUdRrRYFCZ/yOi2H/vqWC/3Al8 VjQ8GjVZ+xjeo+KzRhMkzTJ4Ul52HdFmeLzg75igWrou8D+l6vcyxfVH6uhC+f9zLxNo OhAJQHjdP0QEn82x5IxUW5W3zoXSAMfnMXshDSAKyolX0MEKMROweYgB/KZNvI4M6Hfv aQTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Mok+lx5+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gu26si2863454ejb.228.2019.11.14.00.45.07; Thu, 14 Nov 2019 00:45:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Mok+lx5+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726613AbfKNInc (ORCPT + 99 others); Thu, 14 Nov 2019 03:43:32 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:41472 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726057AbfKNInc (ORCPT ); Thu, 14 Nov 2019 03:43:32 -0500 Received: by mail-pg1-f195.google.com with SMTP id h4so3286105pgv.8 for ; Thu, 14 Nov 2019 00:43:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=dtXf1cklkEILsdJe1BKmSn+H2sUj3L7wyP1UZ92tPKI=; b=Mok+lx5+2tneGl5Q8292wQfcG9ogwNvHx+Af4Ura3ONzfPqpaD6F17vKXMnxIc10pU RVKMLLwuCR/6CFa3UmeJrWMtPspfYbxvTQJz/hAFRtNQVh5dAMx8Ez4/HBuDFzENGkI1 H4j+J+m3Bm5r9flMQlValkUQyEgmoGc2HyHv3c+mrb/+wp5eAt/a4z3YjPhiq/KGeYsp dNTpZb3jeMYiSdlie+3XeGPS/WA/CpjgqZQG1p3FpOf5VT+Fdre2/1acs/fjrif2fPux 3hos112hB2n3qnkSKih/VkNHkhWtkC45liABkgQpZggOinzG18NdqlN7zH4JV0Nznrhh nVQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=dtXf1cklkEILsdJe1BKmSn+H2sUj3L7wyP1UZ92tPKI=; b=k7XMUvK+bdykzZyk3gpOb81f2oMWCExBdcOPUGgCfqLN+2OvWI2bSH4PKpAEkA7qlm 7P1tJykev6Q9lkjJP+zlB3LCS4pwGhuCQulE8t//Kf1AVE+R4+6Xc71ycfG+v5rDHkUT kAlQTvygCtdjv+UxpX0znEL7BWV0DP0zU+hCEiiGNUcdvesVg8dHYCO/DlFcMJXX8blD o9D0kEl8qrqazSVrTWV0xK2H463cU4ptG4qJ5M9RHSbrvSdhSo8f9ZZDV2+WceLtygwt qqVGNXgq0jVBvUNwGx2IyzyOc1aUCgc6eURkYKbHIAmhqrrHYxIwDCW0AZ9bhPmnEF58 64pg== X-Gm-Message-State: APjAAAU9B1TtnTI9Pw3p9VHWMPKVC5Xoy5wlVDse6V/7yAXkx4+f7qIN xxHDxtkAJVSo7CX5IXsHEdQFBA== X-Received: by 2002:a63:1402:: with SMTP id u2mr8732447pgl.391.1573721010376; Thu, 14 Nov 2019 00:43:30 -0800 (PST) Received: from localhost ([122.171.110.253]) by smtp.gmail.com with ESMTPSA id z7sm7012468pfr.165.2019.11.14.00.43.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Nov 2019 00:43:29 -0800 (PST) Date: Thu, 14 Nov 2019 14:13:27 +0530 From: Viresh Kumar To: "Rafael J. Wysocki" Cc: Rafael Wysocki , Linux PM , Vincent Guittot , Bjorn Andersson , Amit Kucheria , Linux Kernel Mailing List Subject: Re: [PATCH] cpufreq: Register cpufreq drivers only after CPU devices are registered Message-ID: <20191114084327.ra5hnpizeffxzis2@vireshk-i7> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716-391-311a52 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 14-11-19, 09:40, Rafael J. Wysocki wrote: > On Thu, Nov 14, 2019 at 4:36 AM Viresh Kumar wrote: > > > > The cpufreq core heavily depends on the availability of the struct > > device for CPUs and if they aren't available at the time cpufreq driver > > is registered, we will never succeed in making cpufreq work. > > > > This happens due to following sequence of events: > > > > - cpufreq_register_driver() > > - subsys_interface_register() > > - return 0; //successful registration of driver > > > > ... at a later point of time > > > > - register_cpu(); > > - device_register(); > > - bus_probe_device(); > > - sif->add_dev(); > > - cpufreq_add_dev(); > > - get_cpu_device(); //FAILS > > - per_cpu(cpu_sys_devices, num) = &cpu->dev; //used by get_cpu_device() > > - return 0; //CPU registered successfully > > > > Because the per-cpu variable cpu_sys_devices is set only after the CPU > > device is regsitered, cpufreq will never be able to get it when > > cpufreq_add_dev() is called. > > > > This patch avoids this failure by making sure device structure of at > > least CPU0 is available when the cpufreq driver is registered, else > > return -EPROBE_DEFER. > > > > Reported-by: Bjorn Andersson > > Signed-off-by: Amit Kucheria > > Signed-off-by: Viresh Kumar > > --- > > @Amit: I have added your sob without asking as you were involved in > > getting us to this patch, you did a lot of testing yesterday to find the > > root cause. > > Co-developed-by is for that, so I used it in the commit. > > > @Rafael: This fixes the issues reported by Bjorn on Amit's series and so > > should land before Amit's series, if at all this is acceptable to you. > > Well, yes it is. > > Applied for 5.5 with a reworded subject, thanks! Thanks. -- viresh