From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B633C433EF for ; Mon, 23 May 2022 14:20:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237110AbiEWOU4 (ORCPT ); Mon, 23 May 2022 10:20:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235987AbiEWOUp (ORCPT ); Mon, 23 May 2022 10:20:45 -0400 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 0B5C75A17A; Mon, 23 May 2022 07:20:43 -0700 (PDT) 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 TLS DV RSA Mixed SHA256 2020 CA-1" (verified OK)) by bmailout3.hostsharing.net (Postfix) with ESMTPS id 4D8E1100D5844; Mon, 23 May 2022 16:20:42 +0200 (CEST) Received: by h08.hostsharing.net (Postfix, from userid 100393) id 13E602ED3E7; Mon, 23 May 2022 16:20:42 +0200 (CEST) Date: Mon, 23 May 2022 16:20:42 +0200 From: Lukas Wunner To: Sheng Bi Cc: Bjorn Helgaas , Alex Williamson , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] PCI: Fix no-op wait after secondary bus reset Message-ID: <20220523142042.GA19286@wunner.de> References: <20220516165740.6256af51.alex.williamson@redhat.com> <20220518115432.76183-1-windy.bi.enflame@gmail.com> <20220520064148.GA20418@wunner.de> <20220521124910.GA13556@wunner.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, May 22, 2022 at 01:37:50AM +0800, Sheng Bi wrote: > On Sat, May 21, 2022 at 8:49 PM Lukas Wunner wrote: > > On Sat, May 21, 2022 at 04:36:10PM +0800, Sheng Bi wrote: > > > If so, I also want to align the polling things mentioned in the > > > question from Alex, since pci_dev_wait() is also used for reset > > > functions other than SBR. To Bjorn, Alex, Lucas, how do you think if > > > we need to change the polling in pci_dev_wait() to 20ms intervals, or > > > keep binary exponential back-off with probable unexpected extra > > > timeout delay. > > > > The exponential backoff should probably be capped at some point > > to avoid excessive wait delays. I guess the rationale for > > exponential backoff is to not poll too frequently. > > Capping at 20 msec or 100 msec may be reasonable, i.e.: > > > > - delay *= 2; > > + delay = min(delay * 2, 100); > > Capping at 20 or 100 msec seems reasonable to me. Btw, since 20 msec > is not a long time in these scenarios, how about changing to a fixed > 20 msec interval? The callers of pci_dev_wait() seem to wait for the spec-defined delay and only call pci_dev_wait() to allow for an additional period that non-compliant devices may need. That extra delay can be expected to be low, which is why it makes sense to start with a short poll interval and gradually extend it. So the algorithm seems to be reasonable and I wouldn't recommend changing it to a constant interval unless that fixes something which is currently broken. Thanks, Lukas