Received: by 2002:a05:7412:f589:b0:e2:908c:2ebd with SMTP id eh9csp1012070rdb; Wed, 1 Nov 2023 08:58:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGsvdNgsxlA3/4U3ypDsFXY9xaQG+Y6987SgNLTTYZ4Nc3lJBvyzKaSJ5jeEetHz1IB5uJ1 X-Received: by 2002:a05:6358:6f9a:b0:168:e843:9000 with SMTP id s26-20020a0563586f9a00b00168e8439000mr18017184rwn.26.1698854303116; Wed, 01 Nov 2023 08:58:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698854303; cv=none; d=google.com; s=arc-20160816; b=Zyf+cWVV2a9zZBj+Tv9zsYj76mZ4JcCAei2cbCExUkITIb0KX7fQSMqFNMIr+fpw52 wkUkrLJTfiT3ppt3tJPVvQnFGy7kdhPvdq2zOvlC06VLwW7jN9xSu4JmDzEe2m2lxg7F Ey3nsLlNn01FlxlrSrFbUtWvp20b8EZvAUHIHLEiajmtut9aNoVJYgVKtCU2FOkV/cRV wBWvCIpJHaD8Hzju1nxpFRKebFKaeXYN++Hzihkxu658D4oMqGTxazJm2NnN5NXl/bD+ 49KC4vVrNEHCD/yIKCf91gm90cREssr4O7EJ9p+1x6KhLLSzM4LjDTWZcIEdNG5K9fG9 4lHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=SLE5umc1+C++7OiQgwNSEy1l0uUJaxk0dXwHnUQQcLc=; fh=SD4K7KmCML1+E0vFwaF/iLKcDofeTwI30iqim53dMks=; b=T1zTsrcYc4OSNK7fHuZKsfZr3SjitYOnNApjn7VK637fngidW6qjXShq1hoD3gZ6E+ EMDaVdWMM1mXTr44VOSxyJOVX/OBQaqzCctg9af0dm8nw8ao86SOm8M3Cqsb+HUcFk+X ritIm/KLyT10fCFX6aoxw/CBvMuba39g2t3PzCrPLvacsgbcrabVqSHS+ZGyA9D0o8SA TVQjui3U6Ygcma9pDQi5hwM1mikx/k+0kBwS2Gm9QWXn6Ju5WryX758olukTB0otSzuz BNNzYIwJsqoZO1PjkzugByRFVF3H2orMVGgRGao8/4+jgKzZwh5YdbzrzL54FAYAV+M6 delw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@wp.pl header.s=1024a header.b=qKhWrrdr; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wp.pl Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id r22-20020a632b16000000b0059c02d055c4si132481pgr.668.2023.11.01.08.57.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Nov 2023 08:58:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@wp.pl header.s=1024a header.b=qKhWrrdr; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wp.pl Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id C6CFB80CA0AB; Wed, 1 Nov 2023 08:57:50 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232966AbjKAP5J (ORCPT + 52 others); Wed, 1 Nov 2023 11:57:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232720AbjKAP5I (ORCPT ); Wed, 1 Nov 2023 11:57:08 -0400 Received: from mx4.wp.pl (mx4.wp.pl [212.77.101.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 040F6102 for ; Wed, 1 Nov 2023 08:57:01 -0700 (PDT) Received: (wp-smtpd smtp.wp.pl 5876 invoked from network); 1 Nov 2023 16:56:56 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wp.pl; s=1024a; t=1698854216; bh=SLE5umc1+C++7OiQgwNSEy1l0uUJaxk0dXwHnUQQcLc=; h=From:To:Cc:Subject; b=qKhWrrdrO6NNRWXdUUmLyoaE7Zgjzf8qxszx4tn4vq2UQt1AToFZG+BVraFCeOS4i ESVuY8Bs6/oZWbGaAAvd9mTKWfnfFsgqjGfqkpe/zUcZer+CqXxzoCJhIKr+djQbJQ DQ0bE++dHemJ6wIIfxSdRxQ8ySrRhhnzI+v9XWT4= Received: from 89-64-13-175.dynamic.chello.pl (HELO localhost) (stf_xl@wp.pl@[89.64.13.175]) (envelope-sender ) by smtp.wp.pl (WP-SMTPD) with ECDHE-RSA-AES256-GCM-SHA384 encrypted SMTP for ; 1 Nov 2023 16:56:56 +0100 Date: Wed, 1 Nov 2023 16:56:55 +0100 From: Stanislaw Gruszka To: Shiji Yang Cc: linux-wireless@vger.kernel.org, Kalle Valo Subject: Re: [PATCH 1/3] wifi: rt2x00: introduce DMA busy check watchdog for rt2800 Message-ID: <20231101155655.GA559463@wp.pl> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-WP-MailID: 7a02cafabffdd6aeaf20f3a457b528de X-WP-AV: skaner antywirusowy Poczty Wirtualnej Polski X-WP-SPAM: NO 0000000 [EWP0] X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 01 Nov 2023 08:57:50 -0700 (PDT) On Sat, Oct 28, 2023 at 08:15:30PM +0800, Shiji Yang wrote: > When I tried to fix the watchdog of rt2800, I found that sometimes > the watchdog could not reset the hung device. This is because the > queue did not completely stop, it just became very slow. The Mediatek > vendor driver for the new chips (MT7603/MT7612) has a DMA busy > watchdog to detect device hangs by checking DMA busy status. This > implementation is something similar to it. To reduce unnecessary > watchdog reset, we can check the INT_STATUS register together as I > found that when the radio hung, the RX/TX coherent interrupt will > always stuck at triggered state. > > This patch also changes the watchdog module parameters to the new > 'hang_watchdog' and 'dma_busy_watchdog' so that we can control them > separately. That's because they may have different behavior on > specific chip. > > This watchdog function is a slight schedule and it won't affect the > WiFi transmission speed. Watchdog can help the driver automatically > recover from the abnormal state. So I think it should be default on. > Anyway it can be disabled by module parameter 'dma_busy_watchdog=0'. > > Tested on MT7620 and RT5350. I think this will not work on USB as INT_SOURCE_CSR is mmio/pci specific. Did you tested on USB ? Or this is disabled for USB by default? > Signed-off-by: Shiji Yang > --- > .../net/wireless/ralink/rt2x00/rt2800lib.c | 81 ++++++++++++++++--- > drivers/net/wireless/ralink/rt2x00/rt2x00.h | 3 + > 2 files changed, 72 insertions(+), 12 deletions(-) > > diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c > index 594dd3d9f..6ca2f2c23 100644 > --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c > +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c > @@ -30,9 +30,15 @@ > #include "rt2800lib.h" > #include "rt2800.h" > > -static bool modparam_watchdog; > -module_param_named(watchdog, modparam_watchdog, bool, S_IRUGO); > -MODULE_PARM_DESC(watchdog, "Enable watchdog to detect tx/rx hangs and reset hardware if detected"); > +static bool modparam_dma_wdt = true; > +module_param_named(dma_busy_watchdog, modparam_dma_wdt, bool, 0444); > +MODULE_PARM_DESC(dma_busy_watchdog, "Enable watchdog to detect tx/rx" > + " DMA busy and reset hardware if detected"); > + > +static bool modparam_hang_wdt; > +module_param_named(hang_watchdog, modparam_hang_wdt, bool, 0444); > +MODULE_PARM_DESC(hang_watchdog, "Enable watchdog to detect tx/rx hangs" > + " and reset hardware if detected"); Do not have strong opinion here. But please consider to keep old module parameter name and make it bitmask, 1 - hang_wdt, 2 dma_wdt, 3 - both. Such way, it will keep old meaning if someone is using the parameter in script/config. I also wandering if we need two implementations. If dma hang detection is superior, it should replace the old one IMHO. Or queue hang should be used for USB and dma hang for pci/mmio ? Otherwise code looks fine/correct to me. Regards Stanislaw