Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp463366rdb; Thu, 30 Nov 2023 09:10:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IGzpEDAbjIOML1VG78QHMnVBiJ8qy5DVkTyMSBRbKaVKWWfcjAMBxXA4ZohxfkYeIVObC8E X-Received: by 2002:a17:902:b194:b0:1cf:fc8f:3fb6 with SMTP id s20-20020a170902b19400b001cffc8f3fb6mr8024928plr.17.1701364227991; Thu, 30 Nov 2023 09:10:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701364227; cv=none; d=google.com; s=arc-20160816; b=QETiJmRNCqdgZ1Cb/erRaiMvdujeXbu9KEFiwBv1y01Qw1lMHy/U4VggaE+m75CMu7 Jj3ktr2sb6amEFdl19WoyuGpXt+7WcmYAvWAOfLld0t/kpsUc+T4aAXe1xDBhWwk+x3e YagRlCiqsc59v3UdlJM6s4KC8JKwV1u/uShjI58dObc+G18q4cnVcFZwHEkQj6o3l6q5 iErxotsA+dRYG4B1xP+ay+fqBxizs+StFubS8zs1ghH/RXDznd9zH6RhAhWnK6+SEDUe U2CQMbr6d2jyKtSJuEJ/ZF25W4kVPX0MXj7oGgCsgW9ze8xwBAHPopKJHgXmvDZbAWa0 ZsJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=date:message-id:user-agent:cc:to:references:in-reply-to:from :subject:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:dkim-signature; bh=CktGUsq+wK/hwncTI67Qpo0rKrrhNGNq9dC4+0Zc2hY=; fh=MZyShLgMg7p4A+etc9WDHDSDT5SGpdoY5scRfMt1KHE=; b=gSvK13mTU3Kx7zlNOXKlS/vYdE8060VhqcRhjF+YtwGnR0az7EAclBSoKwRDHPmAjA LH+ZfK6I6obmPKdXyMmnWdx0qZcd5p0LNOf1fxbJ0g1wIpHZUSZio9C5C37Fho1PqAj+ ELZkUrEv+CjpvY0W6+rbRJ6wu0LunHD8Rj+mtpXlqiwJAZ+WAHULoh6XNKwJEOdmK9zD 3WW1GDF6B7+Z67kfznRWIdUuISRaPjpBNSk1mzZKmjiD1R+x61MsdsplXKp0JNcFRBlZ pP8uOMgp/l1mt0t0sij8HqljcJYragjizTpxteDxatQPMEwUp0enYcwaEBjJKmDTMgGf IhWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jR8u7t7a; spf=pass (google.com: domain of linux-wireless+bounces-240-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-240-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id h9-20020a170902f54900b001c9c967e77esi1626096plf.207.2023.11.30.09.10.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 09:10:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-240-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jR8u7t7a; spf=pass (google.com: domain of linux-wireless+bounces-240-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-240-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 7E091281B35 for ; Thu, 30 Nov 2023 17:04:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 87DE155C16; Thu, 30 Nov 2023 17:04:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jR8u7t7a" X-Original-To: linux-wireless@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6C8073C694 for ; Thu, 30 Nov 2023 17:04:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2B4D0C433C8; Thu, 30 Nov 2023 17:04:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701363857; bh=ipXSh/47UcjI7Ptig4SmC42fd/0Qp8rZuv+bGMrBgcA=; h=Subject:From:In-Reply-To:References:To:Cc:Date:From; b=jR8u7t7aBFWqzXOYDrYeVfpARImQWmqDnT1qpDCH/K/EMomW1Yzh2fL20gC9ZMIFs muq4+WrtATJQlcPmaHJiHHddOAmHb4xNb8rSRgEQVYd7BrMNNRFrkBBdY8qOEj361H 2EbofQIUPLLl5xqnnmct+lQRyi8g/tJwyXVqbv+v2Qf2yGcdCj8OmNZX4X5uSnBO/i v8VZE5ReMMXLve96exbJwDcsix+uuhRVcVGIZqo97/gYo6xiO5Flkkr7x7hFMG+yKI i56C2F8lC8kAfjTBxX/XUGfSsPUzmFKXO2tUmsYp0TtYQrbITit2eqRkR87BH4gJWM osHR84mR5wGEg== Content-Type: text/plain; charset="utf-8" Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [PATCH] wifi: ath11k: fix race due to setting ATH11K_FLAG_EXT_IRQ_ENABLED too early From: Kalle Valo In-Reply-To: <20231117003919.26218-1-quic_bqiang@quicinc.com> References: <20231117003919.26218-1-quic_bqiang@quicinc.com> To: Baochen Qiang Cc: , User-Agent: pwcli/0.1.1-git (https://github.com/kvalo/pwcli/) Python/3.11.2 Message-ID: <170136385394.1435047.15668793291905859073.kvalo@kernel.org> Date: Thu, 30 Nov 2023 17:04:16 +0000 (UTC) Baochen Qiang wrote: > We are seeing below error randomly in the case where only > one MSI vector is configured: > > kernel: ath11k_pci 0000:03:00.0: wmi command 16387 timeout > > The reason is, currently, in ath11k_pcic_ext_irq_enable(), > ATH11K_FLAG_EXT_IRQ_ENABLED is set before NAPI is enabled. > This results in a race condition: after > ATH11K_FLAG_EXT_IRQ_ENABLED is set but before NAPI enabled, > CE interrupt breaks in. Since IRQ is shared by CE and data > path, ath11k_pcic_ext_interrupt_handler() is also called > where we call disable_irq_nosync() to disable IRQ. Then > napi_schedule() is called but it does nothing because NAPI > is not enabled at that time, meaning > ath11k_pcic_ext_grp_napi_poll() will never run, so we have > no chance to call enable_irq() to enable IRQ back. Finally > we get above error. > > Fix it by setting ATH11K_FLAG_EXT_IRQ_ENABLED after all > NAPI and IRQ work are done. With the fix, we are sure that > by the time ATH11K_FLAG_EXT_IRQ_ENABLED is set, NAPI is > enabled. > > Note that the fix above also introduce some side effects: > if ath11k_pcic_ext_interrupt_handler() breaks in after NAPI > enabled but before ATH11K_FLAG_EXT_IRQ_ENABLED set, nothing > will be done by the handler this time, the work will be > postponed till the next time the IRQ fires. > > Tested-on: WCN6855 hw2.1 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.23 > > Signed-off-by: Baochen Qiang > Acked-by: Jeff Johnson > Signed-off-by: Kalle Valo Patch applied to ath-next branch of ath.git, thanks. 5082b3e3027e wifi: ath11k: fix race due to setting ATH11K_FLAG_EXT_IRQ_ENABLED too early -- https://patchwork.kernel.org/project/linux-wireless/patch/20231117003919.26218-1-quic_bqiang@quicinc.com/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches