Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp212366rwb; Tue, 6 Dec 2022 19:51:11 -0800 (PST) X-Google-Smtp-Source: AA0mqf6nprtZxD9kQoSbRGKGeMmikhkV4d5UCrV7cK4JXBCiwVlNLiJqcaxcPXpmWW5X2U/ZqjTf X-Received: by 2002:a17:906:fc3:b0:7c0:a880:dc71 with SMTP id c3-20020a1709060fc300b007c0a880dc71mr24395510ejk.705.1670385071529; Tue, 06 Dec 2022 19:51:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670385071; cv=none; d=google.com; s=arc-20160816; b=rGRz2MR7hu+e0O4p+Fiy9aGaLCUhO2FJRfzhZyPAdQAKoLrcu7KM03RGvbwjDFnrtC SQiksTAhE7YoT5FRXSMWwu60y5lNEs4RvKVc7ynTh59gpNnnQu4KsfXQ5cGI3XyKHEfj A1xVAdJss/sUC3OJxi8UsS18lEjuvAwEP9DkJmakHS27kNZZ/bvHQZiBkjDMq3yuWUhM Fm0hiPIyuTYnGWM/nRTRVgQ1F98LyxMSGKuXxpQXbVm1kl1qJY5YAWlTIJD5VVtfHTFU eLeDBp4cZSza5uAVP6noBbgHD7nuO3EWcIVlWVu1JprekTAGugPnQB8e/25mejfURAJ8 ScSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=Q51D8IOHD02ClPUN6AzM15ooyQjEfmnU2ORqkvPuC1s=; b=DRpfDpThUAsyjJS9Q0fqxD5uvJIf3UaS0hpdaao8YziGbbC/LLeEeJajeV5B55zlN/ Ld+EagXgWhqSRdJzyxRnTaURdM0STVXoSNdPdD05erCSdurKJbDhg0vewnNNNsGbWmm6 Ow+9CFOoJ61NFWK3QWWPjwZP5+K32n986svDVfC9vw/GCJZEAcGz78mjDftYMexcfdHq YZIvH68Y5h54Z/bx47aRDJsahSy1Vz8PgarF+moe7HdDvf7jaR1/MU3w5U4vj6z1WsQR x3KnGrPa6K+6PrmRaq3HNoqj5zsDarAVsFJ83ZFLC/jNoQw/duyo2rvDd9Dwxr945UZ7 HHTA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dr21-20020a170907721500b007ae84881ebasi14363474ejc.505.2022.12.06.19.50.54; Tue, 06 Dec 2022 19:51:11 -0800 (PST) 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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229544AbiLGDor (ORCPT + 66 others); Tue, 6 Dec 2022 22:44:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229475AbiLGDoq (ORCPT ); Tue, 6 Dec 2022 22:44:46 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E091B57 for ; Tue, 6 Dec 2022 19:44:45 -0800 (PST) Received: from dggpemm500007.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4NRjjY4QmbznTdX; Wed, 7 Dec 2022 11:40:33 +0800 (CST) Received: from [10.174.178.174] (10.174.178.174) by dggpemm500007.china.huawei.com (7.185.36.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 7 Dec 2022 11:44:13 +0800 Subject: Re: [PATCH resend 1/3] rtlwifi: rtl8821ae: don't call kfree_skb() under spin_lock_irqsave() To: Ping-Ke Shih , "kvalo@kernel.org" CC: "linux-wireless@vger.kernel.org" , References: <20221206131249.2181693-1-yangyingliang@huawei.com> <20221206131249.2181693-2-yangyingliang@huawei.com> <758b8caa9e8243bb84471baf50706e6d@realtek.com> From: Yang Yingliang Message-ID: Date: Wed, 7 Dec 2022 11:44:12 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <758b8caa9e8243bb84471baf50706e6d@realtek.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Originating-IP: [10.174.178.174] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm500007.china.huawei.com (7.185.36.183) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 On 2022/12/7 11:31, Ping-Ke Shih wrote: >> -----Original Message----- >> From: Yang Yingliang >> Sent: Tuesday, December 6, 2022 9:13 PM >> To: Ping-Ke Shih ; kvalo@kernel.org >> Cc: linux-wireless@vger.kernel.org; yangyingliang@huawei.com >> Subject: [PATCH resend 1/3] rtlwifi: rtl8821ae: don't call kfree_skb() under spin_lock_irqsave() >> >> It is not allowed to call kfree_skb() from hardware interrupt >> context or with interrupts being disabled. So add all skb to >> a free list, then free them after spin_unlock_irqrestore() at >> once. > The patch doesn't change logic, so it should work. But, I would like to know > if there is a comment about this in kernel code. Could you point it out? You can see comment of dev_kfree_skb_irq() in include/linux/netdevice.h https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/netdevice.h?h=v6.1-rc8 Thanks, Yang > >> Fixes: 5c99f04fec93 ("rtlwifi: rtl8723be: Update driver to match Realtek release of 06/28/14") >> Signed-off-by: Yang Yingliang >> --- >> drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c | 6 +++++- >> 1 file changed, 5 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c >> b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c >> index 7e0f62d59fe1..a7e3250957dc 100644 >> --- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c >> +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c >> @@ -26,8 +26,10 @@ static void _rtl8821ae_return_beacon_queue_skb(struct ieee80211_hw *hw) >> struct rtl_priv *rtlpriv = rtl_priv(hw); >> struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); >> struct rtl8192_tx_ring *ring = &rtlpci->tx_ring[BEACON_QUEUE]; >> + struct sk_buff_head free_list; >> unsigned long flags; >> >> + skb_queue_head_init(&free_list); >> spin_lock_irqsave(&rtlpriv->locks.irq_th_lock, flags); >> while (skb_queue_len(&ring->queue)) { >> struct rtl_tx_desc *entry = &ring->desc[ring->idx]; >> @@ -37,10 +39,12 @@ static void _rtl8821ae_return_beacon_queue_skb(struct ieee80211_hw *hw) >> rtlpriv->cfg->ops->get_desc(hw, (u8 *)entry, >> true, HW_DESC_TXBUFF_ADDR), >> skb->len, DMA_TO_DEVICE); >> - kfree_skb(skb); >> + __skb_queue_tail(&free_list, skb); >> ring->idx = (ring->idx + 1) % ring->entries; >> } >> spin_unlock_irqrestore(&rtlpriv->locks.irq_th_lock, flags); >> + >> + __skb_queue_purge(&free_list); >> } >> >> static void _rtl8821ae_set_bcn_ctrl_reg(struct ieee80211_hw *hw, >> -- >> 2.25.1 >> >> >> ------Please consider the environment before printing this e-mail. > .