Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp455986rwi; Wed, 12 Oct 2022 23:57:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7sI4L1H2ompxovAB5vS6fR6jrSNq8RbaTjPZgQ9aMSiBwzPaEk0jYAg8J+b98QWUOs66Wb X-Received: by 2002:a65:6bcb:0:b0:44c:3e11:a7ac with SMTP id e11-20020a656bcb000000b0044c3e11a7acmr29285546pgw.274.1665644279273; Wed, 12 Oct 2022 23:57:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665644279; cv=none; d=google.com; s=arc-20160816; b=AC08tDaIfW3atvWC7sB5f9I4YKAI/Ds+jV5YcexsVk+wC7o1n/cB8hMSKDVeXkseOh FllQxLilM4cWpuiyOHcDY6wOBoUxr+uvn2aIJcohyOVb3Kv37QjEkU7gpw7107xacZWR Xy6m65pe9d0MqPNEeYUk11zlakaBHOhfhsgWv+KxgnCf45xXVAAEH1JWhFWUV2oUCE8p JMpbKyeMhB5gaaydSNeyJV1XDOcGOtBHrdNssRHB80mKEZeXitK+tQp1PmhlnTAipDu9 n1/kGlxbRb7iTetRyLCtsksTtRapZWmFsEEzR1WP6Ip/MRMKv5QqSOrylXjv/8jkHvZ2 sp4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=6OIDCA1oxq6p7/yOMy8f8At7MzGN42WTJEdOinTHcQM=; b=oUKKjmIcR/rXs/669IK1VSlGYVgi9GX96VNLQlhZyqTUuvg+FLsyYoRhLc6vScYAlP CNpWIb3shGWpJOBOybLzk6Kuz2zdhzw4CxfkZ/+VMdcjNFGsEWs/05bj1cAGZmUUtQ2L WugzJblmBI67pDlJvbtR3PaJtWFiy+z2fWjIP35mUqxt8zaNHYqCa4hiHCagkS8iSoYJ VJoxI/9PSoRMHoCqLM1V0Bez+MZM58efEUF538WCA76QKy/3pTQ1hSgn0LXzGZAQ9sMl u4SFhHR9c+R1Fsu8T42yeQPcxgtjo+QG+Ez05UfdrBRcXQRX0pAy4g5zlCU240DUm/Sb 6GPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=hA+ExTeu; 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=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e17-20020a170902ef5100b0017a034f7246si20259185plx.560.2022.10.12.23.57.50; Wed, 12 Oct 2022 23:57:59 -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=@quicinc.com header.s=qcppdkim1 header.b=hA+ExTeu; 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=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229492AbiJMGup (ORCPT + 62 others); Thu, 13 Oct 2022 02:50:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229529AbiJMGuk (ORCPT ); Thu, 13 Oct 2022 02:50:40 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43DA11463A9 for ; Wed, 12 Oct 2022 23:50:35 -0700 (PDT) Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 29D6GGxM010972; Thu, 13 Oct 2022 06:50:28 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=qcppdkim1; bh=6OIDCA1oxq6p7/yOMy8f8At7MzGN42WTJEdOinTHcQM=; b=hA+ExTeuAJt0UKXHtF05jL7oSDiG4hIB3CWpEnyTE7TDEDI41KA37wtUUISNRR2EuDWo ygofLqggKhB55id8M5W8wugJMV0ejTDAHvpCuECpzR/6dyIc89ow15uRZHmZF8w2GSIk eRKL3W2Ys1Wa3mRKi2bv2/GrKYyfmpJ5tb8W8N5WXjg/kPy1zZrJjiXspeG54zEkEQjB JalxebA2xu6fX9rKAPvge7gU8fjpYW6YwCwn/XMVeBhpUUSR4XHjZey6t4DJ1dbosdpK umqi0pyiL+CdtFHaGCZR1kfzfQSTgRokHqwgFwddL8wBcRTYNZHE/MP5NNksX9hO7/B8 uA== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3k643h1naf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Oct 2022 06:50:28 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 29D6oS3W015380 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Oct 2022 06:50:28 GMT Received: from [10.110.65.190] (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.29; Wed, 12 Oct 2022 23:50:26 -0700 Message-ID: <0e4a896d-1d57-166b-9cef-fd551d22464b@quicinc.com> Date: Wed, 12 Oct 2022 23:50:25 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.3.3 Subject: Re: [PATCH 15/50] wifi: ath12k: add dp_rx.c Content-Language: en-US To: "Sriram R (QUIC)" , Kalle Valo , "linux-wireless@vger.kernel.org" CC: "ath12k@lists.infradead.org" References: <20220812161003.27279-1-kvalo@kernel.org> <20220812161003.27279-16-kvalo@kernel.org> From: Jeff Johnson In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: ZfZfgKTE4KW6dIJtnrv5LdK_bOkNHupZ X-Proofpoint-ORIG-GUID: ZfZfgKTE4KW6dIJtnrv5LdK_bOkNHupZ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-13_04,2022-10-12_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 mlxscore=0 adultscore=0 suspectscore=0 spamscore=0 bulkscore=0 phishscore=0 impostorscore=0 mlxlogscore=569 clxscore=1015 malwarescore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210130041 X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_LOW, 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 10/12/2022 4:39 PM, Sriram R (QUIC) wrote: >>> + elem = kzalloc(sizeof(*elem), GFP_ATOMIC); >>> + if (!elem) >>> + goto free_desc; >>> + >>> + elem->ts = jiffies; >>> + memcpy(&elem->data, rx_tid, sizeof(*rx_tid)); >>> + >>> + spin_lock_bh(&dp->reo_cmd_lock); >>> + list_add_tail(&elem->list, &dp->reo_cmd_cache_flush_list); >>> + dp->reo_cmd_cache_flush_count++; >>> + >>> + /* Flush and invalidate aged REO desc from HW cache */ >>> + list_for_each_entry_safe(elem, tmp, &dp->reo_cmd_cache_flush_list, >>> + list) { >>> + if (dp->reo_cmd_cache_flush_count > >> ATH12K_DP_RX_REO_DESC_FREE_THRES || >>> + time_after(jiffies, elem->ts + >>> + >> msecs_to_jiffies(ATH12K_DP_RX_REO_DESC_FREE_TIMEOUT_MS))) { >>> + list_del(&elem->list); >>> + dp->reo_cmd_cache_flush_count--; >>> + spin_unlock_bh(&dp->reo_cmd_lock); >>> + >>> + ath12k_dp_reo_cache_flush(ab, &elem->data); >>> + kfree(elem); >>> + spin_lock_bh(&dp->reo_cmd_lock); >> >> is this really a safe iteration if you unlock & lock in the middle? >> what prevents the tmp node from being deleted during this window? > The reo_cmd_cache_flush_list is used in only two contexts, one is this > Function called from napi and the other in ath12k_dp_free during > core destroy. Before dp_free, the irqs would be disabled and would wait > synchronize. Hence there wouldn’t be any race against add or delete > to this list. Please let me know if that’s fine. please add that as a code comment since unlock/do something/lock is a "code smell" so you should justify the smell