Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3675296pxb; Mon, 24 Jan 2022 15:04:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJzQhYhfMQZPozjQnx7bnBB7yzrFtC5IbF/qkYoX0JVdZP0vd6uUOQW0dYMDRi1E08FhgyKZ X-Received: by 2002:aa7:8154:0:b0:4bc:a467:614d with SMTP id d20-20020aa78154000000b004bca467614dmr15661536pfn.48.1643065495316; Mon, 24 Jan 2022 15:04:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643065495; cv=none; d=google.com; s=arc-20160816; b=LSX8lR3VfxmbWugz0kywtzJrSB/qBrKn2iP+scahcR/UgL9tL0/W+pBxEovc7BTvhH 3hrJaj2/lfpDGWTkI7E8sOmOLqdLkgDAXbNLswmkqEEOegnYRP0wQ2oQd5GrQcGOzU6L BYj9Vqd/s7kpgWXy7+WB7NOauD7bujT8q6JPjq3kcgTNuf9yaH89i8cdCJ0U63s6oA6J SZm+ZE4BCw4qKKv5xkYx1Hwb8H/U89C88dikKLb2u98qZYtx2Qgjns+z2biJt12hpILi 6/n539T0aOYCFo0lguFp4kE8b43zTf4KFze5ze7tjC7WSWukPdscbe6Rk+/B7A7mfItp CbkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TeLO2MODF75iWw83xaeb8va7QiuaJG6atfZuw9ZdEWw=; b=n7Af4r4Q286jg4DVbQiN8LFTdNOBI1sNdyyYeJRWWztim8XBuTm3VVCAwt0coYgC+N tKigjFmXMS0aBh9FsnHNg8E5PZpBN5a2J3nFgsp2FAIbIr/LXW/PdLAIOIMANHPAJrfe 9VbUq/TKoLpZZdMWNXrUEMsQCbifSAhvnS/bKy7BYdLyiuqna64fvFf1WXpyWu+Dgo96 k/P+7bfcdf6jGdRXwMglMbNDiXwQO5jFuolRmX0eanZJ8bEuBwHRAkZ0NMUqeJHldf7U t0Tluxwqmwok8eVodtiane12qrlO/O3y6qO1BNhbFhxcwaBlb4oy6mFkokVVP9Eg3exE scKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=f8VSnLj9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id oa11si570129pjb.163.2022.01.24.15.04.43; Mon, 24 Jan 2022 15:04:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=f8VSnLj9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1842034AbiAXXAl (ORCPT + 99 others); Mon, 24 Jan 2022 18:00:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1577807AbiAXWBF (ORCPT ); Mon, 24 Jan 2022 17:01:05 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2750C02B843; Mon, 24 Jan 2022 12:40:35 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7EC7FB81057; Mon, 24 Jan 2022 20:40:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4CD3C340E5; Mon, 24 Jan 2022 20:40:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643056833; bh=tzqPQmB0l/jBnxjNIcccagNcnuy3tZP8oVuJy5/u0uM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f8VSnLj9AKH8FEwgxolXBhKJmhuzxNUdeVDxfV8qzCBzeDI9PVdpIa8rgHyoExfaI MsOLUdLiikSobhK5///xtxbfxqiBtdxDS5chiGJbYaumfwyGpLw2bDGd10tZJbkSb3 We1M1rRCIwZT8a9Ev5iL6evgSSiDKzL+/tPGbzgY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ben Greear , Kalle Valo , Sasha Levin Subject: [PATCH 5.15 583/846] ath11k: Fix napi related hang Date: Mon, 24 Jan 2022 19:41:40 +0100 Message-Id: <20220124184121.158216137@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ben Greear [ Upstream commit d943fdad7589653065be0e20aadc6dff37725ed4 ] Similar to the same bug in ath10k, a napi disable w/out it being enabled will hang forever. I believe I saw this while trying rmmod after driver had some failure on startup. Fix it by keeping state on whether napi is enabled or not. And, remove un-used napi pointer in ath11k driver base struct. Signed-off-by: Ben Greear Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20200903195254.29379-1-greearb@candelatech.com Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath11k/ahb.c | 12 +++++++++--- drivers/net/wireless/ath/ath11k/core.h | 2 +- drivers/net/wireless/ath/ath11k/pci.c | 12 +++++++++--- 3 files changed, 19 insertions(+), 7 deletions(-) --- a/drivers/net/wireless/ath/ath11k/ahb.c +++ b/drivers/net/wireless/ath/ath11k/ahb.c @@ -175,8 +175,11 @@ static void __ath11k_ahb_ext_irq_disable ath11k_ahb_ext_grp_disable(irq_grp); - napi_synchronize(&irq_grp->napi); - napi_disable(&irq_grp->napi); + if (irq_grp->napi_enabled) { + napi_synchronize(&irq_grp->napi); + napi_disable(&irq_grp->napi); + irq_grp->napi_enabled = false; + } } } @@ -300,7 +303,10 @@ static void ath11k_ahb_ext_irq_enable(st for (i = 0; i < ATH11K_EXT_IRQ_GRP_NUM_MAX; i++) { struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; - napi_enable(&irq_grp->napi); + if (!irq_grp->napi_enabled) { + napi_enable(&irq_grp->napi); + irq_grp->napi_enabled = true; + } ath11k_ahb_ext_grp_enable(irq_grp); } } --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h @@ -137,6 +137,7 @@ struct ath11k_ext_irq_grp { u32 num_irq; u32 grp_id; u64 timestamp; + bool napi_enabled; struct napi_struct napi; struct net_device napi_ndev; }; @@ -706,7 +707,6 @@ struct ath11k_base { u32 wlan_init_status; int irq_num[ATH11K_IRQ_NUM_MAX]; struct ath11k_ext_irq_grp ext_irq_grp[ATH11K_EXT_IRQ_GRP_NUM_MAX]; - struct napi_struct *napi; struct ath11k_targ_cap target_caps; u32 ext_service_bitmap[WMI_SERVICE_EXT_BM_SIZE]; bool pdevs_macaddr_valid; --- a/drivers/net/wireless/ath/ath11k/pci.c +++ b/drivers/net/wireless/ath/ath11k/pci.c @@ -632,8 +632,11 @@ static void __ath11k_pci_ext_irq_disable ath11k_pci_ext_grp_disable(irq_grp); - napi_synchronize(&irq_grp->napi); - napi_disable(&irq_grp->napi); + if (irq_grp->napi_enabled) { + napi_synchronize(&irq_grp->napi); + napi_disable(&irq_grp->napi); + irq_grp->napi_enabled = false; + } } } @@ -652,7 +655,10 @@ static void ath11k_pci_ext_irq_enable(st for (i = 0; i < ATH11K_EXT_IRQ_GRP_NUM_MAX; i++) { struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; - napi_enable(&irq_grp->napi); + if (!irq_grp->napi_enabled) { + napi_enable(&irq_grp->napi); + irq_grp->napi_enabled = true; + } ath11k_pci_ext_grp_enable(irq_grp); } }