From patchwork Tue Jun 17 23:39:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yinghai Lu X-Patchwork-Id: 361226 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 401CB140091 for ; Wed, 18 Jun 2014 09:39:15 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756275AbaFQXjO (ORCPT ); Tue, 17 Jun 2014 19:39:14 -0400 Received: from mail-ig0-f181.google.com ([209.85.213.181]:39971 "EHLO mail-ig0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756032AbaFQXjN (ORCPT ); Tue, 17 Jun 2014 19:39:13 -0400 Received: by mail-ig0-f181.google.com with SMTP id h15so183530igd.2 for ; Tue, 17 Jun 2014 16:39:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=vAGZ3W3uDaAVaLQoXT+fU3rUZONk/T8SUnOJPKc0ij0=; b=lFVsKDnjWnA8obsWTEbr3ti/zK7depFGbnoz4EwlaPIRcYLujY/I8qLD71I2evUyjb wzNWa/ZXbCLn4ZsH/y2DPUtPqAMuFT++HFN/Nl3WFEXU5P/LzZ4MvyTUKNU/c/6Aofpa fQ0wm6jZ6IlGSDRANbOzCrc7NS8XrP4bIyBiRphgpW7tf5KgG77IiE7M5k44nX0GXUaM mUwp/yCQjN2n6TB/M8HJ69nakic1ivjp6vb7TC/fq9g7ebz7pEn69Y2CMmJUVhkVcaRW OS/kyrvp6xye9hS25H6C/Qilkqz3+/DjQeo1H7mmJw/oGlgpy5RWCoWWlBTfS3VYFeFH i6UA== MIME-Version: 1.0 X-Received: by 10.50.97.104 with SMTP id dz8mr236334igb.3.1403048352701; Tue, 17 Jun 2014 16:39:12 -0700 (PDT) Received: by 10.64.55.228 with HTTP; Tue, 17 Jun 2014 16:39:12 -0700 (PDT) In-Reply-To: <20140617221620.GC30559@google.com> References: <1402346730-2508-1-git-send-email-andreas.noever@gmail.com> <20140617221620.GC30559@google.com> Date: Tue, 17 Jun 2014 16:39:12 -0700 X-Google-Sender-Auth: _63GxXCrAuBsl_naQtDI4boeQkU Message-ID: Subject: Re: [PATCH] PCI: Do not touch siblings in pci_assign_unassigned_bridge_resources From: Yinghai Lu To: Bjorn Helgaas Cc: Andreas Noever , Linux Kernel Mailing List , "linux-pci@vger.kernel.org" Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org On Tue, Jun 17, 2014 at 3:16 PM, Bjorn Helgaas wrote: > [+cc Yinghai] > > On Mon, Jun 09, 2014 at 10:45:30PM +0200, Andreas Noever wrote: >> The problem can be reproduced by having two sibling hotplug bridges A >> and B. The problem will occour if the parent of A and B does not have >> enough resources to satisfy window allocations for B during a hotplug >> event. > I don't understand how all this works either. Yinghai? > > We definitely don't want to release resources that are already in use. Can > you review and ack or nack this? Hi Andreas, Can you check if attached patch fix the problem on your test case? In some case, if we can not assign pref mmio properly for the bridge, we may need to even clear non-pref mmio for the bridge. Thanks Yinghai Subject: [PATCH] pci: Don't release sibiling bridge resources On hotplug case, we should not touch sibling bridges that is out side of the slots. Signed-off-by: Yinghai Lu --- drivers/pci/setup-bus.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) Index: linux-2.6/drivers/pci/setup-bus.c =================================================================== --- linux-2.6.orig/drivers/pci/setup-bus.c +++ linux-2.6/drivers/pci/setup-bus.c @@ -1676,10 +1676,16 @@ again: * Try to release leaf bridge's resources that doesn't fit resource of * child device under that bridge */ - list_for_each_entry(fail_res, &fail_head, list) - pci_bus_release_bridge_resources(fail_res->dev->bus, + list_for_each_entry(fail_res, &fail_head, list) { + struct pci_bus *bus = fail_res->dev->bus; + + if (fail_res->dev == bridge) + bus = bridge->subordinate; + + pci_bus_release_bridge_resources(bus, fail_res->flags & type_mask, whole_subtree); + } /* restore size and flags */ list_for_each_entry(fail_res, &fail_head, list) {