Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1927215ybb; Sat, 4 Apr 2020 16:36:14 -0700 (PDT) X-Google-Smtp-Source: APiQypK2apNLr1eg450jjUD6TENZTA/foeMKNvgRhfDN71wq3pEgwBJ5HNjyyIJpyXsNiqAIa4Aw X-Received: by 2002:a9d:748a:: with SMTP id t10mr12895834otk.244.1586043374539; Sat, 04 Apr 2020 16:36:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586043374; cv=none; d=google.com; s=arc-20160816; b=A+evLrD3r5erS9qOAFixLIQ06p7DP5Jd4sEgPNO1jEcLxHl/AJ7StY3W1PNNHeSnmU 24ZveUQGsoUzQQBkwN9qP+LSdF+Ll5aFJB96CK1x2lib8viDNksZxJaq2nSNJ/ysSGWG gBbBvHKCg1nINTh1dGoUt/bc9WWdUBbBGyeziovXDmtwGlF7qYgEY7XFbnD84uHH+wKY x7KbJV7hE2uoEVoyol6RvGQ+6pk2udECtZGL/L//VpZlDCbJkExnmCgTroCxcRmuOtfU RpUW6IJBtTHU17ipt65wyrsOJibYZfHWDQ09P45urKQv6mWkNQ++CTqQKboj8NfTNlnL BQ4g== 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=2QY6kJu6osv8MjlmxaYnqwbXP+2TZMJZMDfLBsk4FAc=; b=B0SERlcTVim+J9ST/rbRVwzfnx1oyd29nJxBaaiTk2ccm/ZkAj+tEVwYYAOzBI3SOl Qulm0vJ8uwGl/6Sp/lTIsEgmZ7eoGRmtR2/SkaGu0dJuC7qBCY9yYLSQpHh+tW9svexk HZTW/k30s+hTmu18nSPNtCLteLBjt7wW7MAfDPDCky3H0wmIVif+fT8rcLIbCDapzhJK HN7Lkd1qJ8bcllx1U/SnsNjyMhlB7VwnFK7SOGe2kB9so8l6WcWt0B9dboXJE7BqD1hD 26pCxlNBFep6lLtooQKxPxGn9DdYS2LyVbsXGa28QqtuQFdwSXbmH56RbFZaHenP0HQc wPyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="XG/u8b5k"; 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 v20si5678742oif.63.2020.04.04.16.35.34; Sat, 04 Apr 2020 16:36:14 -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="XG/u8b5k"; 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 S1726315AbgDDXRW (ORCPT + 99 others); Sat, 4 Apr 2020 19:17:22 -0400 Received: from mail-ot1-f68.google.com ([209.85.210.68]:43157 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726057AbgDDXRW (ORCPT ); Sat, 4 Apr 2020 19:17:22 -0400 Received: by mail-ot1-f68.google.com with SMTP id a6so11427634otb.10 for ; Sat, 04 Apr 2020 16:17:21 -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=2QY6kJu6osv8MjlmxaYnqwbXP+2TZMJZMDfLBsk4FAc=; b=XG/u8b5k+1WGaHMPQsDI7v08q8+pKD/Rz5ZkX3n7eEv0U9eepN8N0Jq1d8yx9TZJaC F0B2ppluMf9iTqPd7yHrzI7kc1UUHJ6qcHdiD79OjbXpn1mYGmkmqZPFRggss3h4PjWU WDuMqm2qUxPYjmOJn2AxWopBfuTz8FVIpeNHbBv4ljVGfSXhJ6UpadBNveSbhnEMnOdD USUNtkUIWdVl0qvf0PpgFpyQLbaxY4Rbd7tER1bCYQKl0gvEipb6Vp1NEFxhIXMh8EYA bVK8oJn2KFyACY26ejHcVA3esBPXGuMFW3QPyrt7FcSDZcOVVoutLAkdL6noaf4GYria ejbQ== 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=2QY6kJu6osv8MjlmxaYnqwbXP+2TZMJZMDfLBsk4FAc=; b=JBvTjd3Crwu4a8h89j9MO/VPAQ7mNeMsnq+tyXQz7Kb9A+t2ji845MasATYmlsIQI5 HUlemSoOGRAx5m3TcWIssIxfT03p6sQZtq1l2xh4aizt3HMIv2frqCq89+B3/Dt/rLht CN7b5WTCw5XC/GIfSrN6Kz5hUJi+CGZPlmmMbse2A8p4JL1kUQ3FjmcDiax03cWV0fGJ e87lrg+beBYcdcFb91j5jprkC9SZKm10TQoT9LamDPccHLhv+K+f6LVYfjFEpn8jWDli Y5MsxJDu0m3s9+j12SIIm2UAyLrtxqRy8C0BxzGprTHTnPdXJguGSb6s2BLufarm1BR/ wUmw== X-Gm-Message-State: AGi0PuZBDmUA8Tn4kjjk6Ma9xptDYSyA6bt0uwmsiVp8HpvgCuHZa8bO I9qw7No+uSs/C4HRLscyluIBZjbQjORqNTCZhFWjgw== X-Received: by 2002:a9d:4f0:: with SMTP id 103mr11862681otm.336.1586042241088; Sat, 04 Apr 2020 16:17:21 -0700 (PDT) MIME-Version: 1.0 References: <20200403082955.1126339-1-luca@coelho.fi> In-Reply-To: From: Mark Asselstine Date: Sat, 4 Apr 2020 19:17:10 -0400 Message-ID: Subject: Re: [PATCH v5.7 4/8] iwlwifi: mvm: limit maximum queue appropriately 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 On Fri, Apr 3, 2020 at 1:10 PM Mark Asselstine wrote: > > On Fri, Apr 3, 2020 at 10:38 AM Mark Asselstine wrote: > > > > On Fri, Apr 3, 2020 at 4:32 AM Luca Coelho wrote: > > > > > > From: Johannes Berg > > > > > > Due to some hardware issues, queue 32 isn't usable on devices that have > > > 32 queues (7000, 8000, 9000 families), > > Is this statement really correct? All these devices have 31 queues > according to (.num_of_queues = 31). Without a HW specification I can't > be 100% sure but you should have this information within Intel. From > the details of my patch and my investigation, this should be nack'd > along with an explanation as to why my fix is not valid. > > Mark > > > > which is correctly reflected in > > > the configuration and TX queue initialization. > > > > This will not fix the issue on the 1000, 2000, 5000 and 6000 devices. Just correcting myself here. These use dvm so are OK, but I think we still have a problem with the 7000, 8000 and 9000 series with the change as is. Mark > > You need further protection on these as their are only 20 > > (IWLAGN_NUM_QUEUES) queues. I sent out a patch on March 19th with a > > fix. > > > > Mark > > > > > > > > However, the firmware API and queue allocation code assumes that there > > > are 32 queues, and if something actually attempts to use #31 this leads > > > to a NULL-pointer dereference since it's not allocated. > > > > > > Fix this by limiting to 31 in the IWL_MVM_DQA_MAX_DATA_QUEUE, and also > > > add some code to catch this earlier in the future, if the configuration > > > changes perhaps. > > > > > > Cc: stable@vger.kernel.org # v4.9+ > > > Signed-off-by: Johannes Berg > > > Signed-off-by: Luca Coelho > > > --- > > > drivers/net/wireless/intel/iwlwifi/fw/api/txq.h | 6 +++--- > > > drivers/net/wireless/intel/iwlwifi/mvm/sta.c | 5 +++++ > > > 2 files changed, 8 insertions(+), 3 deletions(-) > > > > > > diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/txq.h b/drivers/net/wireless/intel/iwlwifi/fw/api/txq.h > > > index 73196cbc7fbe..75d958bab0e3 100644 > > > --- a/drivers/net/wireless/intel/iwlwifi/fw/api/txq.h > > > +++ b/drivers/net/wireless/intel/iwlwifi/fw/api/txq.h > > > @@ -8,7 +8,7 @@ > > > * Copyright(c) 2007 - 2014 Intel Corporation. All rights reserved. > > > * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH > > > * Copyright(c) 2016 - 2017 Intel Deutschland GmbH > > > - * Copyright(c) 2019 Intel Corporation > > > + * Copyright(c) 2019 - 2020 Intel Corporation > > > * > > > * This program is free software; you can redistribute it and/or modify > > > * it under the terms of version 2 of the GNU General Public License as > > > @@ -31,7 +31,7 @@ > > > * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved. > > > * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH > > > * Copyright(c) 2016 - 2017 Intel Deutschland GmbH > > > - * Copyright(c) 2019 Intel Corporation > > > + * Copyright(c) 2019 - 2020 Intel Corporation > > > * All rights reserved. > > > * > > > * Redistribution and use in source and binary forms, with or without > > > @@ -99,7 +99,7 @@ enum iwl_mvm_dqa_txq { > > > IWL_MVM_DQA_MAX_MGMT_QUEUE = 8, > > > IWL_MVM_DQA_AP_PROBE_RESP_QUEUE = 9, > > > IWL_MVM_DQA_MIN_DATA_QUEUE = 10, > > > - IWL_MVM_DQA_MAX_DATA_QUEUE = 31, > > > + IWL_MVM_DQA_MAX_DATA_QUEUE = 30, > > > }; > > > > > > enum iwl_mvm_tx_fifo { > > > diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c > > > index 64ef3f3ba23b..251d6fbb1da5 100644 > > > --- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c > > > +++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c > > > @@ -722,6 +722,11 @@ static int iwl_mvm_find_free_queue(struct iwl_mvm *mvm, u8 sta_id, > > > > > > lockdep_assert_held(&mvm->mutex); > > > > > > + if (WARN(maxq >= mvm->trans->trans_cfg->base_params->num_of_queues, > > > + "max queue %d >= num_of_queues (%d)", maxq, > > > + mvm->trans->trans_cfg->base_params->num_of_queues)) > > > + maxq = mvm->trans->trans_cfg->base_params->num_of_queues - 1; > > > + > > > /* This should not be hit with new TX path */ > > > if (WARN_ON(iwl_mvm_has_new_tx_api(mvm))) > > > return -ENOSPC; > > > -- > > > 2.25.1 > > >