Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp537973ybb; Fri, 3 Apr 2020 07:29:35 -0700 (PDT) X-Google-Smtp-Source: APiQypIARcK7EIzOyNMY5/Cvb2FWZHEJUAmT8RNio8p9Kd0HyFLJoYJvNUU6Jav9IVTNLiHkHbgQ X-Received: by 2002:a9d:728e:: with SMTP id t14mr6877730otj.63.1585924175426; Fri, 03 Apr 2020 07:29:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585924175; cv=none; d=google.com; s=arc-20160816; b=p9kFbDVJEUM3PCCVVs2qdAEEf9Yrbli/+7KA5AOUgL+lK5fuKuW7FldVYW2s4qcGyZ FzibR5fcQKlHZJSOPewszx0bgx1VMj2eh8eU5VIz4+oZkJBP+Fo6e1MqzpJuJBpoWoLf 8bB8eGXJzheTimNDUiX9sIXD1weS2fnQf8EaTNfEYXBeGeUZ7N+Q5/nIXH3fgi0iyWC7 cYemj5D0KuqyP4+DLk3jsaPbqGMfg5eUrskvfvk35kIjmjb8JqvYwoP8DOkZ+mkJHFW+ lXOq3tnV3VJSoQ9E894uOQpD/zCF1U6tepiFibMLf+HrNSnqams4wHS/AkJNehZmT8NU sR4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=x7nS7Oiy8X1JKqiU2L0rkxt9WpTyOOxLbBYQb6uDNXE=; b=xK0TsPeTIImKBniZzraNFRFmhCroLH26K3XXHEn2yoZ8dWCBP1jIT4RTTcOPjWh9Mz +dqvE1y/v9y9+badC+GLsaCKgD8B6aBp2yl+ykGp9QVh97fdlUhNfrEoBLTxjsh2VdKO j+1Ve2Bcfc9ZYuejLqpL6B+y9KKGXM7W+Iyt3AFVWzEKKffwPQP37YJfb/fHahirXZss z6DDOk+msoxI8zzK4eFtZ7bG42oYsgBTnMZ47JtU3WbADrQJ6u42BSQ+z4w9xYHPTdxU 4FNIp1qjXiJWvzbPtcsLtSW79mrVd+NjgsfXTb8sSk++Bt6RovFvGHvwLbw9xvrwEkPq Yk3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=p1FwhAAz; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h27si3972604oos.21.2020.04.03.07.29.09; Fri, 03 Apr 2020 07:29:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=p1FwhAAz; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390796AbgDCO2u (ORCPT + 99 others); Fri, 3 Apr 2020 10:28:50 -0400 Received: from mail-ot1-f68.google.com ([209.85.210.68]:33467 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727431AbgDCO2t (ORCPT ); Fri, 3 Apr 2020 10:28:49 -0400 Received: by mail-ot1-f68.google.com with SMTP id 22so7479300otf.0 for ; Fri, 03 Apr 2020 07:28:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=x7nS7Oiy8X1JKqiU2L0rkxt9WpTyOOxLbBYQb6uDNXE=; b=p1FwhAAz/UBgUXlsum6hh55lYRF7pOEqINw01NVJhb5a+d3V5RjJJCSuulfDuKEDdF kLybNt39wVEhW3LaBXxUoIq6+ZsmQlw53XPzxqLl1Ako+nd5f5+2UuaacJcdgKJ11NG+ ACO8crdDy+7FCTiUHUDmI9Ojimq6JS5rXV6F6nfg8ioDy/CGaXoS0J3gCkUGAYtx0arD I/OatDpkl/QcjVirC2CEvSpmPn8hSaJAvA5SqaTZCegmx6zlp8WwwFI8RH21kWjCt9p1 8vf6qjZPYpMzpTo6S9gc4aCRs0bvlmAecXdTOxZnv9eByOxsTBZKFB/QDBYCNdDTGhWf cCTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=x7nS7Oiy8X1JKqiU2L0rkxt9WpTyOOxLbBYQb6uDNXE=; b=BMxSvSHA/drCONhnUmWKjt8rZnTo0U6N/ZTIDsw9PX+mbdWUV83d+AJ2UmxYNkX2Gs I1bCs4ZTW5eCW01TgGEbzFcqVlkwaJlyNp3rbpHuv5P00yUnnOPzB8WZ0soYoL5RUvps YbdyrkDQErPt46TK63aJSJbPKFI7h2q6NatGGuNF5482RxPX+eDXddxXI3ZH8Dkbxp4J tS2S6you41n64i14ds0Y7l0Y6Ri8QFdNaC+7Pcwlersz5FmnEPC9Do3amwkr2q1UjUCp qpDGQgRhGsJJkn0o5f7njmXTo/VH+3R6e+DcmeW8yqJQKvK+71zX7/PiWpnYqV0s3yfx 8isg== X-Gm-Message-State: AGi0PuZZxij0Wen+LmuGUMgnog9xwN8Uh6H6u1qM/yeUsDJOE3l5p6NF o12FgzqGJSrtq8hcIr5Bn3Wr1hVtLMVbJmYWARFiwSZY X-Received: by 2002:a9d:264a:: with SMTP id a68mr6434128otb.176.1585924129151; Fri, 03 Apr 2020 07:28:49 -0700 (PDT) MIME-Version: 1.0 References: <20200403082955.1126339-1-luca@coelho.fi> In-Reply-To: From: Mark Asselstine Date: Fri, 3 Apr 2020 10:28:37 -0400 Message-ID: Subject: Re: [PATCH v5.7 8/8] iwlwifi: mvm: don't call iwl_mvm_free_inactive_queue() under RCU To: Luca Coelho Cc: kvalo@codeaurora.org, linux-wireless Content-Type: text/plain; charset="UTF-8" Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org I was looking into this as part of https://bugzilla.kernel.org/show_bug.cgi?id=206971 and had a similar fix in flight. My concern was that queue_owner being used outside of the RCU might be an issue as now you have no guaranty that the eventual use of sta->txq[tid] in iwl_mvm_free_inactive_queue() is going to be valid. The only way to work around this is instead of storing queue_owner, store mvmtxq = iwl_mvm_txq_from_tid(sta, i), then adjust iwl_mvm_free_inactive_queue(), iwl_mvm_disable_txq() and whatnot to take struct iwl_mvm_txq * instead of struct ieee80211_sta *. If you open the bug you will see the latest version of my work as the attached patch. I am not an RCU expert so I am curious to hear your thoughts. On Fri, Apr 3, 2020 at 4:31 AM Luca Coelho wrote: > > From: Johannes Berg > > iwl_mvm_free_inactive_queue() will sleep in synchronize_net() under > some circumstances, so don't call it under RCU. There doesn't appear > to be a need for RCU protection around this particular call. > > Cc: stable@vger.kernel.org # v5.4+ > Signed-off-by: Johannes Berg > Signed-off-by: Luca Coelho > --- > drivers/net/wireless/intel/iwlwifi/mvm/sta.c | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > > diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c > index 56ae72debb96..9ca433fdf634 100644 > --- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c > +++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c > @@ -1184,17 +1184,15 @@ static int iwl_mvm_inactivity_check(struct iwl_mvm *mvm, u8 alloc_for_sta) > for_each_set_bit(i, &changetid_queues, IWL_MAX_HW_QUEUES) > iwl_mvm_change_queue_tid(mvm, i); > > + rcu_read_unlock(); > + > if (free_queue >= 0 && alloc_for_sta != IWL_MVM_INVALID_STA) { > ret = iwl_mvm_free_inactive_queue(mvm, free_queue, queue_owner, > alloc_for_sta); > - if (ret) { > - rcu_read_unlock(); > + if (ret) > return ret; > - } > } > > - rcu_read_unlock(); > - > return free_queue; > } > > -- > 2.25.1 >