From patchwork Wed Apr 27 12:26:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prarit Bhargava X-Patchwork-Id: 8956611 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id AD0D6BF29F for ; Wed, 27 Apr 2016 12:27:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B4B8B2025B for ; Wed, 27 Apr 2016 12:27:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0DC2B2022D for ; Wed, 27 Apr 2016 12:27:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752582AbcD0M1H (ORCPT ); Wed, 27 Apr 2016 08:27:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44256 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752456AbcD0M1F (ORCPT ); Wed, 27 Apr 2016 08:27:05 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 722093B754; Wed, 27 Apr 2016 12:27:04 +0000 (UTC) Received: from prarit.bos.redhat.com (prarit-guest.khw.lab.eng.bos.redhat.com [10.16.186.145]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u3RCR3K3030915; Wed, 27 Apr 2016 08:27:03 -0400 From: Prarit Bhargava To: linux-kernel@vger.kernel.org Cc: Prarit Bhargava , Robert Moore , Lv Zheng , "Rafael J. Wysocki" , Len Brown , linux-acpi@vger.kernel.org, Mario_Limonciello@dell.com, stable@vger.kernel.org, devel@acpica.org Subject: [PATCH] ACPI: fix Thunderbolt hotplug Date: Wed, 27 Apr 2016 08:26:59 -0400 Message-Id: <1461760019-12930-1-git-send-email-prarit@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Rafael, this patch is in the acpica.git tree as 7a3bd2d ("Dispatcher: Update thread ID for recursive method calls"). I've had many positive testing results from hardware vendors and users with this patch and this resolves many of the problems seen here: https://bugzilla.kernel.org/show_bug.cgi?id=115121 This does not fix the problems with the TB docking station. Although this patch will also be required, the docking station issues require a FW update. Updated FW should be coming soon to resolve those problems. P. ----8<---- The following hung task trace is seen when hotplugging an ethernet dongle in a Thunderbolt port on Linux. INFO: task kworker/0:4:1468 blocked for more than 120 seconds. Tainted: G W 4.6.0-rc1+ #1 "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. kworker/0:4 D ffff8802a265ba38 13344 1468 2 0x00000000 Workqueue: kacpid acpi_os_execute_deferred ffff8802a265ba38 ffff8802a265ba00 ffffffff81130200 ffffffff81e0d580 ffff88029e5eb340 ffff8802a265c000 ffff88029d69d000 ffff88029e5eb340 ffffffff818c1b8d ffff8802b64e8758 ffff8802a265ba50 ffffffff818bdfcc Call Trace: [] ? test_callback+0x10/0x30 [] ? __down_timeout+0x5d/0xd0 [] schedule+0x3c/0x90 [] schedule_timeout+0x210/0x360 [] ? sched_clock+0x9/0x10 [] ? local_clock+0x1c/0x20 [] ? mark_held_locks+0x76/0xa0 [] ? _raw_spin_unlock_irq+0x2c/0x40 [] ? __down_timeout+0x5d/0xd0 [] ? trace_hardirqs_on_caller+0xf5/0x1b0 [] ? __down_timeout+0x5d/0xd0 [] __down_timeout+0x7c/0xd0 [] ? _raw_spin_lock_irqsave+0x82/0x90 [] down_timeout+0x4c/0x60 [] acpi_os_wait_semaphore+0xaa/0x16a [] acpi_ex_system_wait_mutex+0x81/0xfa [] acpi_ds_begin_method_execution+0x25a/0x373 [] acpi_ds_call_control_method+0x107/0x2e0 [] acpi_ps_parse_aml+0x177/0x495 [] acpi_ps_execute_method+0x1f7/0x2b9 [] acpi_ns_evaluate+0x2ee/0x435 [] acpi_ev_asynch_execute_gpe_method+0xbd/0x159 [] acpi_os_execute_deferred+0x17/0x23 [] process_one_work+0x242/0x700 [] ? process_one_work+0x1ba/0x700 [] worker_thread+0x4e/0x490 [] ? process_one_work+0x700/0x700 [] ? process_one_work+0x700/0x700 [] kthread+0x101/0x120 [] ? trace_hardirqs_on_caller+0xf5/0x1b0 [] ret_from_fork+0x22/0x50 [] ? kthread_create_on_node+0x250/0x250 2 locks held by kworker/0:4/1468: #0: ("kacpid"){.+.+.+}, at: [] process_one_work+0x1ba/0x700 #1: ((&dpc->work)){+.+.+.}, at: [] process_one_work+0x1ba/0x700 The issue appears to be that the kworker thread attempts to acquire the _E42 method's mutex twice when executing acpi_ps_execute_method() and recursing through the entry method. The current code does take the possiblity of this recursion into account, however, it is only for the case where the walk_state has been populated. This can be fixed by setting the thread id in the !walk_state case to allow for recursion. Cc: Robert Moore Cc: Lv Zheng Cc: "Rafael J. Wysocki" Cc: Len Brown Cc: linux-acpi@vger.kernel.org Cc: Mario_Limonciello@dell.com Cc: stable@vger.kernel.org Cc: devel@acpica.org Signed-off-by: Prarit Bhargava Tested-by: Andy Lutomirski # On a Dell XPS 13 9350 --- drivers/acpi/acpica/dsmethod.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/acpi/acpica/dsmethod.c b/drivers/acpi/acpica/dsmethod.c index 1982310..93799db 100644 --- a/drivers/acpi/acpica/dsmethod.c +++ b/drivers/acpi/acpica/dsmethod.c @@ -428,6 +428,9 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, obj_desc->method.mutex->mutex. original_sync_level = obj_desc->method.mutex->mutex.sync_level; + + obj_desc->method.mutex->mutex.thread_id = + acpi_os_get_thread_id(); } }