Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp556264pxf; Wed, 17 Mar 2021 10:24:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdpCIhVDDpKNKZYIoNwXFuJN0LXmqgUlxiYRmR8QaAmk9RuawYCSMkfw6nfdist4y0Eaxh X-Received: by 2002:a17:906:414e:: with SMTP id l14mr35314385ejk.406.1616001847902; Wed, 17 Mar 2021 10:24:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616001847; cv=none; d=google.com; s=arc-20160816; b=aYQRNSteMZPAzFljWz8VS+8AEAsHNiq8w1FHmLVJ6qK5+dV9mOTL2c69taLemvks7i hsbVf+dKFWHxS1koB6cHyO9+d1uPhGghvPGvqPakUFYMe0a88EYN9dxka+pZWMV96Nzo JoJz59tmTuPvDYkHWVw7WVHo7HyRppEIjEFBftjmifbtdYUwDFR7OrZlc4BjuSwXsmRE QzROmtI/lM4GW5z0V/ZC9IFgWTbRvKIi+ccf77o6wis2B/nEqMpjAimX+/I4JOXGK3Ew k8yFy38I3iBQxInLV7JoHntyNdcqzAg2ZswLtfFseCyOE9tIJPUwEXkoTFbD7iSDwcMs ajJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=KI1R824OvaDi8EtBJ+cCqzUwxRnNlDdyV/9bYCzn8Iw=; b=hp2PYQac+JEcvp08AXa007i1euyz0kWqM9pjI0gf4qm70uGTPUB3siNkIJXaLpLqXb fgbvGtvbZVURdtlQ3eWNrzG3kmM0u3Rqg45WPKppm8x3wfVGbDLZl52vfKRU3Dj+XStJ a+NzFnX+l+UtVQcexpHbkQH4pC3/VlotWHO0yWyBvoF1vW4qPn15ZeJkB9Fvi4XZlWS1 ByIirs1oKIdG5SwKXobnYzwFyDK7xo2ZQxAQgRSwW11X21ONB1Aek3ADT1VA+Gztg/sh bcUpBRfOtSuUeKHaMps4v5HhWL1C63AeSCRg7hfFnIN4bgs0ADKAJ1Yu4thNKxvDUlWW cJ3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=JJ8ujRoH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hp34si17636627ejc.328.2021.03.17.10.23.44; Wed, 17 Mar 2021 10:24:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=JJ8ujRoH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232593AbhCQQbx (ORCPT + 99 others); Wed, 17 Mar 2021 12:31:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232342AbhCQQbW (ORCPT ); Wed, 17 Mar 2021 12:31:22 -0400 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 420EEC06175F for ; Wed, 17 Mar 2021 09:31:22 -0700 (PDT) Received: by mail-ed1-x532.google.com with SMTP id x21so3038128eds.4 for ; Wed, 17 Mar 2021 09:31:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=KI1R824OvaDi8EtBJ+cCqzUwxRnNlDdyV/9bYCzn8Iw=; b=JJ8ujRoH22SvRQdBFA5n9qmv2MO4sYqWieR1gWLN3cVpaoq8y4F1znWnR2Dqr42LBt KKfWlfdUjv/y914o2KmjfEGRI2rTK5cUEHSzcUlesrIiBj2/kXQnE8iiNH+XEpleEvJ9 6AhmE2MBfGhRIXFywgON0EKdGoZptBHQ/wv1vLbjFbaCRx5hQaBkog6PMXL3ZRO7YNL9 dM9NFzvXaXwcuaYGw/oRJwNwvUuNleCA/KDC5/h7UKKaq9uVtMw6sF5mEB7fZ/i2r/iw NE8kFtDiWFmYvaP+xkSQWVHUYQKYs9AK7zQOZ+PcFAbGO6PakjQ3xLvhs5uLioAcFhP4 JVEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=KI1R824OvaDi8EtBJ+cCqzUwxRnNlDdyV/9bYCzn8Iw=; b=DHzYvAes1iIR6LDE+vZX2f/2Y++EsyaCZ1Ydyl8A//9r6qTLmjvBtVMsbT5024Ym9q Jk24L1Tl8Ji1TgyqecU5ag0NVKMuPrVVQolOtZIKD2OIQUGnrJZYZ3y9+ZTF51+6qVEb EhRW9pfOBxT8NGeEWyHaf13gVMDqb6C4Ykes9SJTgfS0kQtf9+Zwdg6/PnijgD4uuCZB DAgnwH2cSjq1otdKOPUimL7GwNe3Zy7MIA1q2CtAb8po5DxxDXsPW0YqT6aGbQgxjP0u 2w5qtbp1pmDrObp945hwLR+tvbwgCjEdpz5FBcHzvwjPXpel0Gfcf+oZR3tPiiGMZlxN JrOQ== X-Gm-Message-State: AOAM530IJ+kRsEjdIGuuSd1VVjumE1/+1T4B5cM2NdNIrLItv0XEd9Ur m4zUUMWYMdVF2cSxD147ngOzH0u4JgGv9lOmSKYJNA== X-Received: by 2002:aa7:c3cd:: with SMTP id l13mr42578746edr.52.1615998681018; Wed, 17 Mar 2021 09:31:21 -0700 (PDT) MIME-Version: 1.0 References: <59cb30f5e5ac6d65427ceaadf1012b2ba8dbf66c.1615606143.git.sathyanarayanan.kuppuswamy@linux.intel.com> <20210317041342.GA19198@wunner.de> <20210317053114.GA32370@wunner.de> In-Reply-To: <20210317053114.GA32370@wunner.de> From: Dan Williams Date: Wed, 17 Mar 2021 09:31:14 -0700 Message-ID: Subject: Re: [PATCH v2 1/1] PCI: pciehp: Skip DLLSC handling if DPC is triggered To: Lukas Wunner Cc: Kuppuswamy Sathyanarayanan , Bjorn Helgaas , Linux PCI , Linux Kernel Mailing List , "Raj, Ashok" , Keith Busch , knsathya@kernel.org, Sinan Kaya Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 16, 2021 at 10:31 PM Lukas Wunner wrote: > > On Tue, Mar 16, 2021 at 10:08:31PM -0700, Dan Williams wrote: > > On Tue, Mar 16, 2021 at 9:14 PM Lukas Wunner wrote: > > > > > > On Fri, Mar 12, 2021 at 07:32:08PM -0800, sathyanarayanan.kuppuswamy@linux.intel.com wrote: > > > > + if ((events == PCI_EXP_SLTSTA_DLLSC) && is_dpc_reset_active(pdev)) { > > > > + ctrl_info(ctrl, "Slot(%s): DLLSC event(DPC), skipped\n", > > > > + slot_name(ctrl)); > > > > + ret = IRQ_HANDLED; > > > > + goto out; > > > > + } > > > > > > Two problems here: > > > > > > (1) If recovery fails, the link will *remain* down, so there'll be > > > no Link Up event. You've filtered the Link Down event, thus the > > > slot will remain in ON_STATE even though the device in the slot is > > > no longer accessible. That's not good, the slot should be brought > > > down in this case. > > > > Can you elaborate on why that is "not good" from the end user > > perspective? From a driver perspective the device driver context is > > lost and the card needs servicing. The service event starts a new > > cycle of slot-attention being triggered and that syncs the slot-down > > state at that time. > > All of pciehp's code assumes that if the link is down, the slot must be > off. A slot which is in ON_STATE for a prolonged period of time even > though the link is down is an oddity the code doesn't account for. > > If the link goes down, the slot should be brought into OFF_STATE. > (It's okay though to delay bringdown until DPC recovery has completed > unsuccessfully, which is what the patch I'm proposing does.) > > I don't understand what you mean by "service event". Someone unplugging > and replugging the NVMe drive? Yes, service meaning a technician physically removes the card. > > > > > (2) If recovery succeeds, there's a race where pciehp may call > > > is_dpc_reset_active() *after* dpc_reset_link() has finished. > > > So both the DPC Trigger Status bit as well as pdev->dpc_reset_active > > > will be cleared. Thus, the Link Up event is not filtered by pciehp > > > and the slot is brought down and back up even though DPC recovery > > > was succesful, which seems undesirable. > > > > The hotplug driver never saw the Link Down, so what does it do when > > the slot transitions from Link Up to Link Up? Do you mean the Link > > Down might fire after the dpc recovery has completed if the hotplug > > notification was delayed? > > If the Link Down is filtered and the Link Up is not, pciehp will > bring down the slot and then bring it back up. That's because pciehp > can't really tell whether a DLLSC event is Link Up or Link Down. > > It just knows that the link was previously up, is now up again, > but must have been down intermittently, so transactions to the > device in the slot may have been lost and the slot is therefore > brought down for safety. Because the link is up, it is then > brought back up. I wonder why we're not seeing that effect in testing?