Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp132013lqb; Tue, 28 May 2024 10:45:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWSlvvo6Zq87m0u/VadbPGaPHq6Ye7KnwKL9EvU4Wg3zwnwv3LiJvm6CggufZy3MYrD/d818HQuqFoz4VVihKYE1EtmJUc6PVD8HFLvog== X-Google-Smtp-Source: AGHT+IGJB2ZW1Nt5dneuHC65wdK6YU+9LEsRzOzIpD299DShPBUidy4GOgEmh8bWCKax6xVVBzJF X-Received: by 2002:a17:906:a1c6:b0:a58:a0b8:2a64 with SMTP id a640c23a62f3a-a626407c693mr849869866b.5.1716918311206; Tue, 28 May 2024 10:45:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716918311; cv=pass; d=google.com; s=arc-20160816; b=PfTLXB6jWGup88yrMKZkg5lTv0+vCw8cW3jolKNxBGp3nmxCcLQ+bXSHwvsPX9YdoH B1JXzIEEB5xZpjePg04LWf5NoLBWAG2v09JZWU0us76YBCcbeah4OOxxcCvgf5bi3+eD n25zQ5ogOabzu1ZTwJS1ILA5dsUSuX1j58dmzmqPkvuq1IYBXtZ1YPcwsllMD6Bi4tmo kLwZcYc/8ifZGxeP/bHsccUSH/a9q51EJgZTtKEH4ZJi2uZixTkzO2Wvpp6MUulud6gt jEx3YNGB74oReR/4kSvQ16Q9+8wbpP2Tw0+DV9drVV/W8zPUL7I3bluispUeebmhT30u epiw== ARC-Message-Signature: i=2; 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=N7USIkEz9VFRzx1ZZBV8sQCBcKUNxWfJqVAwPaQVdf0=; fh=q0pWxAdL0cyDcfHi0eFkTCBsBNeBmItsjEnoI8WnNeM=; b=rdQvNLi30zY5KinfS6ndA1hsCYTszl4Qx2i+bviOZHqF18wlWbEAh7JzPAsfMCx69n y/poYqYJ3Gie0PXujVent8K5VZlpZWObfA+vK7JVqfV1KrWKGiyKhWX+fc5yK1zd5dQZ kU0pMXtdfN/nFkOG9w2V8XhIFVIwB7AkIMFpeMIFKNM/Mv+PiL4L/6cjJtluVO6XTOpE eRKOvuRDzNASLcanDpRcOACLXZiAkYmACJnwQ7J3g9W90B6mpGaqsMtbhEliGRKjGA5i rHr12AnfztMOX+DzBFZqOtGY5dNB0mYB9YnH2JeizbPW0EaGPHSQk1PVJtZFMvLM6VVB A1mw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="S/zPixi1"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-wireless+bounces-8215-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-wireless+bounces-8215-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a626cc69ae4si510236366b.651.2024.05.28.10.45.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 May 2024 10:45:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-8215-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="S/zPixi1"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-wireless+bounces-8215-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-wireless+bounces-8215-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 am.mirrors.kernel.org (Postfix) with ESMTPS id E399D1F20CD6 for ; Tue, 28 May 2024 17:45:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3789B2EAE1; Tue, 28 May 2024 17:45:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="S/zPixi1" 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 13F652E822 for ; Tue, 28 May 2024 17:45:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716918307; cv=none; b=CYqlPePy+JWIAqZAJFMFqDA2p/+sTGZKtQVoMW1BoUUJtS21IQnBXV2dDCQjpSqZOqKFDfsa1/unNJIdIXVF6HpCGQr2oVrilHdcWjbDYstCs0S7e1n1n+zES2E042KCK7aClPW7VGX4+mvjHPl12pGIvR84zR++vY+1quM2rG0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716918307; c=relaxed/simple; bh=092slm6u3SuLv+jBx+DbZLRXByFStQ2yboHpj2kR4tg=; h=Content-Type:MIME-Version:Subject:From:In-Reply-To:References:To: Cc:Message-ID:Date; b=ArKhogVxQQhHOZG99j7hauGcE30Qo56KVRZ8Wg+yao5U71KooI7K/ny17cFQuLY8V5hqCJsfEw63W0/G1DDV/WOauSzoEeZPxhhg9vWUpDqCbai6v6vGsY+zc98KvlnDSgN0gKYp2oAmMCxuZcM0VpjykMHV5kt36jUzyfJ7jjc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=S/zPixi1; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B62EAC32782; Tue, 28 May 2024 17:45:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716918306; bh=092slm6u3SuLv+jBx+DbZLRXByFStQ2yboHpj2kR4tg=; h=Subject:From:In-Reply-To:References:To:Cc:Date:From; b=S/zPixi1pXk6vLG7WdKE46o+AmOJT5wWIEEMce5FZcOcfXitt+pP9hALu1o69UaNY /pp7c2VnvUxJO/7WVW9h4JD/Or3TnRj9aKQyO9J/j/k0yXjMkgjH+jla85vqKIeOAl XbyRBSo2B0qfTbftgPiGaFk1Y27RvPD65Dn1cBvi0IRkAekDLKVOiSOycGjgkSSfD/ F5WSjrGhvOA9Y7mf1OGJj2JO9U0/Oc1nNNWYIcjJtvx+wdi5OXmRNuUzcUpjGrQvsK vuS9huuT5HzJSkZ1DcZAZhrRzslAJbKBPhuwnPO69A7wj5Sia6XqGBD9OBrG9okLWm 9NYbKCjuDNvAQ== 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: ath12k: fix race due to setting ATH12K_FLAG_EXT_IRQ_ENABLED too early From: Kalle Valo In-Reply-To: <20240524023642.37030-1-quic_bqiang@quicinc.com> References: <20240524023642.37030-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: <171691830369.1700985.14695281653028868170.kvalo@kernel.org> Date: Tue, 28 May 2024 17:45:05 +0000 (UTC) Baochen Qiang wrote: > Commit 5082b3e3027e ("wifi: ath11k: fix race due to setting > ATH11K_FLAG_EXT_IRQ_ENABLED too early") fixes a race in ath11k > driver. Since ath12k shares the same logic as ath11k, currently > the race also exists in ath12k: in ath12k_pci_ext_irq_enable(), > ATH12K_FLAG_EXT_IRQ_ENABLED is set before NAPI is enabled. > In cases where only one MSI vector is allocated, this results > in a race condition: after ATH12K_FLAG_EXT_IRQ_ENABLED is set > but before NAPI enabled, CE interrupt breaks in. Since IRQ is > shared by CE and data path, ath12k_pci_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 that > ath12k_pci_ext_grp_napi_poll() will never run, so we have > no chance to call enable_irq() to enable IRQ back. Since IRQ > is shared, all interrupts are disabled and we would finally > get no response from target. > > So port ath11k fix here, this is done by setting > ATH12K_FLAG_EXT_IRQ_ENABLED after all NAPI and IRQ work are > done. With the fix, we are sure that by the time > ATH12K_FLAG_EXT_IRQ_ENABLED is set, NAPI is enabled. > > Note that the fix above also introduce some side effects: > if ath12k_pci_ext_interrupt_handler() breaks in after NAPI > enabled but before ATH12K_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. > > This is found during code review. > > Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 > > Signed-off-by: Baochen Qiang > Acked-by: Jeff Johnson > Signed-off-by: Kalle Valo Patch applied to ath-next branch of ath.git, thanks. 0a993772e0f0 wifi: ath12k: fix race due to setting ATH12K_FLAG_EXT_IRQ_ENABLED too early -- https://patchwork.kernel.org/project/linux-wireless/patch/20240524023642.37030-1-quic_bqiang@quicinc.com/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches