From patchwork Tue Jul 24 18:26:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Waiman Long X-Patchwork-Id: 10542915 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D3959112E for ; Tue, 24 Jul 2018 18:26:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BFE8029026 for ; Tue, 24 Jul 2018 18:26:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B337E29088; Tue, 24 Jul 2018 18:26:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6092E29026 for ; Tue, 24 Jul 2018 18:26:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388474AbeGXTd7 (ORCPT ); Tue, 24 Jul 2018 15:33:59 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:46850 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388427AbeGXTd6 (ORCPT ); Tue, 24 Jul 2018 15:33:58 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E5EAA81663C3; Tue, 24 Jul 2018 18:26:14 +0000 (UTC) Received: from llong.com (dhcp-17-175.bos.redhat.com [10.18.17.175]) by smtp.corp.redhat.com (Postfix) with ESMTP id B6191111AF17; Tue, 24 Jul 2018 18:26:12 +0000 (UTC) From: Waiman Long To: "Rafael J. Wysocki" , Viresh Kumar , Thomas Gleixner , Peter Zijlstra , Ingo Molnar Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, "Paul E. McKenney" , Greg Kroah-Hartman , Konrad Rzeszutek Wilk , Waiman Long Subject: [PATCH v2 0/2] cpufreq: Fix a circular lock dependency problem Date: Tue, 24 Jul 2018 14:26:03 -0400 Message-Id: <1532456765-17576-1-git-send-email-longman@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Tue, 24 Jul 2018 18:26:15 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Tue, 24 Jul 2018 18:26:15 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'longman@redhat.com' RCPT:'' Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP v2: - Remove the retry loop in the store method. This patchset works around a circular lock dependency issue in the cpufreq driver reported by lockdep. The two locks involved are the cpu_hotplup_lock and the reference count of a sysfs file. The cpufreq_register_driver() function uses the lock sequence: cpus_read_lock --> kn->count Whereas the cpufreq sysfs store method uses the sequence: kn->count --> cpus_read_lock This is not really an issue as a shared lock is used on the cpu_hotplup_lock. However, the lockdep code isn't able to handle shared locking. So one way to work around this is to define a cpus_read_trylock() function and uses it in the store method instead. Waiman Long (2): cpu/hotplug: Add a cpus_read_trylock() function cpufreq: Fix a circular lock dependency problem drivers/cpufreq/cpufreq.c | 7 ++++++- include/linux/cpu.h | 2 ++ kernel/cpu.c | 6 ++++++ 3 files changed, 14 insertions(+), 1 deletion(-)