Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1391723ybn; Wed, 25 Sep 2019 17:38:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqw/vfhgtCAgKekYhTSGyDKzWo8T2CFusDSWsMZYPC0np/lMyBR8TWuWlipV3cVOMF65bORo X-Received: by 2002:a50:bb22:: with SMTP id y31mr887472ede.58.1569458337227; Wed, 25 Sep 2019 17:38:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569458337; cv=none; d=google.com; s=arc-20160816; b=KotQJSftCuYgS9x8SVAX3r6Grmc8to/nidgMGhtFNSlI7hDFiHo58Yk6p9CdzJAQu4 AepckMGsaxK0KfEQGT/aWhzvyDT1T2hz+WpfPqi+XCWNJfCsZwvnCT2LFMnx4ZnVeIjl dLyM5ujhhzmLYg2SWOtqqqJoBcE9Pba0k+u7hGiMTmdxSH/n7FObPTZV2meU39VFYfOq No8V0Fxky63S9xB/Eip53NQzg/HeMxBRtatzfF4BwSGzsYxfEW+snomAOjT2H5SkUJjN a054mvkHexlqSe4UfDtHRtrzvFXQ1R6iW1Y+2kcs+CJxSih2b7bBelTxbOL1ZCqAdr0t rZvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature:dkim-signature; bh=da2l6O3i2NY/72J5cG7O4BUVGrSFnFillDd4fRvozHs=; b=BC69RB+42UvqXgs0RbWlfsNFyxkgXRYILpzx+O4Sam/qj/+ckuEolPNnGM0D9Jhwon WXERliznurpOwp6wFre2OVlNwL1rytlVwAj5q0cVFD9PtsnU2nsJF84ohRoutFNXWN84 fy6RqKgVvM1VE5cn+0sm06ghWJ3Ep8JcpVXoGZEBa3SlmT/LuwFkMUNLPfyLQLhytakb IziuZ+lVffYCdYOyzgORYYUWG4+f64+3UAWSZ8HEBmtFf6ZHc1r7r8jrWTNU7xHUuOUO 5rBjjpXHgQ853kl+vcdWFlDXEjZxXg6b0HEtY5fAen96YVExgaE2VsFOJLFEifPeokEJ 0I9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=jp3WoPxL; dkim=pass header.i=@codeaurora.org header.s=default header.b=XskCCl8v; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p40si448226eda.334.2019.09.25.17.38.32; Wed, 25 Sep 2019 17:38:57 -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=@codeaurora.org header.s=default header.b=jp3WoPxL; dkim=pass header.i=@codeaurora.org header.s=default header.b=XskCCl8v; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389152AbfIXDTe (ORCPT + 99 others); Mon, 23 Sep 2019 23:19:34 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:49668 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729308AbfIXDTe (ORCPT ); Mon, 23 Sep 2019 23:19:34 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 29F236076C; Tue, 24 Sep 2019 03:19:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1569295174; bh=5fHGFSZ09yQayNghU6B++C4ukJVhlxZr4yvdON9mR0w=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=jp3WoPxLmjAsdajbZxDfA0v6+4Er6F1ILWx8M+pPlnb1EzIOXT5PV0nX4eTR3fwnN k4LSaAJmjviD5pVYK/nYwd+JSXbtbInZ+1nhbAxVBjuXUhejKm5CkbK3Ydnq0/PvQ8 nAztPBOyr68pXQcNEElHMqnzLuj5CNsbxAQ7ZuG0= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 98DF1602B8; Tue, 24 Sep 2019 03:19:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1569295173; bh=5fHGFSZ09yQayNghU6B++C4ukJVhlxZr4yvdON9mR0w=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=XskCCl8v1QRH03SoCOUJeSziXe5dZshkHZBq0UD9yYYLcSkzM8+YZBSSvoEkUOnbp IJQRojPygEPTvvPYHk1jTLDkBGftVWa+uyGFOmoK+HG3QtoLB4WZuwJRHt+ypPiZ7q nsfMk6XToM7bHB7l+MrCD9gnvAwXq+1vtmpBfUoA= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Tue, 24 Sep 2019 11:19:33 +0800 From: Yibo Zhao To: =?UTF-8?Q?Toke_H=C3=B8iland-J=C3=B8rgensen?= Cc: linux-wireless@vger.kernel.org, ath10k@lists.infradead.org, linux-wireless-owner@vger.kernel.org Subject: Re: [PATCH V3 4/4] mac80211: Sync airtime weight sum with per AC synced sta airtime weight together In-Reply-To: <87blvb5lb9.fsf@toke.dk> References: <1569223201-1490-1-git-send-email-yiboz@codeaurora.org> <1569223201-1490-5-git-send-email-yiboz@codeaurora.org> <87blvb5lb9.fsf@toke.dk> Message-ID: X-Sender: yiboz@codeaurora.org User-Agent: Roundcube Webmail/1.2.5 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On 2019-09-23 19:00, Toke Høiland-Jørgensen wrote: >> - if (params->airtime_weight) >> - sta->airtime_weight = params->airtime_weight; >> + if (params->airtime_weight && >> + params->airtime_weight != sta->airtime_weight) { > > This check doesn't work I think? You're not using the array-based > sta->airtime_weight[], and there are locking issues by just checking > like this; so maybe just keep the if() on params->airtime_weight, and > do > the checking inside the loop while holding the lock? It should be array-based sta->airtime_weight[] and I am missing that part during the porting. But you are right about we should check it inside the loop with the lock. > > Or could we just turn the weights into atomics to avoid the locking > entirely? Actually, we still need the active txq locking to make sure the txq is on the rbtree. Otherwise, no need to change airtime weight sum. > >> + for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { >> + spin_lock_bh(&local->active_txq_lock[ac]); >> + for (tid = 0; tid < IEEE80211_NUM_TIDS + 1; tid++) { >> + if (!sta->sta.txq[tid] || >> + ac != ieee80211_ac_from_tid(tid)) >> + continue; >> + >> + pre_weight = sta->airtime_weight[ac]; >> + sta->airtime_weight[ac] = >> + params->airtime_weight; >> + >> + txqi = to_txq_info(sta->sta.txq[tid]); >> + if (RB_EMPTY_NODE(&txqi->schedule_order)) >> + continue; >> + >> + local->airtime_weight_sum[ac] = local->airtime_weight_sum[ac] + >> + params->airtime_weight - >> + pre_weight; >> + } >> + spin_unlock_bh(&local->active_txq_lock[ac]); >> + } >> + } >> -- Yibo