Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932424AbdLGNOH (ORCPT ); Thu, 7 Dec 2017 08:14:07 -0500 Received: from mail-cys01nam02on0062.outbound.protection.outlook.com ([104.47.37.62]:6064 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755700AbdLGNOC (ORCPT ); Thu, 7 Dec 2017 08:14:02 -0500 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Christian.Koenig@amd.com; Subject: Re: [PATCH] x86/pci: Add a break condition when enabling BAR To: Bandan Das , Bjorn Helgaas Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org References: From: =?UTF-8?Q?Christian_K=c3=b6nig?= Message-ID: <8ce90b86-a2ec-c158-8f6d-e939c97aa065@amd.com> Date: Thu, 7 Dec 2017 14:13:44 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Originating-IP: [2a02:908:1251:7981:f0a0:248d:ec65:7ba] X-ClientProxiedBy: VI1P189CA0012.EURP189.PROD.OUTLOOK.COM (10.165.188.25) To DM5PR12MB1306.namprd12.prod.outlook.com (10.168.237.149) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 5802911f-5d56-4897-b7d5-08d53d746179 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(2017052603286);SRVR:DM5PR12MB1306; X-Microsoft-Exchange-Diagnostics: 1;DM5PR12MB1306;3:fgoPT9GHACAS6oMgd9ksDNa5iExGfdbkxpFyTJtC8W5/AE9hbFeywJknxsD6qjRvVx0nZjGTtnS7wlry9+Cnhse+j0j/qBy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ly04jxhTPLBRt3idvwI2xlGCWgG62wq7bXDxnJeYtbztYvIUToEuLqc3XofABjXRXpk49mK0pHeieun6az5zwPzjLHEH9wYFVsXOmyiyIwgbi4Z0ctrneWayeWX3ARPc1lbf86k97yuQYADeBc7/x/7dWISBmoi3i1kRwnGYbxdrGG82tdjQnvRIcgX5ssUnrgB7dKRVf2Uo4ioz0oO1LJ8XpzaFwjKRUBEkSkvfrW4TUk94aOhtknwwEN8;4:4Iu2Juq2NlGUZQbCDUMoc8umla9QDw762qbinwRej+bpbs5tZBXdPr8JP15H/P8/IOoyOTbCIqQXprIoT55kgrbhKOebTkzg8bzs54wy2eGzbLDbo4DHkZ7f/gwgSL6Bb0iiAdf2mLAgjk9WWrvu5/vxAbncHglIxLlnir/m5zPwZEuPK1ts2KqKfX3uKyqTVeF9La9QHjHl5j4Ui+V8LCGsLIZkvcccJg/sAUFiYXBFXbHji07H92P+dRK7R7pIdH+gxrxKxZ1/JrITptN4og== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040450)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231022)(6055026)(6041248)(20161123558100)(20161123555025)(20161123560025)(20161123564025)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:DM5PR12MB1306;BCL:0;PCL:0;RULEID:(100000803101)(100110400095);SRVR:DM5PR12MB1306; X-Forefront-PRVS: 05143A8241 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(376002)(39860400002)(346002)(366004)(189003)(51914003)(199004)(5890100001)(2906002)(6246003)(76176011)(31696002)(97736004)(65826007)(33646002)(65956001)(65806001)(2950100002)(52396003)(8676002)(72206003)(81166006)(5660300001)(47776003)(4326008)(2486003)(6666003)(23676004)(8936002)(81156014)(52116002)(25786009)(478600001)(52146003)(31686004)(105586002)(229853002)(7736002)(67846002)(6486002)(6116002)(101416001)(58126008)(50466002)(1706002)(36756003)(106356001)(68736007)(53936002)(230700001)(83506002)(64126003)(305945005)(110136005)(316002)(86362001);DIR:OUT;SFP:1101;SCL:1;SRVR:DM5PR12MB1306;H:[IPv6:2a02:908:1251:7981:f0a0:248d:ec65:7ba];FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtETTVQUjEyTUIxMzA2OzIzOmtzYjB2Rnd3VlRJMkIvdDFwRTA3dERyZlFH?= =?utf-8?B?bHd1aTBpWjRQNWhSSmdWTVBvUFBjZFQ2Sk5VQkVrb1RVQVo1eVdVcFNWYmZu?= =?utf-8?B?anpSY0prV2FRVGJYc0h4SGY4Y0tiZllGMlJ1OEkrdjVySkhmWDY1UTMwTm1h?= =?utf-8?B?aVFTdWdVa1lYWXk0VXVpdUdabXhadkxVUkpzaW83cHp5ZnFBRFREbXdRNHgy?= =?utf-8?B?UmhWbDFJRitwRDRxcW9mdk1TQWRFNXpRR21aVkxrMjN0YXhsRTltNll0MkFn?= =?utf-8?B?d3A5ZE9XNXliRlZZV2Nyb3dVS003YnVoa2piNHJxZWt0QU94bEpNT2Nuc0Ez?= =?utf-8?B?Q3VNTmtaa2M1MkxVbUViZERHY2RobVZ2ZjAvSW4zUldHMVdZdytJRHhnaGpM?= =?utf-8?B?S0VJZUFnMEJRdVI0d2cybFlUdk1VYjNEc2JQUytqNXVGWWU0ZUFjL3lKZ2FT?= =?utf-8?B?TlFlTFlPMzkwVHpPMGkzVy9zdkhYU2l2Y1FsY1piQW9qUWRaSVpOK05GTlg5?= =?utf-8?B?QWNlUkp2WDU5NllML00zWkp3b1BxYTRhUEtLbldTWTV4ZTRpSWpNQ2NjVDY5?= =?utf-8?B?QVFxNkFyRDEyd09EV1AzS2VlVFNkYmZQU1Q2N1V0RGlxVmVpamlBcjlMRUo5?= =?utf-8?B?UUgzM2RVL29XVFc1TmpCQlkrK2o1OGt3djB1RXk1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E0GIeXXzBc7a5DofO5V2XhftSWns6iR1eLnOdPKObIVmRkzMGQgHmqhq6Y/XlrfQHqny4Pj3L8wCeaqO/xg03RxkLZH20exLwhYLxWkQCHl3vIIpda9AUHf5i0Ju SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;DM5PR12MB1306;20:EADD7Ta0QJSvAyBxzh03FkSghHKirZfMfws5NQb8DeJm+dCKZe2Z5FZ5Qjf7/pZWvvaelKkRZQm2iV1E5ZEoktwn0bbfn/4c7MRiptOvyAj4szPb3+9771ng0Fg7Hjbd8ximk2/Wv9ckML1PX4ldlHMqS7hPgQwwYnneO3djctAZSqZ7+K2UbiwZ977BY26RGubd3uodAg3QYkXvgnCMY1mLe+HWDZSm+Ir0L5w6UaIUC81vMIZWySDVeRTWcW0n X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Dec 2017 13:13:58.2273 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5802911f-5d56-4897-b7d5-08d53d746179 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1306 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4006 Lines: 89 Hi Bandas, thanks for the patch, but this is a known issue with a fix already on the way into the next -rc. Regards, Christian. Am 07.12.2017 um 09:00 schrieb Bandan Das: > On an old flaky system with AMD Opteron 6320, boot hangs > with the following trace since commit fa564ad9: > > [ 28.181012] Hardware name: HP ProLiant DL385p Gen8, BIOS A28 09/03/2014 > [ 28.184022] RIP: 0010:lock_acquire+0xd5/0x1e0 > [ 28.185010] RSP: 0018:ffffb7ad818c39a8 EFLAGS: 00000246 ORIG_RAX: ffffffffffffff11 > [ 28.187010] RAX: ffffa074fb39b140 RBX: 0000000000000246 RCX: 0000000000000000 > [ 28.189014] RDX: ffffffffb20a55a9 RSI: 0000000000040009 RDI: 0000000000000246 > [ 28.191012] RBP: 0000000000000000 R08: 0000000000000006 R09: 0000000000000000 > [ 28.193020] R10: 0000000000000001 R11: 00000000dac664b5 R12: 0000000000000000 > [ 28.196013] R13: 0000000000000000 R14: 0000000000000001 R15: 0000000000000000 > [ 28.197011] FS: 0000000000000000(0000) GS:ffffa074fbd00000(0000) knlGS:0000000000000000 > [ 28.201014] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 > [ 28.201014] CR2: 0000000000000000 CR3: 00000003b6e10000 CR4: 00000000000406e0 > [ 28.205008] Call Trace: > [ 28.205013] ? request_resource_conflict+0x19/0x40 > [ 28.207013] _raw_write_lock+0x2e/0x40 > [ 28.209008] ? request_resource_conflict+0x19/0x40 > [ 28.209010] request_resource_conflict+0x19/0x40 > [ 28.212013] pci_amd_enable_64bit_bar+0x103/0x1a0 > [ 28.213025] pci_fixup_device+0xd4/0x210 > [ 28.213025] pci_setup_device+0x193/0x570 > [ 28.215010] ? get_device+0x13/0x20 > [ 28.217008] pci_scan_single_device+0x98/0xd0 > [ 28.217011] pci_scan_slot+0x90/0x130 > [ 28.219010] pci_scanild_bus_extend+0x3a/0x270 > [ 28.321008] acpi_pci_root_create+0x1a9/0x210 > [ 28.321014] ? pci_acpi_scan_root+0x135/0x1b0 > [ 28.324013] pci_acpi_scan_root+0x15f/0x1b0 > [ 28.325008] acpi_pci_root_add+0x283/0x560 > [ 28.325014] ? acpi_match_device_ids+0xc/0x20 > [ 28.327013] acpi_bus_attach+0xf9/0x1c0 > [ 28.329008] acpi_bus_attach+0x82/0x1c0 > [ 28.329044] acpi_bus_attach+0x82/0x1c0 > [ 28.331010] acpi_bus_scan+0x47/0xa0 > [ 28.333008] acpi_scan_init+0x12d/0x28d > [ 28.333013] ? bus_register+0x208/0x280 > [ 28.333013] acpi_init+0x30f/0x36f > [ 28.335010] ? acpi_sleep_proc_init+0x24/0x24 > [ 28.337013] do_one_initcall+0x4d/0x19c > [ 28.337013] ? do_early_param+0x29/0x86 > [ 28.340013] kernel_init_freeable+0x209/0x2a4 > [ 28.341008] ? set_debug_rodata+0x11/0x11 > [ 28.341011] ? rest_init+0xc0/0xc0 > [ 28.343013] kernel_init+0xa/0x104 > [ 28.345008] ret_from_fork+0x24/0x30 > [ 28.345010] Code: 24 08 49 c1 e9 09 49 83 f1 01 41 83 e1 01 e8 73 > e4 ff ff 65 48 8b 04 25 c0 d4 00 00 48 89 df c7 80 fc 0c 00 00 00 00 > 00 00 57 9d <0f> 1f 44 00 00 48 83 c4 30 5b 5d 41 5c 41 5d 41 5e 41 5f > c3 65 > > Since request_resource() will unconditionally return a conflict for invalid > regions, there will be no way to break out of the loop when enabling 64bit BAR. > Add checks and exit the loop in these cases without attempting to enable > BAR. > > Signed-off-by: Bandan Das > --- > arch/x86/pci/fixup.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c > index 1e996df..8933a1b 100644 > --- a/arch/x86/pci/fixup.c > +++ b/arch/x86/pci/fixup.c > @@ -696,8 +696,13 @@ static void pci_amd_enable_64bit_bar(struct pci_dev *dev) > res->end = 0xfd00000000ull - 1; > > /* Just grab the free area behind system memory for this */ > - while ((conflict = request_resource_conflict(&iomem_resource, res))) > + while ((conflict = request_resource_conflict(&iomem_resource, res))) { > + if ((res->start > res->end) || > + (res->start < iomem_resource.start) || > + (res->end > iomem_resource.end)) > + break; > res->start = conflict->end + 1; > + } > > dev_info(&dev->dev, "adding root bus resource %pR\n", res); >