Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2378534rwl; Thu, 30 Mar 2023 09:27:52 -0700 (PDT) X-Google-Smtp-Source: AKy350YSueXMjQTN8pd/6kCiBEJqHrq+Z21A7UyG2o0TyNDt6a6O9OYSKEdrxPQAEacniFUOpdOa X-Received: by 2002:a17:906:b74f:b0:92d:591f:6586 with SMTP id fx15-20020a170906b74f00b0092d591f6586mr24316769ejb.34.1680193672762; Thu, 30 Mar 2023 09:27:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680193672; cv=none; d=google.com; s=arc-20160816; b=WNcdWBC/VI/diH9VbRvRxtpqWO94+NqHKFHf3N1HRDeBsBgkagCFvN8Be9AYkPXn1T VPAzwmU2+A4gChtSLgVDpf7bx3WRM7EuIIqoUo0c2XSfPCpFZQa2VWHqi8Ut7rSu+U4F 6EYF5ir3U7FWQ2mniSllADVREUJrchSecMrSdlcS3mkHuiVwQSJ6Ema4iAbiBik4dNjU s5Knyg/pjYswvvCMjshcTNMprKqcjhMPiOy+li0g5c4nxDXLazMREPAfgNuvmLp/lXk7 7wFp28Uxt+UQPZtTPvz99LbhgUf1bcxxAon4519iSQ+k8GVWG0TbHYn4i7gBg84HvTIW t30w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:ui-outboundreport:content-transfer-encoding :mime-version:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=30Uh4PvypW7pFPhupLYA/B1DbC2Txz7uj8FGngWB25Y=; b=iM5pxmexU9Wra5145W4ogzlKnrGB9NjaHaPNEOhgWxzqfp7Wp+9RZoltMyVifbZycm ZEArtsMzW2HhSZujOVdvCDK7V8it1yvA+QpFCPMUpNBvJUWxpMIoYyyoTHwCDcROXj7R dnrPxucKz55TAQaN6hD4YiSnrbVF7HK1KJJC251iQrpmh+fVyUCquKPANZMrSHjEAWRG P4nGHXMNTe8aL/6c8jECXFkhW9Q1QHlQ13fMFUqhbCKEt0Avc2nNyqgEidVVFO9faTsr AA2BgsG7hu1c+6+xPMhhTOnAKGtmWCDDg1mCHxW7ibMYWFM+Rj0cyYji1WGjG6HW6ce6 drww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.net header.s=s31663417 header.b=BeWTn04r; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmx.net Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rh2-20020a17090720e200b00931d85fced8si7017ejb.638.2023.03.30.09.26.57; Thu, 30 Mar 2023 09:27:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.net header.s=s31663417 header.b=BeWTn04r; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmx.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230079AbjC3QMr (ORCPT + 59 others); Thu, 30 Mar 2023 12:12:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230224AbjC3QMq (ORCPT ); Thu, 30 Mar 2023 12:12:46 -0400 Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 609B3D53F for ; Thu, 30 Mar 2023 09:12:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=s31663417; t=1680192699; i=ps.report@gmx.net; bh=R1MKpNLk57oHIJUk4XQaSwCwGBdciofprJffbKefGxE=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:In-Reply-To:References; b=BeWTn04rqVc3+7RWHBM7zvk5zh+pNGzl7OQcPeYbzcMpXJbxMuMtcR58/NjAqitxH s5jOMtRnQost9GhfknbCxNnUMaaFOLOHvTwmtt/uIo009MtjktszkVZX1gkVDdxAmD 6FAxOF3EVj3esMYIl6J7H3SfA8rxThOE2axXeeXx9l4hPklZGQ9sN00PRJ2HZ2hPCY nsK2YrzjgbGgJ2n3Xw+o1epKqyyDpAhXJSgwE/tC2yhh6x1IjvA84PO0rPnKFtVcul 8Kt9FTZ+xoYy1UhiaLwAiV0mccEo1logGAKCIBRkKrJ2/LGtGeYV0Hi/I85edKmh+8 yI+AAe0YVmxeg== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from localhost ([62.216.208.135]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MvK0X-1qYN0E11Np-00rHUY; Thu, 30 Mar 2023 18:11:39 +0200 Date: Thu, 30 Mar 2023 18:11:38 +0200 From: Peter Seiderer To: Gregg Wonderly Cc: Toke =?UTF-8?B?SMO4aWxhbmQtSsO4cmdlbnNlbg==?= , linux-wireless@vger.kernel.org Subject: Re: shift exponent 35 is too large @ ath/ath9k/ar9003_hw.c:1147 Message-ID: <20230330181138.5a881d19@gmx.net> In-Reply-To: <27B86217-CA79-4E4A-842B-9B2341B48B13@seqtechllc.com> References: <87cz5079p1.fsf@toke.dk> <27B86217-CA79-4E4A-842B-9B2341B48B13@seqtechllc.com> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.37; x86_64-suse-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:pWmrVvjzkodlL1ngB5/Pf97FJpD0QMY3+K/1Zf66AMoyWPRFgnJ KjI4mVr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If0ziwKLVYamd/a00BMB4mG+yZ4ZHHDa+B0z2 YnqlVU43h5VVuL7j1aX+1w3qjvEkfLP1ueqe3TcRxFwfE9VPFFuj/fg+UPAIsnucNzYG3yBvn UG/ViUTZ0BGfHVqfhSH9FC+Fbf4= X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Hello Gregg, Toke, On Thu, 30 Mar 2023 08:44:25 -0500, Gregg Wonderly wrote: > I have not tested this. I am in the middle of testing on this machine of= many other things and building a kernel right now is not on my timeline. = Note that I have a magic 6 constant in there. I derived this from dividing= 32 by the bit mask 0x1f width of 5. But looking further at this, it seems= like chk_dbg should actually be a u64, and dma_dbg_4 and dma_dbg_5 placed = into that value as a continuous 64bit value. But again, I don=E2=80=99t kn= ow if there are 2 bits at the top of dma_dbg_4 and 3 bits at the bottom of = dma_dbg_5 that go together. This needs to be fixed by someone with the time= and the knowledge of what=E2=80=99s going on in the hardware. The comment from drivers/net/wireless/ath/ath9k/ar9003_hw.c only some lines above seems to support your reasoning (for the '6' constant, not for the packaging into an u64 - bit 30-31 unused): 1073 /* =20 1074 * MAC HW hang check 1075 * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 1076 * 1077 * Signature: dcu_chain_state is 0x6 and dcu_complete_state is 0x1. 1078 * 1079 * The state of each DCU chain (mapped to TX queues) is available from= these 1080 * DMA debug registers: 1081 * =20 1082 * Chain 0 state : Bits 4:0 of AR_DMADBG_4 1083 * Chain 1 state : Bits 9:5 of AR_DMADBG_4 1084 * Chain 2 state : Bits 14:10 of AR_DMADBG_4 1085 * Chain 3 state : Bits 19:15 of AR_DMADBG_4 1086 * Chain 4 state : Bits 24:20 of AR_DMADBG_4 1087 * Chain 5 state : Bits 29:25 of AR_DMADBG_4 1088 * Chain 6 state : Bits 4:0 of AR_DMADBG_5 1089 * Chain 7 state : Bits 9:5 of AR_DMADBG_5 1090 * Chain 8 state : Bits 14:10 of AR_DMADBG_5 1091 * Chain 9 state : Bits 19:15 of AR_DMADBG_5 1092 * =20 1093 * The DCU chain state "0x6" means "WAIT_FRDONE" - wait for TX frame t= o be done. 1094 */ =20 But with the same/similar bug some lines below (dma_dbg_chain is AR_DMADBG_4 for queue < 6 and AR_DMADBG_5 above): 1112 dcu_chain_state =3D (dma_dbg_chain >> (5 * queue)) & 0= x1f; Regards, Peter >=20 > Gregg Wonderly >=20 > > On Mar 22, 2023, at 4:33 PM, Toke H=C3=B8iland-J=C3=B8rgensen wrote: > >=20 > > Gregg Wonderly writes: > > =20 > >> I am receiving a console error message from this driver that appears t= o be in the following function. In this function, the chk_dbg variable is = 32bits and there is logic that seems to attempt to select from 1 of 2 diffe= rent 32bit values to get a 64bit wide mask value into chk_dbg from dma_dbg_= 4 or dmc_dbg_5. > >>=20 > >> The problem is that the (5*i) shift count should be have i adjusted by= the 6 limit used to make the check for which dma_dbg_[45] value selected. > >>=20 > >>=20 > >> static bool ar9003_hw_detect_mac_hang(struct ath_hw *ah) > >> { > >> u32 dma_dbg_4, dma_dbg_5, dma_dbg_6, chk_dbg; > >> u8 dcu_chain_state, dcu_complete_state; > >> bool dcu_wait_frdone =3D false; > >> unsigned long chk_dcu =3D 0; > >> unsigned int i =3D 0; > >> dma_dbg_4 =3D REG_READ(ah, AR_DMADBG_4); > >> dma_dbg_5 =3D REG_READ(ah, AR_DMADBG_5); > >> dma_dbg_6 =3D REG_READ(ah, AR_DMADBG_6); > >> dcu_complete_state =3D dma_dbg_6 & 0x3; > >> if (dcu_complete_state !=3D 0x1) > >> goto exit; > >> for (i =3D 0; i < ATH9K_NUM_TX_QUEUES; i++) { > >> if (i < 6) > >> chk_dbg =3D dma_dbg_4; > >> else > >> chk_dbg =3D dma_dbg_5; > >> dcu_chain_state =3D (chk_dbg >> (5 * i)) & 0x1f; > >> if (dcu_chain_state =3D=3D 0x6) { > >> dcu_wait_frdone =3D true; > >> chk_dcu |=3D BIT(i); > >> } > >> } > >> if ((dcu_complete_state =3D=3D 0x1) && dcu_wait_frdone) { > >> for_each_set_bit(i, &chk_dcu, ATH9K_NUM_TX_QUEUES) { > >> if (ath9k_hw_verify_hang(ah, i)) > >> return true; > >> } > >> } > >> exit: > >> return false; > >> } > >>=20 > >> The for loop seems to need to look like the following: > >>=20 > >> for (i =3D 0; i < ATH9K_NUM_TX_QUEUES; i++) { > >> int off=3Di; > >> if (i < 6) { > >> chk_dbg =3D dma_dbg_4; > >> } else { > >> chk_dbg =3D dma_dbg_5; > >> off =3D i - 6; > >> } > >> dcu_chain_state =3D (chk_dbg >> (5 * off)) & 0x1f; > >> if (dcu_chain_state =3D=3D 0x6) { > >> dcu_wait_frdone =3D true; > >> chk_dcu |=3D BIT(i); > >> } > >> } > >> =20 > >=20 > > Did you test this? Please send a proper patch :) > >=20 > > -Toke =20 >=20