Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp3724700ybc; Thu, 14 Nov 2019 13:46:02 -0800 (PST) X-Google-Smtp-Source: APXvYqyRiWh2eGyKMEmERVQVNzZdlRrsJCHPLKTrhdZCygEtGg4yNWGhGnT5Ep9CYdHSd1/KbnxV X-Received: by 2002:a1c:e0c4:: with SMTP id x187mr11079430wmg.93.1573767962246; Thu, 14 Nov 2019 13:46:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573767962; cv=none; d=google.com; s=arc-20160816; b=M8xJrgyLY25dNe2ikO5QnGgQWRjTbQQjxKISrY6tq4QM4iBpkKxEOCYvOq9VRVKkmp r/yg3MgkfcFsTX9CXzcBWFW9F8Y5ZOJteZpNcmwHucOGKVC6WxFhxfHU0vmjC7xIzS4f s99/TGTh6NIQZ05+5O4bpQ9gw0UucVxCNTacOPUzEXBrqOnRGKxYdX8yZTKrwo1/rV9L ozwd+JeCe3LqOOnh9SKnilgx9sNw0ikyOHoSV8UpIEA7UZv0wuOO1NaAievD7P5KpElU ylnPkmM/t1NpBsRR2E+InzMyatQE2W60qQO7cVVmG7alEyBaS9CCU5bQgfdaxye4clzL 3BJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=BlRgxYusEJsWBkXpNI2hJS4fhZyjRIG6qOjBKXaXlnM=; b=cugmGymtCrFYx0gOootEPAU4LmVfs/9BW5Disaw9q1bpLsesd7vVMu+c4CsucQS0yv nY1eLas2m8lpJKN56WwuOG4cvOzaRpyTvxX90/RuKaj8lnZ386SLHJNQewsF6pK1+xsv x/BCRTcFsAfOsbmqeVM8h+mIZM7/nzcnBqyJCRyb5+BL+q05JHHHpCEbgxoXbmau5oPj dsi5Ws4/xiSTcrniALwNdKjpdpYVFxm2D4Z4Q0cJvt3g7n5EdXvg73ZZQpb6sN/dkwY1 +AgIw+chH5rqWe5jesYj2WrtW3qrBGVNKWHbR6WiGUQ6Ls3vK47cUupToei4VgrgVfmm sJcw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y14si4585810edu.250.2019.11.14.13.45.31; Thu, 14 Nov 2019 13:46:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726995AbfKNVpU (ORCPT + 99 others); Thu, 14 Nov 2019 16:45:20 -0500 Received: from ns.lynxeye.de ([87.118.118.114]:55733 "EHLO lynxeye.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726953AbfKNVpU (ORCPT ); Thu, 14 Nov 2019 16:45:20 -0500 Received: by lynxeye.de (Postfix, from userid 501) id D2B85E74222; Thu, 14 Nov 2019 22:45:18 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on lynxeye.de X-Spam-Level: X-Spam-Status: No, score=-2.9 required=3.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.3.1 Received: from radon.fritz.box (a89-183-75-168.net-htp.de [89.183.75.168]) by lynxeye.de (Postfix) with ESMTPSA id BFF50E74217; Thu, 14 Nov 2019 22:45:17 +0100 (CET) Message-ID: Subject: Re: long delays in rtl8723 drivers in irq disabled sections From: Lucas Stach To: Larry Finger , Pkshih , wlanfae Cc: "linux-wireless@vger.kernel.org" , "netdev@vger.kernel.org" Date: Thu, 14 Nov 2019 22:45:17 +0100 In-Reply-To: References: <5de65447f1d115f436f764a7ec811c478afbe2e0.camel@lynxeye.de> <5B2DA6FDDF928F4E855344EE0A5C39D1D5C9CE47@RTITMBSVM04.realtek.com.tw> <5B2DA6FDDF928F4E855344EE0A5C39D1D5C9D5F6@RTITMBSVM04.realtek.com.tw> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.34.1 (3.34.1-1.fc31) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Hi Larry, Am Donnerstag, den 14.11.2019, 15:25 -0600 schrieb Larry Finger: [...] > > > I don't know if this function needs to guard against something running > > > in the IRQ handler, so depending on the answer to that the solution > > > might be as simple as not disabling IRQs when taking the spinlock. > > > > > > kworker/-276 4d... 0us : _raw_spin_lock_irqsave > > > kworker/-276 4d... 0us : rtl8723_phy_rf_serial_read <-rtl8723de_phy_set_rf_reg > > > kworker/-276 4d... 1us : rtl8723_phy_query_bb_reg <-rtl8723_phy_rf_serial_read > > > kworker/-276 4d... 3us : rtl8723_phy_set_bb_reg <-rtl8723_phy_rf_serial_read > > > kworker/-276 4d... 4us : __const_udelay <-rtl8723_phy_rf_serial_read > > > kworker/-276 4d... 4us!: delay_mwaitx <-rtl8723_phy_rf_serial_read > > > kworker/-276 4d... 1004us : rtl8723_phy_set_bb_reg <-rtl8723_phy_rf_serial_read > > > [...] > > > > > > > I check TX/RX interrupt handlers, and I don't find one calls RF read function > > by now. I suspect that old code controls RF to do PS in interrupt context, so > > _irqsave version is used to ensure read RF isn't interrupted or deadlock. > > So, I change spin_lock to non-irqsave version, and do some tests on 8723BE > > that works well. > > > > What do you think about two fixes mentioned above? If they're ok, I can send > > two patches to resolve this long delays. > > Lucas, > > If the above patch fixes the problem with the 8723de, I will modify the GitHub > driver. Although 8723de will be added to rtw88, I will keep the driver in > rtlwifi_new. I'm currently running the rtlwifi_new based modules, modified with the reduced waits as suggested by PK, as well as removing the IRQ disable from the spinlocks in both rtl8723de_phy_query_rf_reg() and rtl8723de_phy_set_rf_reg(). I can confirm that with those changes rtl8723de no longer shows up my latency traces. Regards, Lucas