Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp988046imm; Wed, 8 Aug 2018 08:55:49 -0700 (PDT) X-Google-Smtp-Source: AA+uWPywfKyehXSsia3TGLgQqVAqrYY7K+jsjtEboVWR0y+46DxipKOqrkYVDj0G9+dcfmcktxUK X-Received: by 2002:a63:fa18:: with SMTP id y24-v6mr3164178pgh.362.1533743749649; Wed, 08 Aug 2018 08:55:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533743749; cv=none; d=google.com; s=arc-20160816; b=Wqx6MGBD7pXNx3UDgJ0HHhePLH7JaasimmR7Uaa9Q6r2PMcrD/GEKXKvGGW5zFJa7A axUdqNtJ9yxJSjWMH8tQL2odb6K2uBHBuZ/MrGylHQKQSTtvfFm3aL/akQOHaP4m+UD+ dhUNJroqH5ivpLP2Lvc6pwWm1c9A77/7EKAtpcfFlVHC89Lfjr8v3vspqOIh1idMIGw5 9OaWGwZcXsh0tHuDrSLfRmQW1XmPKyUWBw98ge+XzDq0nLx59RyRuy9mSnqYqcC5yBlA doLFCCWguc4RGdsLH8gcYftk6RaXGpaXCCB5vOIANs0EkZRjfn53bp/7CanNoAG0uO7P tiBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=s7MXV3aRGFATiYmSmPAnN4o6k4a786q2OJHYZrxea14=; b=U/iud24KhUB7mOzoQb0qUS9PQ/I25MfdoR0RFdr9jI8S7oumK9tedkllnhDND7mlpP 6+vDjj3Xf+8xKagxAVF1BOA06qJiUDpipkjZdsRWygYrB7qvYplQcxVu+jssjCDCr1d7 +f5U2+bLawhWQZxH9m9JtSml1cBZHLnugGNB/DHFhps0HIgOIJL47HuAhPjJ0c9Igh49 O+M7oqUpmY/DezP7gzOOYZ1Xi9lNsQQDW9u9faJcjJ0ptMlRkNQ246I/19p67KVTNhP3 7EPGlSLb8Rmvv/80dbxN/iWahy1IpmwKFKxw8KNBGyhaODhZXIvxoTygw3gZQyTAPJAl pgyw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y11-v6si3400193plk.6.2018.08.08.08.55.34; Wed, 08 Aug 2018 08:55:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728028AbeHHSNy (ORCPT + 99 others); Wed, 8 Aug 2018 14:13:54 -0400 Received: from smtp.nue.novell.com ([195.135.221.5]:58111 "EHLO smtp.nue.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727337AbeHHSNy (ORCPT ); Wed, 8 Aug 2018 14:13:54 -0400 Received: from linux-l9pv.suse (124-11-22-254.static.tfn.net.tw [124.11.22.254]) by smtp.nue.novell.com with ESMTP (TLS encrypted); Wed, 08 Aug 2018 17:53:33 +0200 Date: Wed, 8 Aug 2018 23:53:18 +0800 From: joeyli To: Bjorn Helgaas Cc: "Lee, Chun-Yi" , Bjorn Helgaas , Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , x86@kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] x86/PCI: Claim the resources of firmware enabled IOAPIC before children bus Message-ID: <20180808155318.GE13767@linux-l9pv.suse> References: <20180724110144.16442-1-jlee@suse.com> <20180806214807.GE30691@bhelgaas-glaptop.roam.corp.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180806214807.GE30691@bhelgaas-glaptop.roam.corp.google.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Bjorn, First, thanks for your review! On Mon, Aug 06, 2018 at 04:48:07PM -0500, Bjorn Helgaas wrote: > On Tue, Jul 24, 2018 at 07:01:44PM +0800, Lee, Chun-Yi wrote: > > I got a machine that the resource of firmware enabled IOAPIC conflicts > > with the resource of a children bus when the PCI host bus be hotplug. > > > > [ 3182.243325] PCI host bridge to bus 0001:40 > > [ 3182.243328] pci_bus 0001:40: root bus resource [io 0xc000-0xdfff window] > > [ 3182.243330] pci_bus 0001:40: root bus resource [mem 0xdc000000-0xebffffff window] > > [ 3182.243331] pci_bus 0001:40: root bus resource [mem 0x212400000000-0x2125ffffffff window] > > [ 3182.243334] pci_bus 0001:40: root bus resource [bus 40-7e] > > ... > > [ 3182.244737] pci 0001:40:05.4: [8086:6f2c] type 00 class 0x080020 > > [ 3182.244746] pci 0001:40:05.4: reg 0x10: [mem 0xdc000000-0xdc000fff] > > ... > > [ 3182.246697] pci 0001:40:02.0: PCI bridge to [bus 41] > > [ 3182.246702] pci 0001:40:02.0: bridge window [mem 0xdc000000-0xdc7fffff] > > ... > > pci 0001:40:05.4: can't claim BAR 0 [mem 0xdc000000-0xdc000fff]: address conflict with PCI Bus 0001:41 [mem 0xdc000000-0xdc7fffff] > > > > The bus topology: > > > > +-[0001:40]-+-02.0-[41]-- > > | +-03.0-[41]-- > > | +-03.2-[41]--+-00.0 Intel Corporation I350 Gigabit Network Connection > > | | +-00.1 Intel Corporation I350 Gigabit Network Connection > > | | +-00.2 Intel Corporation I350 Gigabit Network Connection > > | | \-00.3 Intel Corporation I350 Gigabit Network Connection > > | +-05.0 Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D Map/VTd_Misc/System Management > > | +-05.1 Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D IIO Hot Plug > > | +-05.2 Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D IIO RAS/Control Status/Global Errors > > | \-05.4 Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D I/O APIC > > > > This problem causes that the NIC behine the child bus was not available > > after PCI host bridge hotpluged. > > > > Kernel does not want to change resource of firmware enabled IOAPIC, but > > the priority of children bus's resources are higher than any other devices. > > So this conflict can not be handled by the reassigning logic of kernel. Sorry for my description is not clear. The "priority" is for resources clamining, not for the address decoding. > > I don't understand this paragraph. AFAIK, if two devices on a bus > both decode the same address, as the IOAPIC and the bridge do here, > the only real "priority" in PCI would be subtractive decode. But I > don't think that applies here since the bridge is using a positive > decode window. > Sorry for I didn't understand... How could you know the bridge doesn't apply subtractive decode? > I would expect that a read to the [mem 0xdc000000-0xdc000fff] range > would potentially receive two read completions, which would cause an > Unexpected Completion error. > Thanks for your information. The I350 NIC doesn't work after hotplug. So it may causes by Unexpected Completion error as you mentioned. > Maybe you mean that we don't want to change the IOAPIC resources, but > it's OK if we move the bridge window, so in that sense, the IOAPIC is > "higher priority" than the bridge window? This is the reverse of what > your paragraph seems to say. > Yes, this is what I mean. Sorry for my paragraph causes confusing. The memory decoder bit in the command register of 0001:40:05.4 IOAPIC is raised by firmware after hotplug. So kernel treats it as a _firmware enabled_ IOAPIC. Because kernel don't want to change the IOAPIC resources, so my patch try to claim the IOAPIC resources before all bridges. It can workaround the hotplug problem on issue machine. But, actually I am not sure that this hacking makes sense. And, I also don't know why the memory decoder bit is raised by firmware when hotplug. Maybe this is a firmware problem. > > This patch claims the resources of firmware enabled IOAPIC before > > children bus. Then kernel gets a chance to reassign the resources of > > children bus to avoid the conflict. > > Can you open a report at https://bugzilla.kernel.org, attach the > before and after dmesg logs, and include the URL in the commit log? > OK, I have filed a bug on kernel bugzilla and also attached dmesg log: https://bugzilla.kernel.org/show_bug.cgi?id=200765 Thanks a lot! Joey Lee