Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp787939pxb; Wed, 1 Sep 2021 09:52:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzI+0qJrwAadXZwZ2utL6lNuiQKELFpOUM92GegadAKRSoKCnAu6gyu4mds6gX0jE+mu/rW X-Received: by 2002:a5d:8784:: with SMTP id f4mr465979ion.48.1630515158573; Wed, 01 Sep 2021 09:52:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630515158; cv=none; d=google.com; s=arc-20160816; b=im8CiVZS2OmLwFl5iTa3wrRjwORUDuK12b7QnC3QsKNZde5ncjh6PwXClwDUYziw4z fJFxfbsG0q75t6SXt31aibRZmy41ADRQ+rWnnjHvr6Bgc9m4+4iUvX6wuozeMvUqdXLd j6Anq7B3ypd7ak/3zXc9OygEO+/2kumBGU8r6k2Jsj6RiKl1838WVkjWZQa2OoT/m5DY BVyH2i309O+X7DV3/zGXvTxP/N5gmTvUbk0U4R2uioHS2d5z+DlQ7peVZuN48IkREhkz JZIGWq+JhLP+5da03Go46kH4K81Tx5bLekGVIpN90QeGlu/3a7cgIX08pyFNFoY2liJJ j6zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:subject:from :references:cc:to:dkim-signature; bh=RTD1viy9sw5ExgLARnDLkuiurxfEpvNu7YsBvXrRNP0=; b=BTpUtCLR5oDQ8AqaS5XzYLWql+LB2AsUnJ2rQ+k8uyskbw3o7F25GU7CAVk5+P2R9I ShKTxlGS0z0QRrO4Z14vEv8n4nYc9DFVIc99FnfPSdKnBVXwNRjVzqbnwA9Oq+wxuYTX f/I3/+2pi5XAP11alASK8Bcmtp9uO0L9JGEFLoDwBevbwojtqAUX0PnQeAOp1ntAufZa VEbWTUl9jL/DbDBuE73NAzHWBHqrDuOC2DiCj5YNYp7tXA4CR2M05fXHHgm+sYpn+2dr TCU6Nx+RblvZDvhJVhpAaFVzrVh8KV33c0Ai8+RHiznz2WeBKvLAq2nvTqGQ+dj5JXY0 WVSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=GQyDH60M; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t7si163900ilf.11.2021.09.01.09.52.18; Wed, 01 Sep 2021 09:52:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-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=@gmail.com header.s=20210112 header.b=GQyDH60M; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344190AbhIAQw3 (ORCPT + 99 others); Wed, 1 Sep 2021 12:52:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245530AbhIAQw2 (ORCPT ); Wed, 1 Sep 2021 12:52:28 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1AC5C061575; Wed, 1 Sep 2021 09:51:31 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id b6so530589wrh.10; Wed, 01 Sep 2021 09:51:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:cc:references:from:subject:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=RTD1viy9sw5ExgLARnDLkuiurxfEpvNu7YsBvXrRNP0=; b=GQyDH60MECuiTOMVOM4CVk9XxVDko5MCcWL7QJU/PTcuDHH/b5TuZgIfz5gPt7DMkr jvWIQwJ3SavA8l3Z4GqQEK5rPLL4w8osRGeADFsj2OLqNG4PCw7MZmhGcyXBFRF9uynD OrOeW55tlvaeRetbQslRukbSThkoVtjPMQnJtWPtFniNkf5WjXxwXbkyGtDVDx6ENbkS vrIzmiMBffXa7O2ImEzWTXX56Ta8bl1qNHrz1G0i+tXzoKWhuZ2RDT+tmAm769a0Agh4 AcAqEzNehTuJOpIUvj93/Ea3Cz7cpmeRMia9gsOCErgso58ohtP2doA8nIFGdF271mbi TQog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:references:from:subject:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=RTD1viy9sw5ExgLARnDLkuiurxfEpvNu7YsBvXrRNP0=; b=To2bDtm04jeJzcvTkyJBLgnba+uHu7AbTuC9a9+c+Lrvnsj76tuBIhoaKTIkA/kljL 2lRBEHcLb5WbzgGOqPJnQfaVmrdTl88dZnlnFwps60MNLGZ2EjRw4g8L45FJonUQADye 7yLPP8VfQ3jd0GmLycvvf01A3gP1j5OAMaz4rDwCAjv9E0oozluAHC+P3MlmoutjbnWh eRWbu3UL43HgCTumPLllNh8oIILGEzNynk65DNDOtUg5b2OY0C4zvKhVxR2nJrPmGr1k SAsDY4UjeAqMUiyUJYpNxdVV2OtjBgQ5vGVSQd8Djwuc8J0Bd4z0odAjvfaSRL4QG+03 qIDA== X-Gm-Message-State: AOAM533I5wxJQzmxe9V5sxSqwFwUud871tAP2ZNl7MpR/wePqCS98SnA hpBD4XbtkTlAWlQLMfzRUFJsYPLX49Q= X-Received: by 2002:adf:efc2:: with SMTP id i2mr438135wrp.94.1630515090220; Wed, 01 Sep 2021 09:51:30 -0700 (PDT) Received: from ?IPv6:2003:ea:8f08:4500:58da:e5eb:c867:1a2c? (p200300ea8f08450058dae5ebc8671a2c.dip0.t-ipconnect.de. [2003:ea:8f08:4500:58da:e5eb:c867:1a2c]) by smtp.googlemail.com with ESMTPSA id g1sm19007wrb.27.2021.09.01.09.51.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 01 Sep 2021 09:51:29 -0700 (PDT) To: =?UTF-8?Q?Pali_Roh=c3=a1r?= , =?UTF-8?Q?Jonas_Dre=c3=9fler?= Cc: Andy Shevchenko , Amitkumar Karwar , Ganapathi Bhat , Xinming Hu , Kalle Valo , "David S. Miller" , Jakub Kicinski , Tsuchiya Yuto , "open list:TI WILINK WIRELES..." , netdev , Linux Kernel Mailing List , linux-pci , Maximilian Luz , Andy Shevchenko , Bjorn Helgaas References: <20210830123704.221494-1-verdre@v0yd.nl> <20210830123704.221494-2-verdre@v0yd.nl> <7e38931e-2f1c-066e-088e-b27b56c1245c@v0yd.nl> <20210901155110.xgje2qrtq65loawh@pali> From: Heiner Kallweit Subject: Re: [PATCH 1/2] mwifiex: Use non-posted PCI register writes Message-ID: <985049b8-bad7-6f18-c94f-368059dd6f95@gmail.com> Date: Wed, 1 Sep 2021 18:51:21 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <20210901155110.xgje2qrtq65loawh@pali> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On 01.09.2021 17:51, Pali Rohár wrote: > On Wednesday 01 September 2021 16:01:54 Jonas Dreßler wrote: >> On 8/30/21 2:49 PM, Andy Shevchenko wrote: >>> On Mon, Aug 30, 2021 at 3:38 PM Jonas Dreßler wrote: >>>> >>>> On the 88W8897 card it's very important the TX ring write pointer is >>>> updated correctly to its new value before setting the TX ready >>>> interrupt, otherwise the firmware appears to crash (probably because >>>> it's trying to DMA-read from the wrong place). >>>> This sounds somehow like the typical case where you write DMA descriptors and then ring the doorbell. This normally requires a dma_wmb(). Maybe something like that is missing here? Reading back all register writes may cause a certain performance impact, and if it can be avoided we should try to avoid it. >>>> Since PCI uses "posted writes" when writing to a register, it's not >>>> guaranteed that a write will happen immediately. That means the pointer >>>> might be outdated when setting the TX ready interrupt, leading to >>>> firmware crashes especially when ASPM L1 and L1 substates are enabled >>>> (because of the higher link latency, the write will probably take >>>> longer). >>>> >>>> So fix those firmware crashes by always forcing non-posted writes. We do >>>> that by simply reading back the register after writing it, just as a lot >>>> of other drivers do. >>>> >>>> There are two reproducers that are fixed with this patch: >>>> >>>> 1) During rx/tx traffic and with ASPM L1 substates enabled (the enabled >>>> substates are platform dependent), the firmware crashes and eventually a >>>> command timeout appears in the logs. That crash is fixed by using a >>>> non-posted write in mwifiex_pcie_send_data(). >>>> >>>> 2) When sending lots of commands to the card, waking it up from sleep in >>>> very quick intervals, the firmware eventually crashes. That crash >>>> appears to be fixed by some other non-posted write included here. >>> >>> Thanks for all this work! >>> >>> Nevertheless, do we have any commits that may be a good candidate to >>> be in the Fixes tag here? >>> >> >> I don't think there's any commit we could point to, given that the bug is >> probably somewhere in the firmware code. > > Then please add Cc: stable@vger.kernel.org tag into commit message. Such > bugfix is a good candidate for backporting into stable releases. > >>>> Signed-off-by: Jonas Dreßler