Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2061473pxb; Thu, 11 Feb 2021 03:26:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJwrdiV5esEWyypr3fyfNwZHxwmGy5/ZEWFii+BosvYcONdPzHFU6sGOILfp/EMK8LCsPVre X-Received: by 2002:a17:906:7fca:: with SMTP id r10mr8090235ejs.242.1613042774864; Thu, 11 Feb 2021 03:26:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613042774; cv=none; d=google.com; s=arc-20160816; b=bJ3PE2FyjdTWm3sTfG+iQYT0ahweQpasS4s+QEUgtHWLEhaDI3U+wpNLv1KbZtJiLK NX38LsYSmH7BK7IlFUVnlzsdmS8b9CMEQ8Hl7WAEXxRaRX0iccW3okvSAYjVW8oCbfJ3 M/5AMKqhKdH/+sWziKANEL94+cmV0yIHf5860k4S7QVu0qMnHkJWENJEgPOXz3Os2IWk 5ywlrb68zLf0+uGr35gbobIUM+OvGn5tM53+l5sOoxHrHfLTbfiXhlD2rjdiFSJ4ee+4 q484dZN2AJrWkaTDmFLrOrYxO60vMvKZbZReMVPNPvZO9JuvZ8R111SLf1qhcIQJR7jy AXPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:in-reply-to :date:references:subject:cc:to:from:dmarc-filter:sender :dkim-signature; bh=ZMVEw+T1+2jFNHRLIczmtfsy/CV7EDResuKLWZr1Ipo=; b=yAzGYzERO50DC211kxvgHuKVAccS3W1ufuxY/oX9WKJqIw2XPCfVVzCmfrOwA1VZRl 22k8VFRLS1HGUN36iabfETRAlXZh7xqqgk6tezGkrMW2Y5ouFEX8/2qsJIRkaA+g8mmh Mu+U7l9ILaKKwYGuUO/nrXJq4njxnEqO7U59NvA5kRYV/jaLv8tDWCatsFVZMElg3gsh EBxRZLumvVlTa81tFKwuR3XdnK0HB0fV0dMUG7BUfOHKB8W7Uje0ByNjPcjBbYwE/CGW 7RHtxhhHiWCIGT5X7aLsmRaa/He8aQoDC8aQH5VlkdEg4U+lK4K6jiZOmOVXYeyyMTnI sxWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=e54HQLW9; 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 h24si4013088ejt.89.2021.02.11.03.25.50; Thu, 11 Feb 2021 03:26:14 -0800 (PST) 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=pass header.i=@mg.codeaurora.org header.s=smtp header.b=e54HQLW9; 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 S230116AbhBKLYj (ORCPT + 99 others); Thu, 11 Feb 2021 06:24:39 -0500 Received: from mail29.static.mailgun.info ([104.130.122.29]:46799 "EHLO mail29.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231388AbhBKLVf (ORCPT ); Thu, 11 Feb 2021 06:21:35 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1613042470; h=Content-Type: MIME-Version: Message-ID: In-Reply-To: Date: References: Subject: Cc: To: From: Sender; bh=ZMVEw+T1+2jFNHRLIczmtfsy/CV7EDResuKLWZr1Ipo=; b=e54HQLW9jPv64vdokW6Rt/OqoDJ7N9/usxYW4BLmQGRsHwyNcKjV5fRc9GeKMztqJkDlDyZW BFjiC9AkfZNIbHQoPYLjtrdEIz53wM6gEq0B3FH2SPioZEUbQRdrrBH0EQlnSwqVnDFP41yY X2aSwxaQxJo0cEes4k/9igti5t4= X-Mailgun-Sending-Ip: 104.130.122.29 X-Mailgun-Sid: WyI3YTAwOSIsICJsaW51eC13aXJlbGVzc0B2Z2VyLmtlcm5lbC5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n04.prod.us-west-2.postgun.com with SMTP id 602512ff34db06ef79059422 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Thu, 11 Feb 2021 11:20:31 GMT Sender: kvalo=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 30EC9C43463; Thu, 11 Feb 2021 11:20:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00,SPF_FAIL, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from potku.adurom.net (88-114-240-156.elisa-laajakaista.fi [88.114.240.156]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: kvalo) by smtp.codeaurora.org (Postfix) with ESMTPSA id B87A5C433ED; Thu, 11 Feb 2021 11:20:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org B87A5C433ED Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=kvalo@codeaurora.org From: Kalle Valo To: Shuah Khan Cc: netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, ath10k@lists.infradead.org, kuba@kernel.org, davem@davemloft.net Subject: Re: [PATCH 4/5] ath10k: detect conf_mutex held ath10k_drain_tx() calls References: <87lfbwtjls.fsf@codeaurora.org> Date: Thu, 11 Feb 2021 13:20:26 +0200 In-Reply-To: (Shuah Khan's message of "Wed, 10 Feb 2021 08:57:04 -0700") Message-ID: <871rdmu9z9.fsf@codeaurora.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Shuah Khan writes: > On 2/10/21 1:25 AM, Kalle Valo wrote: >> Shuah Khan writes: >> >>> ath10k_drain_tx() must not be called with conf_mutex held as workers can >>> use that also. Add check to detect conf_mutex held calls. >>> >>> Signed-off-by: Shuah Khan >> >> The commit log does not answer to "Why?". How did you find this? What >> actual problem are you trying to solve? >> > > I came across the comment block above the ath10k_drain_tx() as I was > reviewing at conf_mutex holds while I was debugging the conf_mutex > lock assert in ath10k_debug_fw_stats_request(). > > My reasoning is that having this will help detect incorrect usages > of ath10k_drain_tx() while holding conf_mutex which could lead to > locking problems when async worker routines try to call this routine. Ok, makes sense. I prefer having this background info in the commit log, for example "found by code review" or something like that. Or just copy what you wrote above :) >>> --- a/drivers/net/wireless/ath/ath10k/mac.c >>> +++ b/drivers/net/wireless/ath/ath10k/mac.c >>> @@ -4566,6 +4566,7 @@ static void >>> ath10k_mac_op_wake_tx_queue(struct ieee80211_hw *hw, >>> /* Must not be called with conf_mutex held as workers can use that also. */ >>> void ath10k_drain_tx(struct ath10k *ar) >>> { >>> + WARN_ON(lockdep_is_held(&ar->conf_mutex)); >> >> Empty line after WARN_ON(). >> > > Will do. > >> Shouldn't this check debug_locks similarly lockdep_assert_held() does? >> >> #define lockdep_assert_held(l) do { \ >> WARN_ON(debug_locks && !lockdep_is_held(l)); \ >> } while (0) >> >> And I suspect you need #ifdef CONFIG_LOCKDEP which should fix the kbuild >> bot error. >> > > Yes. > >> But honestly I would prefer to have lockdep_assert_not_held() in >> include/linux/lockdep.h, much cleaner that way. Also >> i915_gem_object_lookup_rcu() could then use the same macro. >> > > Right. This is the right way to go. That was first instinct and > decided to have the discussion evolve in that direction. Now that > it has, I will combine this change with > include/linux/lockdep.h and add lockdep_assert_not_held() > > I think we might have other places in the kernel that could use > lockdep_assert_not_held() in addition to i915_gem_object_lookup_rcu() Great, thank you. The only problem is that lockdep.h changes have to go via some other tree, I just don't know which :) I think it would be easiest if also the ath10k patch goes via that other tree, I can ack the ath10k changes. Another option is that I'll apply the ath10k patch after the lockdep.h change has trickled down to my tree, but that usually happens only after the merge window and means weeks of waiting. Either is fine for me. -- https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches