Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3148769rdh; Mon, 27 Nov 2023 07:26:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IHujzPqGL+Il4cyKcd7eb69yjpsad0lnGMON0fp7kN9lNwUsIlz9PRviKNlghcdsUwYaB7s X-Received: by 2002:a17:902:da81:b0:1cf:b1e7:14b6 with SMTP id j1-20020a170902da8100b001cfb1e714b6mr8362062plx.31.1701098816520; Mon, 27 Nov 2023 07:26:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701098816; cv=none; d=google.com; s=arc-20160816; b=vmKXvENCEJ4Y1g9sRL6r/ToMxWabzjd0hGoVnFzJKb36gCMpTVRncSVj3zDNtu48qR PVHL5wOV/QsZU1yJ1dn0IIMCbAgV6UQOpT5rVBR7yAYQsRBU1OLRKLMCDXQ+7w7oPyCU iM8NfYP/Pm5oXb5s9BDlsneeIpOPGOMq3TEjvSJGtlD2r9Wc4sJioYF/RqFOqr1kdrSx vRVERSpr2AAIUqDmb666///BL/JjAmkQZqTBrzqADtl3h9rwclevlwURqtAt99V0k3gR S9y5T+ZsKzz5Tvqvr8C2Jsn7M45QOHRFFHy0XtEaNF+p5RsmOGwErRRD0LVR0dTW6Z5Q MP+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=AI8ZFnml+DwmO076hcBOz/IRpvpej2G4pwoEhPUvtls=; fh=7X2Db8Ioo/YtNWohWHLgpPnza33WdkKehLKRrc4SWE4=; b=QDy3j1cz8jU5NWT9j6Kxo2NclrKUqtBAe5BHjBv9mxzVQ/dDVwDicHmVIfVW0lxcoH +m2R2uWsN45U/TRdSNjoMVBXUBhyFJoAK3PBmk6Jbeh/BPCNYpK69NCovt7WFPpuCwnh 0RzEHPR3RtrK5Uz1hpIkufMzXx3zHXP9sWN7FBeThYmPXI4lG6+1PnTmL/p+zpOiw88P yjCcmSBmtUPI9X1xabsk8j5g/12arjdt2r1wLB4jAxERqUV8zcuLRCHCTW4eicdfXBMb YNlRvwm3IiSsDnDOKk9ZkD8sNkQX1bP7k02q4V+NAiy/N9TEox8VWPK5hE5hjHz8lOX2 cZ8A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id g5-20020a170902868500b001cfbdc27fd6si4086301plo.485.2023.11.27.07.26.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 07:26:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id D9E478058002; Mon, 27 Nov 2023 07:26:54 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233882AbjK0P0o (ORCPT + 99 others); Mon, 27 Nov 2023 10:26:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230352AbjK0P0k (ORCPT ); Mon, 27 Nov 2023 10:26:40 -0500 Received: from bmailout3.hostsharing.net (bmailout3.hostsharing.net [IPv6:2a01:4f8:150:2161:1:b009:f23e:0]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 653E4C3 for ; Mon, 27 Nov 2023 07:26:46 -0800 (PST) Received: from h08.hostsharing.net (h08.hostsharing.net [IPv6:2a01:37:1000::53df:5f1c:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "*.hostsharing.net", Issuer "RapidSSL Global TLS RSA4096 SHA256 2022 CA1" (verified OK)) by bmailout3.hostsharing.net (Postfix) with ESMTPS id 968B8100D940E; Mon, 27 Nov 2023 16:26:41 +0100 (CET) Received: by h08.hostsharing.net (Postfix, from userid 100393) id 6B2F5290BE; Mon, 27 Nov 2023 16:26:41 +0100 (CET) Date: Mon, 27 Nov 2023 16:26:41 +0100 From: Lukas Wunner To: Vidya Sagar Cc: Bjorn Helgaas , Lorenzo Pieralisi , Sathyanarayanan Kuppuswamy , "kbusch@kernel.org" , Vikram Sethi , Krishna Thota , "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" , sagar.tv@gmail.com Subject: Re: Race b/w pciehp and FirmwareFirst DPC->EDR flow - Reg Message-ID: <20231127152641.GA5149@wunner.de> References: <529acc15-1932-4785-9edf-c5327db64ab1@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <529acc15-1932-4785-9edf-c5327db64ab1@nvidia.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 27 Nov 2023 07:26:55 -0800 (PST) Hi Vidya, sorry for the delay, still catching up on e-mails after Plumbers... On Fri, Nov 10, 2023 at 10:31:55PM +0530, Vidya Sagar wrote: > > - 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 We already have an inband_presence_disabled flag in struct controller which is set if the In-Band PD Disable Supported bit in the Slot Capabilities 2 Register is set. The flag may also be set through the inband_presence_disabled_dmi_table[]. Currently the only place where the flag makes a difference is on slot bringup: pciehp_check_link_status() doesn't wait for the Presence Detect Status bit to become set. I'm wondering if we need to also disregard PDC events if In-Band PD is disabled. Not sure if the behavior you're seeing is caused by a quirk of the hardware or is expected if In-Band PD is disabled. Probably the former. A code change would generally only be acceptable in the latter case though I think. > > 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. Could you provide stacktraces of the two deadlocked tasks? Right now I don't quite understand why they're deadlocked. Are you getting hung task messages in dmesg? They should include stacktraces. Also, which kernel version are we talking about? Thanks, Lukas