From patchwork Thu Sep 5 06:17:06 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tianyu Lan X-Patchwork-Id: 2853933 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 797D99F3DC for ; Thu, 5 Sep 2013 06:17:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5F8C8202CF for ; Thu, 5 Sep 2013 06:17:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1EBBD20340 for ; Thu, 5 Sep 2013 06:17:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756295Ab3IEGRJ (ORCPT ); Thu, 5 Sep 2013 02:17:09 -0400 Received: from mail-qa0-f49.google.com ([209.85.216.49]:56649 "EHLO mail-qa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754979Ab3IEGRI (ORCPT ); Thu, 5 Sep 2013 02:17:08 -0400 Received: by mail-qa0-f49.google.com with SMTP id w8so716850qac.15 for ; Wed, 04 Sep 2013 23:17:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=YKqSQz5R8Xj77RNEI1AHaOktaDT8ng8ukG7Qm7H/qOQ=; b=CwAMpZOofPMKKXf8LK2aki7aOyguzOJSfo8SjooqWDQFnUNfvfpF5y2JOGI7vOW7fN /NdEDYsiQkR9QM549zi9l1wD+fdfHtGHXWErvyFKLIDKAXTSFk+acBzWQP8k64M0+Yun EVHOgGVW5ZyEmJWUm4e9j3D/C8ANiyWHbKRpw2MrCFvSx5QxHXev0XdIopB1VfySpJgq P5wZSHqQkpAJdZyVoHXCxaiObGymQMROJJkdy5CnJ5650+LfdtPumOU10jjfX5OhpxfN mLW4cSFgwuhAvYwf0FmLE/kOBEDff3czUQg2X9sW8UVXAuxkNuqiiC3dVrtW/DMQXtt0 FG3g== MIME-Version: 1.0 X-Received: by 10.49.134.102 with SMTP id pj6mr8007322qeb.49.1378361826483; Wed, 04 Sep 2013 23:17:06 -0700 (PDT) Received: by 10.229.151.8 with HTTP; Wed, 4 Sep 2013 23:17:06 -0700 (PDT) In-Reply-To: <1378352279.3246.183.camel@ul30vt.home> References: <26431283.HJCKsss0rt@vostro.rjw.lan> <2449715.ReJj2CQeDS@vostro.rjw.lan> <1378336334.3246.158.camel@ul30vt.home> <16239518.dJxs4RVK1M@vostro.rjw.lan> <1378352279.3246.183.camel@ul30vt.home> Date: Thu, 5 Sep 2013 14:17:06 +0800 Message-ID: Subject: Re: [PATCH 25/30] ACPI / hotplug / PCI: Check for new devices on enabled slots From: Lan Tianyu To: Alex Williamson Cc: "Rafael J. Wysocki" , ACPI Devel Maling List , Bjorn Helgaas , LKML , Linux PCI , Yinghai Lu , Jiang Liu , Mika Westerberg , "Kirill A. Shutemov" Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-9.2 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 2013/9/5 Alex Williamson : > On Thu, 2013-09-05 at 01:35 +0200, Rafael J. Wysocki wrote: >> On Wednesday, September 04, 2013 05:12:14 PM Alex Williamson wrote: >> > On Thu, 2013-09-05 at 00:54 +0200, Rafael J. Wysocki wrote: >> > > On Wednesday, September 04, 2013 02:36:34 PM Alex Williamson wrote: >> > > > On Thu, 2013-07-18 at 01:32 +0200, Rafael J. Wysocki wrote: >> > > > > From: Rafael J. Wysocki >> > > > > >> > > > > The current implementation of acpiphp_check_bridge() is pretty dumb: >> > > > > - It enables a slot if it's not enabled and the slot status is >> > > > > ACPI_STA_ALL. >> > > > > - It disables a slot if it's enabled and the slot status is not >> > > > > ACPI_STA_ALL. >> > > > > >> > > > > This behavior is not sufficient to handle the Thunderbolt daisy >> > > > > chaining case properly, however, because in that case the bus >> > > > > behind the already enabled slot needs to be rescanned for new >> > > > > devices. >> > > > > >> > > > > For this reason, modify acpiphp_check_bridge() so that slots are >> > > > > disabled and stopped if they are not in the ACPI_STA_ALL state. >> > > > > >> > > > > For slots in the ACPI_STA_ALL state, devices behind them that don't >> > > > > respond are trimmed using a new function, trim_stale_devices(), >> > > > > introduced specifically for this purpose. That function walks >> > > > > the given bus and checks each device on it. If the device doesn't >> > > > > respond, it is assumed to be gone and is removed. >> > > > > >> > > > > Once all of the stale devices directy behind the slot have been >> > > > > removed, acpiphp_check_bridge() will start looking for new devices >> > > > > that might have appeared on the given bus. It will do that even if >> > > > > the slot is already enabled (SLOT_ENABLED is set for it). >> > > > > >> > > > > In addition to that, make the bus check notification ignore >> > > > > SLOT_ENABLED and go for enable_device() directly if bridge is NULL, >> > > > > so that devices behind the slot are re-enumerated in that case too. >> > > > > >> > > > > This change is based on earlier patches from Kirill A Shutemov >> > > > > and Mika Westerberg. >> > > > > >> > > > > Signed-off-by: Rafael J. Wysocki >> > > > > Tested-by: Mika Westerberg >> > > > > --- >> > > > >> > > > FYI, git bisect landed on this patch as the cause of my serial console >> > > > dying on current upstream. Further debugging to come... Thanks, >> > > >> > > Well, sorry about that. >> > > >> > > What exactly do you mean by "dying"? >> > >> > Sorry, I was hoping to have more details quickly, but it's been a pain >> > to debug. By dying I mean serial console output suddenly stops during >> > kernel boot and nothing more comes out of it until after the system is >> > rebooted. The problem happens when acpiphp_check_bridge() calls >> > enable_slot(). The serial console dies somewhere down in >> > acpiphp_bus_trim(). I think this is happening on the 00:1f ISA bridge, >> > so there's a good chance the serial ports are described as somewhere >> > under there. >> >> Can you please check if that is the acpiphp_bus_trim() called by >> acpiphp_bus_add() or the other one called from trim_stale_devices()? >> >> Just add a dump_stack() or WARN_ON(1) to trim_stale_devices() next to >> the acpiphp_bus_trim() call and see if that triggers. I *think* it's the one >> in acpiphp_bus_add(), but it won't hurt to verify that. > > Here's the call path: > > [ 16.120824] [] dump_stack+0x55/0x76 > [ 16.125979] [] enable_slot+0x4ee/0x5e0 > [ 16.131396] [] ? trim_stale_devices+0x5b/0xf0 > [ 16.137420] [] acpiphp_check_bridge+0xd5/0x110 > [ 16.143531] [] hotplug_event+0x16b/0x260 > [ 16.149115] [] ? process_one_work+0x189/0x540 > [ 16.155136] [] hotplug_event_work+0x30/0x70 > [ 16.160978] [] process_one_work+0x1eb/0x540 > [ 16.166819] [] ? process_one_work+0x189/0x540 > [ 16.172836] [] worker_thread+0x11c/0x370 > [ 16.178426] [] ? rescuer_thread+0x350/0x350 > [ 16.184276] [] kthread+0xea/0xf0 > [ 16.189165] [] ? kthread_create_on_node+0x160/0x160 > [ 16.195700] [] ret_from_fork+0x7c/0xb0 > [ 16.201109] [] ? kthread_create_on_node+0x160/0x160 > > The actual death of the serial console occurs in acpi_device_set_power() > called from: > > enable_slot() > acpiphp_bus_add() > acpiphp_bus_trim() > acpi_bus_trim() > acpi_walk_namespace() > acpi_bus_remove() > acpi_device_unregister() > acpi_device_set_power() > > I can't seem to get a path from the acpi devices in question there, so I > have no idea what's getting trimmed here. It worries me quite a bit by > introducing this trimming that apparently wasn't happening before > though. Thanks, Hi Alex: Could you apply the following patch and bootup with kernel param "acpiphp.acpiphp_debug=1"? I guess the patch can make serial port alive. It will not be put into D3cold during trimming. But I don't know why it doesn't work after being put back to D0. So please attach output of acpidump and the dmesg if it can work. Thanks. } > > Alex > > -- > To unsubscribe from this list: send the line "unsubscribe linux-acpi" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index e763651..359b23d 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -1110,7 +1110,7 @@ static void acpi_device_unregister(struct acpi_device *device) * power resources the device depends on and turn off the ones that have * no more references. */ - acpi_device_set_power(device, ACPI_STATE_D3_COLD); + //acpi_device_set_power(device, ACPI_STATE_D3_COLD); device->handle = NULL; put_device(&device->dev);