From patchwork Tue Apr 8 04:21:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 27923 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f72.google.com (mail-pa0-f72.google.com [209.85.220.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A34D920553 for ; Tue, 8 Apr 2014 04:22:03 +0000 (UTC) Received: by mail-pa0-f72.google.com with SMTP id bj1sf1302014pad.11 for ; Mon, 07 Apr 2014 21:22:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=rCaEWhD923LnTmphbf6lcmNGIItJu6VJAAZgIM8xbxk=; b=YreMqdC77gL2ehOCWMvEYlgILtR+PSDr2rvTAw4dV2TrJ41br1gNO0PwbFPPHTAiix 0Dh6o7MvUGLPKh4fXcj3vuyUf59xfv2Bp32/Sp4F83f7ADCGPdBP9N5XFW0lxuahKofv z6A72X1SzbHwaQqZIxGI+lLwyTVvBeXzm99XYMePRNiAH/3+mhO0xZooinFvAQJGE9Px W179riST0Kao2aN8Sk3veKyVXJrQNuWjP+jDwLiJwwzJEI0/N6xHaeHafdIdjrV5L3ul wp02FYRrwGUYPjAP6JI7kjibn5KYhFTCojXZ1UCmDuhRD5vXzcdLnP0ncMSO5Ox+kujF 9D2w== X-Gm-Message-State: ALoCoQnCUz4Ut1E5qu4i0lUq5XBytQfNtfoVJgCb84C8bgyeyNki2vMMTG4Syp6lDKtJJDnV2rnW X-Received: by 10.66.122.69 with SMTP id lq5mr472046pab.17.1396930922910; Mon, 07 Apr 2014 21:22:02 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.90.11 with SMTP id w11ls72784qgd.43.gmail; Mon, 07 Apr 2014 21:22:02 -0700 (PDT) X-Received: by 10.221.26.10 with SMTP id rk10mr1151443vcb.0.1396930922745; Mon, 07 Apr 2014 21:22:02 -0700 (PDT) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id dh4si166655veb.211.2014.04.07.21.22.02 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 07 Apr 2014 21:22:02 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.180; Received: by mail-vc0-f180.google.com with SMTP id lf12so315944vcb.11 for ; Mon, 07 Apr 2014 21:22:02 -0700 (PDT) X-Received: by 10.52.119.197 with SMTP id kw5mr923783vdb.5.1396930922655; Mon, 07 Apr 2014 21:22:02 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.12.8 with SMTP id v8csp214136vcv; Mon, 7 Apr 2014 21:22:02 -0700 (PDT) X-Received: by 10.68.184.66 with SMTP id es2mr1679428pbc.19.1396930921789; Mon, 07 Apr 2014 21:22:01 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m9si409290pab.167.2014.04.07.21.22.01; Mon, 07 Apr 2014 21:22:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750708AbaDHEVm (ORCPT + 12 others); Tue, 8 Apr 2014 00:21:42 -0400 Received: from mail-wg0-f47.google.com ([74.125.82.47]:36500 "EHLO mail-wg0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750710AbaDHEVl (ORCPT ); Tue, 8 Apr 2014 00:21:41 -0400 Received: by mail-wg0-f47.google.com with SMTP id x12so353463wgg.18 for ; Mon, 07 Apr 2014 21:21:40 -0700 (PDT) X-Received: by 10.194.161.168 with SMTP id xt8mr1379862wjb.35.1396930900054; Mon, 07 Apr 2014 21:21:40 -0700 (PDT) Received: from localhost ([213.122.173.131]) by mx.google.com with ESMTPSA id fs8sm257408wib.8.2014.04.07.21.21.36 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 07 Apr 2014 21:21:39 -0700 (PDT) From: Viresh Kumar To: stable@vger.kernel.org Cc: soren.brinkmann@xilinx.com, linux-pm@vger.kernel.org, viresh kumar , "Rafael J. Wysocki" Subject: [PATCH] cpufreq: remove sysfs link when a cpu != policy->cpu, is removed Date: Tue, 8 Apr 2014 09:51:28 +0530 Message-Id: X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e Sender: linux-pm-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: viresh kumar Commit 42f921a (cpufreq: remove sysfs files for CPUs which failed to come back after resume) tried to do this but missed this piece of code to fix. Currently we are getting this on suspend/resume: ------------[ cut here ]------------ WARNING: CPU: 0 PID: 877 at fs/sysfs/dir.c:52 sysfs_warn_dup+0x68/0x84() sysfs: cannot create duplicate filename '/devices/system/cpu/cpu1/cpufreq' Modules linked in: brcmfmac brcmutil CPU: 0 PID: 877 Comm: test-rtc-resume Not tainted 3.14.0-rc2-00259-g9398a10cd964 #12 [] (unwind_backtrace) from [] (show_stack+0x10/0x14) [] (show_stack) from [] (dump_stack+0x80/0xcc) [] (dump_stack) from [] (warn_slowpath_common+0x64/0x88) [] (warn_slowpath_common) from [] (warn_slowpath_fmt+0x30/0x40) [] (warn_slowpath_fmt) from [] (sysfs_warn_dup+0x68/0x84) [] (sysfs_warn_dup) from [] (sysfs_do_create_link_sd+0xb0/0xb8) [] (sysfs_do_create_link_sd) from [] (__cpufreq_add_dev.isra.27+0x2a8/0x814) [] (__cpufreq_add_dev.isra.27) from [] (cpufreq_cpu_callback+0x70/0x8c) [] (cpufreq_cpu_callback) from [] (notifier_call_chain+0x44/0x84) [] (notifier_call_chain) from [] (__cpu_notify+0x28/0x44) [] (__cpu_notify) from [] (_cpu_up+0xf0/0x140) [] (_cpu_up) from [] (enable_nonboot_cpus+0x68/0xb0) [] (enable_nonboot_cpus) from [] (suspend_devices_and_enter+0x198/0x2dc) [] (suspend_devices_and_enter) from [] (pm_suspend+0x174/0x1e8) [] (pm_suspend) from [] (state_store+0x6c/0xbc) [] (state_store) from [] (kobj_attr_store+0x14/0x20) [] (kobj_attr_store) from [] (sysfs_kf_write+0x44/0x48) [] (sysfs_kf_write) from [] (kernfs_fop_write+0xb4/0x14c) [] (kernfs_fop_write) from [] (vfs_write+0xa8/0x180) [] (vfs_write) from [] (SyS_write+0x3c/0x70) [] (SyS_write) from [] (ret_fast_syscall+0x0/0x30) ---[ end trace 76969904b614c18f ]--- Fix this by removing sysfs link for cpufreq directory when cpu removed isn't policy->cpu. Cc: # 3.13.x Revamps: 42f921a (cpufreq: remove sysfs files for CPUs which failed to come back after resume) Reported-and-tested-by: Stephen Warren Signed-off-by: Viresh Kumar Signed-off-by: Rafael J. Wysocki --- drivers/cpufreq/cpufreq.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 99a443e..2aaa6cf 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1223,8 +1223,7 @@ static int __cpufreq_remove_dev_prepare(struct device *dev, up_read(&policy->rwsem); if (cpu != policy->cpu) { - if (!frozen) - sysfs_remove_link(&dev->kobj, "cpufreq"); + sysfs_remove_link(&dev->kobj, "cpufreq"); } else if (cpus > 1) { new_cpu = cpufreq_nominate_new_policy_cpu(policy, cpu); if (new_cpu >= 0) {