Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp6215244rwl; Mon, 9 Jan 2023 05:47:58 -0800 (PST) X-Google-Smtp-Source: AMrXdXtvzZQnZa4WeRqjU+5SE7zBNq8X2xE3DDnESbMY8FNBwWkbUFBOO+3zPh/hbPX6p1fjKN5j X-Received: by 2002:aa7:850e:0:b0:583:39ca:82f3 with SMTP id v14-20020aa7850e000000b0058339ca82f3mr13747691pfn.18.1673272078218; Mon, 09 Jan 2023 05:47:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673272078; cv=pass; d=google.com; s=arc-20160816; b=DMZmNISAM4ZsAuMTVU21+g3sM9BDdnGACsLFUrmMgII4S43Q95SEFyvaXKaITyNc4L T9JZaDZ9BnCvqt6EB8R2dAa0S91j20IxJbvJbWWvAY4YS4XuQc8y9+ON9gN2F6+GW/T8 Oha8HRjmiZhzMqo+b54Ibfff4qg5pn1ZQeOXU/QIDsl3xUfOwsD4+ZHvSe6SKkQ0JG8d Xwapel1x0sv2FGlWkr59GIPXlsbD4gx70EfLwOU93dTe0hrMLAP/bMOaVKtz3+XtdQvh mVe1Y6de/lshtM81G+NpjaKbMUsgPvgt1s75osnyJ/zA9MJqTrewQ+XTQqZW61udqaAI MiOw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:in-reply-to:content-disposition :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Qj8BP9xPNjJMBJQXV8+VkFvkrFH/AM/nKiXxfDPLAw4=; b=TZoboSZR2Jx9/TrkoiKYxg+GIKDQs5jqY7tDnHjoygNxtOOoT5Hiim1aS0Z/ov29q+ uzGYetwRiKIPBej+KDI4cHosMKxtx/N6DshN2z3k4aDU7mBho1muLGlKOP1mPfB+dw9v ViUgkdOrL8IfYR0CAsBVvV62bxM2CTaiYpPR3FTtcQ9k3xKw7aRvF1S1CtdZIi4KIBku 3aFXsm2zfjJmNTM07jOIRgpjgnbar73TPucJQxKCW2Nt9YXjyx2vusUQf9SdX+5cy59C 7q2+lXe6ac0/xj0bG+//gqjs9sSHVqt7LcZMSi1QBzxsr+JmOuArb9XPdwfEVgxTkVsL D7gA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=tVurA441; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bd32-20020a056a0027a000b00586546418e2si7618275pfb.139.2023.01.09.05.47.51; Mon, 09 Jan 2023 05:47:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=tVurA441; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237212AbjAINor (ORCPT + 55 others); Mon, 9 Jan 2023 08:44:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237336AbjAINnr (ORCPT ); Mon, 9 Jan 2023 08:43:47 -0500 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2070.outbound.protection.outlook.com [40.107.237.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA2DB3474E; Mon, 9 Jan 2023 05:43:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZEo0mgI1MqEoc6k+ZOzSybeWxYIimLugpJVQcaku/q0xilmtNwwmmQnJOHFHVE6eN2R2lBM6f2XvmXs/SfUK9jLAa3xhLp6qY5+Oy6+wxq6QK2o9y5b+/gbCpqkJPUft5PF6Rr0TgrEojfRANExzki4x7uMsqvM8uk4PgUOloBYNyHlPqbOJkmDXwF5qeF9HT7l+jKrzTdqA4+bjCDKTmv3HiFT7PdELzp9jsQ8efD4Xcw6DQTMuhr4K11SLdFl4PF27CtbTX2Y0dNkMA05fDQ0UhIFx9p/Jm2HV3Ca8EPfQfs81Y/F5d2ETMDkrqCvNVmezeDFXS1Ip7HjdoQ/NJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Qj8BP9xPNjJMBJQXV8+VkFvkrFH/AM/nKiXxfDPLAw4=; b=Jahi4OD/wgFWzKwHifu9+5pINscIufyvpyKMndux9PJl3SURyvztkPuXVk0wyShtf98rmgV1r1Z0pBZwQNxrIPGhjcrBqdAdjm8IemLDOryWbgobJtJLFtVA5qFkalwy3+uq0EeqZZ0VKieMbDKJLqa4GXkDlBUv89JPfVRbsVcWdJNEaWjN+gEsRbM5J8WHlgtQaRZOiZDfFnmPqUvRt+fubk//WJ5YlMPbgL4HCicAiiBalzrXOsA6kGqVSst8Fds/piVflptjeCKFqNvKRD00va13j+i7uH2SRu9XylLSPd3AH/bl1Xy/SkUa7iinfo4+LETYCci8ubG+zSOX1g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Qj8BP9xPNjJMBJQXV8+VkFvkrFH/AM/nKiXxfDPLAw4=; b=tVurA441jMC4alDvvkqHOnFdIA/T/tbpyvNG8Bvi0hYfbhcPoeloHMt10UpmpC6kbD0t1sxESQImD+AAYhWmTrTEY0xN5eDZBXBsz05io9yt/PGA85oo9hfC+4Cx0IbyzMKTFhjp76icESH9SRzcNLFHLn+3HFqn/IIsS7rBTUPdY9u4ZW+2spwdj2cNMBaShJ4L1bDPrXXBpDqwKfms3LKvQAYVC//mWAwV3arRgHNslEAVJV4+OUloCGp7w8Mselvxn0eQNjpDOUdVfU1N4oQ+olzX5HIohjwe3N7ufYsrFA1G4TlKwArKTUCWK8J6Ue9XR5grL0i/NDkQ20qVmg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) by CY5PR12MB6432.namprd12.prod.outlook.com (2603:10b6:930:38::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18; Mon, 9 Jan 2023 13:43:22 +0000 Received: from LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::f8b0:df13:5f8d:12a]) by LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::f8b0:df13:5f8d:12a%8]) with mapi id 15.20.5986.018; Mon, 9 Jan 2023 13:43:22 +0000 Date: Mon, 9 Jan 2023 09:43:21 -0400 From: Jason Gunthorpe To: Baolu Lu Cc: Vasant Hegde , Matt Fagnani , Thorsten Leemhuis , Joerg Roedel , "iommu@lists.linux.dev" , LKML , "regressions@lists.linux.dev" , Linux PCI , Bjorn Helgaas Subject: Re: [regression, bisected, =?utf-8?Q?pci?= =?utf-8?Q?=2Fiommu=5D_Bug=C2=A0216865_-_Black_screen_whe?= =?utf-8?Q?n?= amdgpu started during 6.2-rc1 boot with AMD IOMMU enabled Message-ID: References: <15d0f9ff-2a56-b3e9-5b45-e6b23300ae3b@leemhuis.info> <5aa0e698-f715-0481-36e5-46505024ebc1@bell.net> <157c4ca4-370a-5d7e-fe32-c64d934f6979@amd.com> <223ee6d6-70ea-1d53-8bc2-2d22201d8dde@bell.net> <6fff9d10-f77f-e55a-9020-8a1bd34cf508@amd.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: MN2PR20CA0063.namprd20.prod.outlook.com (2603:10b6:208:235::32) To LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV2PR12MB5869:EE_|CY5PR12MB6432:EE_ X-MS-Office365-Filtering-Correlation-Id: 5c176ff9-6ba8-46b4-f1a4-08daf2477964 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8Q4BEuUpjkvLUEjFHz7v4P+3a11BN2ZtalnylJ06OXgH+FslOpwkfUdIDS101C0uvRv6WbeZGHLyzio1iG9iD3r29/KQjw58AyDbwovu13XBNxKslDNVxSJMbjkGMC/VkRbLu/mCNnKKm0tOQlVYdN5lZNU7nXrRrKXzcdUED5Ii+Ar4rNFVuvGbmtCCbWyPbOTlkeGfHsgpPaChG0jreTn6NbEAMUE3qsDLhudQVGdrMazaWw7ch9zEI57GFC2qso4q4T+OPMQ2j0rdfrJwaZ14lVDrbjtQGKnTtlB9VxhAO2R+xRsTLHgFZjpNjMvR4t7BTMrqI3e6rSjxpTy8zNwDCTHF96dZ6r+5MhyliVXbvkZFbz6CRRo6QY49uLA5GJqUTWObGR92rZHuVDo0kIqz8nRURa4QV3Qoc0TEQEqs+2DW1m9jYwt6untHokyUlLekNdSUQlb1gSG0nhVreCuTPZw3h2HNFjY2clvtM6f56w3FdH4bgxf7D3VfGhSsxhZ9wS/xwZZR7Ous3knR2Te45ATHvEQDdqo38Ts26HODERf7ggOknei+tIbRfIqVQmO7Fm7k3WLAZFVoNT7M31nmCFBCWFp2vxwgMat2rizFA+OzlSqsuDej2C3MJM0RZtjYs0tweVmfLlGu0eEmhSNMLKGBwJNn+unKUIeRl0CNzUZiyLOTCRd7lC+MdEiQ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:LV2PR12MB5869.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(346002)(376002)(39860400002)(366004)(396003)(136003)(451199015)(41300700001)(54906003)(2616005)(316002)(66476007)(36756003)(6916009)(4326008)(66556008)(66946007)(86362001)(38100700002)(5660300002)(83380400001)(7416002)(8936002)(2906002)(6506007)(53546011)(6486002)(6512007)(186003)(26005)(478600001)(67856001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?EdfabGIqSPqtPc9/Q2TsthzklkE8SNjC6NreYiKjtOa7LdrQt9gL9i36QdBk?= =?us-ascii?Q?uK1yPc7k92vfhj8eMmOY12hrjO5MjUdRMiLwtDoGVJSePsvO6UQQmoOrqfPB?= =?us-ascii?Q?yc3wf3hDA1LOfr40nDzgM2MpSN8ccai7UTBaqECGBpFIMxSb4sQCx+uVPk2q?= =?us-ascii?Q?I5iSEEmL49b4Af+14TCLJ9H6swfWBb6jM/P193ncQ6dumjGBkj6g8D8ka3tV?= =?us-ascii?Q?hK5vBQBmo2OGD5ILn1zSYVJdA/6PicGo1PJov8/uJA8GpaWHKR8Gxl+GNdcO?= =?us-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vQqnuBtBbDT7T4TtjYwlWj8Ao?= =?us-ascii?Q?OO4AwtjyxNTw7ZhQ8Ze+CO1JjFJntuPPZmex0x70Gc3oedrvi+/NuxJWYSne?= =?us-ascii?Q?Y8GleTQh6FnoOKO6+i6NKlMbwpcBOQaklOVy8BC5KQs9ADWbexHtftUHH8Tf?= =?us-ascii?Q?guOhilY/sfa7zRCN6DWA/LZbDTFTLys6DPAVg2KaPmyIP0wjdOc0Vuq0bNxb?= =?us-ascii?Q?RT7FBT7zjcajACLW/8U2mGl6JkGTZ1CAiqwKDQVw1yes4PhSaY3LjyDj4Gxj?= =?us-ascii?Q?4/d8gCnwaTXylgvgYZcYZOmvxcUs/kvy75mqP5hmXJvTvdab3yp+6SZiL7/5?= =?us-ascii?Q?9V+TiWF2UillF8wnnmYr0L0EdLOlY3EOINubHseDTfCS4YhMecnZgHwuXwZm?= =?us-ascii?Q?wqQn41EuXE1bjBZZOhWMNrx0kYeRI7eJFygCyiw4?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5c176ff9-6ba8-46b4-f1a4-08daf2477964 X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5869.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2023 13:43:22.0386 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: nxlCN//FQaCmKVrIP18tIrLay1sIXBUzF7wpoBaucjlswqaGeXRMaGEGVo0grfDZ X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6432 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jan 07, 2023 at 10:44:46AM +0800, Baolu Lu wrote: > On 1/6/2023 10:14 PM, Jason Gunthorpe wrote: > > On Thu, Jan 05, 2023 at 03:57:28PM +0530, Vasant Hegde wrote: > > > Matt, > > > > > > On 1/5/2023 6:39 AM, Matt Fagnani wrote: > > > > I built 6.2-rc2 with the patch applied. The same black screen problem happened > > > > with 6.2-rc2 with the patch. I tried to use early kdump with 6.2-rc2 with the > > > > patch twice by panicking the kernel with sysrq+alt+c after the black screen > > > > happened. The system rebooted after about 10-20 seconds both times, but no kdump > > > > and dmesg files were saved in /var/crash. I'm attaching the lspci -vvv output as > > > > requested. > > > > > > > > > > Thanks for testing. As mentioned earlier I was not expecting this patch to fix > > > the black screen issue. It should fix kernel warnings and IOMMU page fault > > > related call traces. By any chance do you have the kernel boot logs? > > > > > > > > > @Baolu, > > > Looking into lspci output, it doesn't list ACS feature for Graphics card. So > > > with your fix it didn't enable PASID and hence it failed to boot. > > > > The ACS checks being done are feature of the path not the end point or > > root port. > > > > If we are expecting ACS on the end port then it is just a bug in how > > the test was written.. The test should be a NOP because there are no > > switches in this topology. > > > > Looking at it, this seems to just be because pci_enable_pasid is > > calling pci_acs_path_enabled wrong, the only other user is here: > > > > for (bus = pdev->bus; !pci_is_root_bus(bus); bus = bus->parent) { > > if (!bus->self) > > continue; > > > > if (pci_acs_path_enabled(bus->self, NULL, REQ_ACS_FLAGS)) > > break; > > > > pdev = bus->self; > > > > group = iommu_group_get(&pdev->dev); > > if (group) > > return group; > > } > > > > And notice it is calling it on pdev->bus not on pdev itself which > > naturally excludes the end point from the ACS validation. > > > > So try something like: > > > > if (!pci_acs_path_enabled(pdev->bus->self, NULL, PCI_ACS_RR | PCI_ACS_UF)) > > > > (and probably need to check for null ?) > > Yeah! This really is a misuse of pci_acs_path_enabled(). > > But if @pdev is an endpoint of a multiple function device, perhaps we > still need to check acs on it? Ah, I don't know anything about what this means from a spec perspective. Certainly if a function can internalize MMIO and loop it back to another function then it surely is not OK for PASID either, nor should those functions be in different iommu groups. So, either this never happens for some spec reason, or the test in the iommu code forming groups is incorrect. Jason