Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3109850rdh; Mon, 27 Nov 2023 06:44:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IGtpQ0+bx7YsRr2jBtCXnfLgaycMHNpAVRN/1e5BscL7Yl1eg/MI1QTzIxmhv6CijvH5E4w X-Received: by 2002:a05:6a00:234f:b0:6cb:8dba:ce6a with SMTP id j15-20020a056a00234f00b006cb8dbace6amr14434586pfj.27.1701096268427; Mon, 27 Nov 2023 06:44:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1701096268; cv=pass; d=google.com; s=arc-20160816; b=c3ctWLn4m16XxIDDeE5ssaqWKN59n2v5dHWnlUiLZ70e7h5fwp+hStA/H4O4yZNymO 6TeiUhqHFh9cRZu/t9HL02VApMhI24B2pWZNYfzvxBqUadIofOnOZIXPINiMgc1CicHp jzySHRcjW+LjsX2+9cTMBL4RueC0rn1K56YhOe0Wey5v+lYVBJ7+tu2N6RsBlNg229D7 egmOlbpiMVSvH1v0s1vUuOy7+FSFEAHRF7a9X3OO2hnWlDSHA75dbwko3lyIebSCgVR6 oXmyOUbVHwdyL7YNFB2sw+IrL32oB3lj/Z8fuCvsGhtmZVSQSYJEXN/goOW89XboLFLD hcmg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:content-language:references:cc:to:from:subject :user-agent:date:message-id:dkim-signature; bh=9zmamiHI5OHP+cUqLH3OwxHhVonZV/uWA5uvKbt6cX4=; fh=hGA9bYUq1vSpZhmMPZHPgQsdFWR8ja1UWKCQU5U+7ps=; b=Af/anPr1+ORUpOJxd4pWSHRUwvprBGdqei3xqCmXMUdIG9oraNuYUSUGUg12snDd6M L91irh0QkIYCXLU3BUQzh5hyphLlCltjc+e10C+cLZZCatMvgMoA+cp1z+d2+4m1XdH7 uh8JuepZABcvfUrPDWRNEXKH7KmD0GKq3Lql1kmIZIBgCCDj+5pSnNRMiZ+4e6yHeLLJ yXp0K/aLB2sntvFS6/rQQxHqGsapHPfBxqHseVJa442sug1LsdvrNHJ38ZmMAdv68oNF Isy6Haksm4Xs0haNdGsmy8Mk457cjdpxZcI1l1ivxK9QOUz/OM5WI6cwwiMmS5Vve054 Vt+w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=Iy3bQCz7; 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 23.128.96.36 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 pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id t14-20020a63534e000000b005be1ee5b9dfsi9360153pgl.454.2023.11.27.06.44.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 06:44:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=Iy3bQCz7; 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 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 4DCC08131C3A; Mon, 27 Nov 2023 06:44:16 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233680AbjK0On6 (ORCPT + 99 others); Mon, 27 Nov 2023 09:43:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233504AbjK0On4 (ORCPT ); Mon, 27 Nov 2023 09:43:56 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2068.outbound.protection.outlook.com [40.107.93.68]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75E5585; Mon, 27 Nov 2023 06:44:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TOrn4pWLF35zwDaTVwJp22nvtp0WHZYbomQW/DucgDWs7u20en3KANVY8pe3m3FxFK+gCLxbPcuSe2uV593ElWgDpIboRVR4/fia6aXzpO3C8qctxYA8TAKRzO7KIk3l5EdDlAiMeyaFBGinm6L+iV0PRVJ/RK2LjTVTl07tpbLygALeTaBqIlcDThizlAIJmY9EgJjQrumJL/Fe0El/KjRYMqn5dVftJXRPgRlt/tEBqUCB02bg9mukur5tUDhkJyLJomCJ+7W9WB3LD0FxmSuOsesCfckFgaZeUFmhY0GPNMgjDeHw+qYDnXVx9OM1ZqYXozKjyaF1tHFjSryVQQ== 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=9zmamiHI5OHP+cUqLH3OwxHhVonZV/uWA5uvKbt6cX4=; b=mu2/9Kq3Z2UINBetu/EYsTnafgrtklNdc9UrMU6wjJx9ttaWPU/GcD7f5nYxJvELVBKTALHeDWdRUaWYT4JmyO5w7tZt7gEFcRV5QojpZGFmQTb3GQ64fyWAQC1lxltHtCfpaRpHOPpWVf9VxFthy/2Zt4PLp93/qFjfkAv2v6EvDV7eA/aUdNbwg8Y6RzyS+EN+WXJWg34qM0NhnHDjC9ixqibNviBcOy1g12BlvnmgA40G/JpZdOGKcaS1nhYrjNLUMzFaAdg4XXEg2UdhygKS//T4XOrHpX58vdsVNXvoDUMO7w41gpaSNVQ7t0dLpfgKqJX9GHrGLsCKNvIS1A== 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=9zmamiHI5OHP+cUqLH3OwxHhVonZV/uWA5uvKbt6cX4=; b=Iy3bQCz7rcCDPB8SX30KSIIvUhUuhqYhkHBTFzWkA6qQZGyEFLuQMRtGZh2Zt/ozQwWtkpGW5uk/0rWSjuFQsNgm+ys8Fapb7a9DEP5WiRFyNjUhFV9Fp1MnYgcOYUYKe30w/l1aJn37WltbTGycT7ylgO3Hb+IiTSAWMWkkDEPrSznyntzji4NOOSudSoNs0ayEC9sshEB1IOIOOWO1eS7l3/zSJDWuKzxxlMTCbgQq+YdrIVZi7WYVUTDynC6iReDuumIs+yPU/c/Iq4i1fOWZItsDf07mryHy0223mOl7RXWISUne1JLuN7TLGLsCXwRKUTyfE3NhVK9NKBpUrA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BN8PR12MB2900.namprd12.prod.outlook.com (2603:10b6:408:69::18) by IA0PR12MB8696.namprd12.prod.outlook.com (2603:10b6:208:48f::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7025.27; Mon, 27 Nov 2023 14:43:59 +0000 Received: from BN8PR12MB2900.namprd12.prod.outlook.com ([fe80::eda4:8c67:893f:3d13]) by BN8PR12MB2900.namprd12.prod.outlook.com ([fe80::eda4:8c67:893f:3d13%5]) with mapi id 15.20.7025.022; Mon, 27 Nov 2023 14:43:59 +0000 Message-ID: Date: Mon, 27 Nov 2023 20:13:50 +0530 User-Agent: Mozilla Thunderbird Subject: Re: Race b/w pciehp and FirmwareFirst DPC->EDR flow - Reg From: Vidya Sagar To: Bjorn Helgaas , Lorenzo Pieralisi , Lukas Wunner , Sathyanarayanan Kuppuswamy , "kbusch@kernel.org" Cc: Vikram Sethi , Krishna Thota , "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" , sagar.tv@gmail.com References: <529acc15-1932-4785-9edf-c5327db64ab1@nvidia.com> Content-Language: en-US In-Reply-To: <529acc15-1932-4785-9edf-c5327db64ab1@nvidia.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: MA0PR01CA0028.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a01:b8::16) To BN8PR12MB2900.namprd12.prod.outlook.com (2603:10b6:408:69::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8PR12MB2900:EE_|IA0PR12MB8696:EE_ X-MS-Office365-Filtering-Correlation-Id: 7c643172-66da-4d73-6e4e-08dbef574a85 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nBuU0I0Fl19oYM7cIU5tujbBGzJfeMItpI3CoN7IbViUxudPF8Kqet0hm92YOutpqb+KJqN0UpmD0iB7tmiD6yykxbgCKCI6TuxoI6Zm2FzF7ZsAO9u4lwYdbkciE8ogxZIIXF8aGgIg67XT5r+GeDbX7ulmjrwGdM+epp/rWv7cZPnq9sFPULKrHvkfX8IBh9K4I5Bc9ELQjGGiHhMaScfGwtveiUwWyfQ9q6hTugALYgXYFuTHggQEPQP1arnZ2Aa5mbYuOBCOU9j21Crc8AOrAzpA8hU79SUaqr6y939CpNj9qRiASA8YrDP0KEIEwUS8yzJwdeq2xGF72DQEWFccP2GrYPcXo02SrKcdld/PvqV+t7JXPl5lg0BVPEHU7Q6xazXwx86yeZ7QCirokfOOcPOmfBRlpVcQausTdiTq3PrmUdJh+A0PgP1i0TLXuxd9zDXD+Shy2vrsfspq7JdyLA6olyMRAiGA8JpUN7TQZ66zFoLSwjfa6Sr7PS7fx72Jk8j9FQJ8ZprBceibcKLyPGuSl8DaWdwPeq6M9qmZa3lYq8rIr9obLrDRav7D7N5aBco4HnUy59L3ek0k3GGADGk9PSX2Iif9WBxilqK4ctfRGJtUIqzFdq4jhaeceK6VMxdOm2t94W5angZ/hQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR12MB2900.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(136003)(346002)(376002)(39860400002)(366004)(396003)(230922051799003)(451199024)(1800799012)(64100799003)(186009)(6666004)(8676002)(8936002)(4326008)(31696002)(6512007)(6506007)(53546011)(66476007)(110136005)(54906003)(66556008)(66946007)(316002)(6486002)(478600001)(2906002)(38100700002)(41300700001)(36756003)(31686004)(86362001)(26005)(2616005)(83380400001)(5660300002)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?dzNnQU5ibVhYSVNwWmlLcjFyY2pRdWl3TXY4Ly9jcytIaWNvM2xMbEJpSkJ6?= =?utf-8?B?ZDBBNkI5YXRjbExLUEJzZHUrcHJVZDFvVysrN2wxVFlKdmJyTnNiRERzbVMv?= =?utf-8?B?YnVsWldKQmJCNTY2WnNwdk11TUpKK2NtUDc4ZVFZTmVBL3JNNTF6WFhMdTkw?= =?utf-8?B?aDd5WVBNdjkwTFdpaW1RenNVZjVraXNtZjZZOENudVU5Z0orM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i9EaXBNcCtWWDBNT2g0aDQ4YVJBNlBkWjNRTGUvWEk2OFJJK2tZRXlC?= =?utf-8?B?RXcyRlo5RFdWdVUyanJManBkdE51TklteDdEa08yOFRLVDNjbXcwMTJkQ1JP?= =?utf-8?Q?JRiC3vL9rIdpAAQwL0r+bRdHt?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7c643172-66da-4d73-6e4e-08dbef574a85 X-MS-Exchange-CrossTenant-AuthSource: BN8PR12MB2900.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Nov 2023 14:43:59.8401 (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: oF8RsT/sqbv0bwc6v+jQaL8xsNTqJf0fckeJPTRp5Bc81PraQiPixS11NrFg88zqtjc4Bv38xcDDbZCjArM01g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB8696 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Mon, 27 Nov 2023 06:44:16 -0800 (PST) Hi Bjorn and others, Could you please share your thoughts on this? Thanks, Vidya Sagar On 11/10/2023 10:31 PM, Vidya Sagar wrote: > There was a typo. Corrected it. > > s/If DPC->EDR flow checks DPC also/If DPC->EDR flow checks 'PD Change' also > > On 11/10/2023 6:30 PM, Vidya Sagar wrote: >> Hi folks, >> Here are the platform details. >> - System with a Firmware First approach for both AER and DPC >> - CPERs are sent to the OS for the AER events >> - DPC is notified to the OS through EDR mechanism >> - System doesn't have support for in-band PD and supports only OOB PD >> where writing to a private register would set the PD state >> - System has this design where PD state gets cleared whenever there is >> a link down (without even writing to the private register) >> >> In this system, if the root port has to experience a DPC because of >> any right reasons (say SW trigger of DPC for time being), I'm >> observing the following flow which is causing a race. >> 1. Since DPC brings the link down, there is a DLLSC and an MSI is sent >> to the OS hence PCIe HP ISR is invoked. >> 2. ISR then takes stock of the Slot_Status register to see what all >> events caused the MSI generation. >> 3. It sees both DLLSC and PDC bits getting set. >> 4. PDC is set because of the aforementioned hardware design where for >> every link down, PD state gets cleared and since this is considered as >> a change in the PD state, PDC also gets set. >> 5. PCIe HP ISR flow transitions to the PCIe HP IST (interrupt >> thread/bottom half) and waits for the DPC_EDR to complete (because >> DLLSC is one of the events) >> 6. Parallel to the PCIe HP ISR/IST, DPC interrupt is raised to the >> firmware and that would then send an EDR event to the OS. Firmware >> also sets the PD state to '1' before that, as the endpoint device is >> still available. >> 7. Firmware programming of the private register to set the PD state >> raises second interrupt and PCIe HP ISR takes stock of the events and >> this time it is only the PDC and not DLLSC. ISR sends a wake to the >> IST, but since there is an IST in progress already, nothing much >> happens at this point. >> 8. Once the DPC is completed and link comes back up again, DPC >> framework asks the endpoint drivers to handle it by calling the >> 'pci_error_handlers' callabacks registered by the endpoint device >> drivers. >> 9. The PCIe HP IST (of the very first MSI) resumes after receiving the >> completion from the DPC framework saying that DPC recovery is successful. >> 10. Since PDC (Presence Detect Change) bit is also set for the first >> interrupt, IST attempts to remove the devices (as part of >> pciehp_handle_presence_or_link_change()) >> >> At this point, there is a race between the device driver that is >> trying to work with the device (through pci_error_handlers callback) >> and the IST that is trying to remove the device. >> To be fair to pciehp_handle_presence_or_link_change(), after removing >> the devices, it checks for the link-up/PD being '1' and scans the >> devices again if the device is still available. But unfortunately, IST >> is deadlocked (with the device driver) while removing the devices >> itself and won't go to the next step. >> >> The rationale given in the form of a comment in >> pciehp_handle_presence_or_link_change() for removing the devices first >> (without checking PD/link-up) and adding them back after checking >> link-up/PD is that, since there is a change in PD, the new link-up >> need not be with the same old device rather it could be with a >> different device. So, it justifies in removing the existing devices >> and then scanning for new ones. But this is causing deadlock with the >> already initiated DPC recovery process. >> >> I see two ways to avoid the deadlock in this scenario. >> 1. When PCIe HP IST is looking at both DLLSC and PDC, why should >> DPC->EDR flow look at only DLLSC and not DPC? If DPC->EDR flow checks >> 'PD Change' also (along with DLL) and declares that the DPC recovery >> can't happen (as there could be a change of device) hence returning >> DPC recovery failure, then, the device driver's pci_error_handlers >> callbacks won't be called and there won't be any deadlock. >> 2. Check for the possibility of a common lock so that PCIe HP IST and >> device driver's pci_error_handlers callbacks don't race. >> >> Let me know your comments on this. >> >> Thanks, >> Vidya Sagar