From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753469Ab3GAJ2V (ORCPT ); Mon, 1 Jul 2013 05:28:21 -0400 Received: from mga11.intel.com ([192.55.52.93]:25841 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753087Ab3GAJ2T (ORCPT ); Mon, 1 Jul 2013 05:28:19 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.87,973,1363158000"; d="scan'208";a="363194170" Date: Mon, 1 Jul 2013 12:32:17 +0300 From: Mika Westerberg To: "Rafael J. Wysocki" Cc: Bjorn Helgaas , "Kirill A. Shutemov" , Greg Kroah-Hartman , "Rafael J. Wysocki" , Jesse Barnes , Yinghai Lu , "Ronciak, John" , "Penner, Miles J" , Bruce Allan , Heikki Krogerus , "linux-kernel@vger.kernel.org" , "linux-pci@vger.kernel.org" , "x86@kernel.org" Subject: Re: [PATCH 1/6] PCI: acpiphp: do not check for SLOT_ENABLED in enable_device() Message-ID: <20130701093217.GG9294@intel.com> References: <1372177330-28013-1-git-send-email-mika.westerberg@linux.intel.com> <20130628095138.D5B7BE0090@blue.fi.intel.com> <4600759.u0rXpSLd62@vostro.rjw.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4600759.u0rXpSLd62@vostro.rjw.lan> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 28, 2013 at 08:54:45PM +0200, Rafael J. Wysocki wrote: > On Friday, June 28, 2013 11:00:31 AM Bjorn Helgaas wrote: > > On Fri, Jun 28, 2013 at 3:51 AM, Kirill A. Shutemov > > wrote: > > > Bjorn Helgaas wrote: > > >> On Tue, Jun 25, 2013 at 10:22 AM, Mika Westerberg > > >> wrote: > > >> > From: "Kirill A. Shutemov" > > >> > > > >> > With Thunderbolt you can chain devices: connect a new devices to plugged > > >> > one. In this case the slot is already enabled, but we still want to look > > >> > for new devices behind it. > > >> > > > >> > We're going to reuse enable_device() for rescan for new devices on the > > >> > enabled slot. Let's push the check up by stack. > > >> > > > >> > Signed-off-by: Kirill A. Shutemov > > >> > Signed-off-by: Mika Westerberg > > >> > --- > > >> > drivers/pci/hotplug/acpiphp_glue.c | 5 ++--- > > >> > 1 file changed, 2 insertions(+), 3 deletions(-) > > >> > > > >> > diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c > > >> > index 59df857..b983e29 100644 > > >> > --- a/drivers/pci/hotplug/acpiphp_glue.c > > >> > +++ b/drivers/pci/hotplug/acpiphp_glue.c > > >> > @@ -688,9 +688,6 @@ static int __ref enable_device(struct acpiphp_slot *slot) > > >> > int num, max, pass; > > >> > LIST_HEAD(add_list); > > >> > > > >> > - if (slot->flags & SLOT_ENABLED) > > >> > - goto err_exit; > > >> > - > > >> > list_for_each_entry(func, &slot->funcs, sibling) > > >> > acpiphp_bus_add(func); > > >> > > > >> > @@ -1242,6 +1239,8 @@ int acpiphp_enable_slot(struct acpiphp_slot *slot) > > >> > goto err_exit; > > >> > > > >> > if (get_slot_status(slot) == ACPI_STA_ALL) { > > >> > + if (slot->flags & SLOT_ENABLED) > > >> > + goto err_exit; > > >> > > >> Why do we check for SLOT_ENABLED at all? I think we're handling a Bus > > >> Check notification, which means "re-enumerate on the device tree > > >> starting from the notification point." It doesn't say anything about > > >> skipping the re-enumeration if we find a device that's already > > >> enabled. > > >> > > >> It seems like we ought to just re-enumerate all the way down in case a > > >> device was added farther down in the tree (which is what it sounds > > >> like Thunderbolt is doing). > > > > > > Currently (with patchset applied), we have two users of > > > acpiphp_enable_slot(): > > > > > > - /sys/bus/pci/slots/*/power > > > - ACPI_NOTIFY_BUS_CHECK in _handle_hotplug_event_func(). > > > > > > Both are not related to Thunderbolt. > > > > > > Although, I think remove the check is good idea, I prefer to keep it > > > separate from Thunderbolt enabling patchset, since it will change sysfs > > > ABI a bit and can potentially affect othe ACPI PCI hotplug > > > implementations. > > > > I'll think about this some more, but if we can make a change that > > simplifies things and makes them more spec-compliant, and also happens > > to make Thunderbolt work, that sounds better than fixing Thunderbolt > > while leaving the wart there. > > > > If we only fix Thunderbolt, it just feels like we're adding to an > > ever-growing "deferred maintenance" list. > > I agree. > > That change may be done in a separate patch, but it should be included in the > series. Given the fact that SLOT_ENABLED is only checked in acpiphp_enable_slot() (after this patch) and that /sys/bus/pci/slots/*/power uses SLOT_POWEREDON anyway, should we remove the whole flag?