Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp4595245pxv; Tue, 29 Jun 2021 10:37:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx6XtzdpzLX2/8rPkuqcarsS9E9Z8sj0GXZroL6e+aX06aXmW4o0YljpDVoMecfTVSdsbhg X-Received: by 2002:a02:628b:: with SMTP id d133mr5284223jac.27.1624988252569; Tue, 29 Jun 2021 10:37:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624988252; cv=none; d=google.com; s=arc-20160816; b=dEoJAiqs11c2cs17rD6cBVsHWv6FLEWnzYfqIAaS/AXHybVPEBE5310rGUgBjGkBHD EElauqA4vma0vq/HFUZ1CJjk9JD95tWEvwsvD2qWPznAr87ISG4yLXaHsH+SDC7HfbUG cvtwQnW9WffReMpdKbnhTX1EPFaJdDZl2SPkPTHtPg+XOH20AyY+Km6RMFOs9OrQJXlW FFPCrX5oNO4D81oeDffvXK7LKs5BzEZrngHRFacrt+Iv4KnMzV5bSMJVTEZNpBWy7dh1 rEY5elnvN/bhPuAwLo4IkylxaVwJQRDDTGxn5oHPozf3gByt22ZipTS2V1MS4df/Xc0P 9xXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=TErmZqWBMVcl3qGHU0sym2lQ8P6yQw5zwZrfOKjvNeM=; b=Nm/CcsKFE8KJwholC30hvCvXdCbZgX8B2p6D9JDUheVG4gioBA140W2J54+SGMJFQ9 qxoTCp02oaiaed/7LUllhqH5s86N2FNQ7s4q9XcSMdw2hs11oLaqwJgltWd7F/eLTfkP Vs/x6/xbSJXG4uuB2+lFmx+NZfjz2P5wJHmpjP4y8hfJh6C/TctGsbnz6Ioa31kVzsf5 4paPDnk2zLUM9+BmLr1gMTSUyYQ+eEaqYVbwB8n3gh2mqu/f4StaalPZYt99kK/J3HYh rZ+aucjlyitqpFfn3Zmqp8X3el/2UA01Pdjx+ETWMTljxIY3Q2G2jdRJuF7zrJE7HQYR CCIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=UaQZyFYY; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w4si24313922iov.14.2021.06.29.10.37.19; Tue, 29 Jun 2021 10:37:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=UaQZyFYY; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234171AbhF2RiO (ORCPT + 99 others); Tue, 29 Jun 2021 13:38:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233660AbhF2RiO (ORCPT ); Tue, 29 Jun 2021 13:38:14 -0400 Received: from nbd.name (nbd.name [IPv6:2a01:4f8:221:3d45::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09DA8C061760 for ; Tue, 29 Jun 2021 10:35:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=Content-Transfer-Encoding:Content-Type:In-Reply-To: MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=TErmZqWBMVcl3qGHU0sym2lQ8P6yQw5zwZrfOKjvNeM=; b=UaQZyFYYf8Za7e1vBft+VuhYUE kwFxJED0Q9ugj4dYsNK2F3BwLV5Duasz28jgYW8JN7glxjZirSKB1CMPshZCo+rHol3lYl8fqyW3Z Sc6zFWmVPj6BZh951S36AltGqQGYg2aHhotHod25ryEClJPMnUGq9CbVndPiBUG4ch10=; Received: from p54ae93f7.dip0.t-ipconnect.de ([84.174.147.247] helo=nf.local) by ds12 with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1lyHeB-00088b-Sx; Tue, 29 Jun 2021 19:35:43 +0200 Subject: Re: [PATCH 12/12] ath11k: avoid unnecessary lock contention in tx_completion path To: Jouni Malinen , Kalle Valo Cc: ath11k@lists.infradead.org, linux-wireless@vger.kernel.org, P Praneesh , Karthikeyan Periyasamy References: <20210615211407.92233-1-jouni@codeaurora.org> <20210615211407.92233-13-jouni@codeaurora.org> From: Felix Fietkau Message-ID: Date: Tue, 29 Jun 2021 19:35:43 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210615211407.92233-13-jouni@codeaurora.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On 2021-06-15 23:14, Jouni Malinen wrote: > From: P Praneesh > > Lock is not needed for the readable idr operation, so avoid spin_lock_bh > for the idr_find() call. No need to disable the bottom half preempt if > it is already in bottom half context, so modify the spin_lock_bh to > spin_lock in the data tx completion handler. > > Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.4.0.1-01734-QCAHKSWPL_SILICONZ-1 v2 > > Co-developed-by: Karthikeyan Periyasamy > Signed-off-by: Karthikeyan Periyasamy > Signed-off-by: P Praneesh > Signed-off-by: Jouni Malinen > --- > drivers/net/wireless/ath/ath11k/dp_tx.c | 18 ++++++++---------- > 1 file changed, 8 insertions(+), 10 deletions(-) > > diff --git a/drivers/net/wireless/ath/ath11k/dp_tx.c b/drivers/net/wireless/ath/ath11k/dp_tx.c > index ab9ccf0eb274..659f9d98bc0c 100644 > --- a/drivers/net/wireless/ath/ath11k/dp_tx.c > +++ b/drivers/net/wireless/ath/ath11k/dp_tx.c > @@ -288,19 +288,18 @@ static void ath11k_dp_tx_free_txbuf(struct ath11k_base *ab, u8 mac_id, > struct sk_buff *msdu; > struct ath11k_skb_cb *skb_cb; > > - spin_lock_bh(&tx_ring->tx_idr_lock); > msdu = idr_find(&tx_ring->txbuf_idr, msdu_id); > - if (!msdu) { > + if (unlikely(!msdu)) { > ath11k_warn(ab, "tx completion for unknown msdu_id %d\n", > msdu_id); > - spin_unlock_bh(&tx_ring->tx_idr_lock); > return; > } > > skb_cb = ATH11K_SKB_CB(msdu); > > + spin_lock(&tx_ring->tx_idr_lock); > idr_remove(&tx_ring->txbuf_idr, msdu_id); Why are you doing the lookups twice instead of just using the return value of idr_remove? - Felix