Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1918425ybp; Wed, 9 Oct 2019 22:57:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqzwJcWeCLHC4ZVbE6YRbe7oe7NP8bEDldDajE0AOd0JJuFOB9Uh7jACDfdcqX1VWpTVOGN6 X-Received: by 2002:a05:6402:649:: with SMTP id u9mr6298860edx.200.1570687043747; Wed, 09 Oct 2019 22:57:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570687043; cv=none; d=google.com; s=arc-20160816; b=MPEjUkoLk3YhBWBPv0FTGkRyJ137rFlc2C1Ut7LLnRrCrlRcuF0Hn12hzwKKtJu8G2 CMRLYwQ1BvNbCgSu/FWTr34B2r9ebWHikQQNcvaJztqtT4Vvg6VL1YE9LW02tQFCosRZ 7DF4jW/INO9jqlUj/rsVXJeQiSxfcjPJeeaD7GhcbcaE6H6CfaoHKYLBd1YNSrgtxIFJ iU1UZsRjuePzSZ21S1zkaDgGxE/L1f0jVZMNgxS3yrzU14RcG02DIDaipL/o5qzI1Lon 6Re2kPOvIml8djh+HrlQ0rJnF6m5IsdaUDo8nn/gm3rgzECjFUKdNknkogjm8nbcdRXt IBuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:from:references:cc:to:subject:dkim-signature; bh=6Sa4ogDKtaoaSCtMsMa5zSW7i7Opg6+eI/MkR7lfzm4=; b=BBLmRAfv5/+ipCd869vIpWZGJAwpFDUvGA6nNN+a+rzVFvPA+WYN/6FTQ0EwjdlhaM s4x9RYBZxeNc1oVNA1k0D663tJhNkXLU+hZFnID21VHUAQb/WC4ZGDAe/LXrMERutPps Dk+cBQ2mNK9AUb4rtreTN7K8pNOzim7QMMElJ5NkuqJZGlWQX6U6sTGcNgGrpT6m8+s0 YijaAJIxEE5+TY4seY1A6ES5htIa8U0iv+x97LawumS1mIdoiJsVEWqFgRIWOcPG1lxr n+kGBeddHyj6Cq/NCBPOzOivsUTTvOpZfhNhNPm8BUv1I2BOiZuVWIFicN8tvZfCeynp 7sZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=I7dRy2o0; 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 gw6si937319ejb.176.2019.10.09.22.56.48; Wed, 09 Oct 2019 22:57:23 -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=fail header.i=@nbd.name header.s=20160729 header.b=I7dRy2o0; 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 S1727053AbfJJF4h (ORCPT + 99 others); Thu, 10 Oct 2019 01:56:37 -0400 Received: from nbd.name ([46.4.11.11]:43366 "EHLO nbd.name" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726664AbfJJF4g (ORCPT ); Thu, 10 Oct 2019 01:56:36 -0400 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=6Sa4ogDKtaoaSCtMsMa5zSW7i7Opg6+eI/MkR7lfzm4=; b=I7dRy2o0cn7sgYiVQ7BBHaVd2P GVNcSJPPjXt5g7DPtTU3EJJg1AAJWKiF3pSHdbdij6kImSaF4THpl7W2MF5xOge9KwEeFNMNr1Hur oNERA1H5HGRJYKHA8OPZbTKrycQcQBlQXzZihnRmxWJFomMmPZZTOZ2StzqjagXB1GeM=; Received: from p54ae92e8.dip0.t-ipconnect.de ([84.174.146.232] helo=nf.local) by ds12 with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1iIRRB-00062z-6X; Thu, 10 Oct 2019 07:56:33 +0200 Subject: Re: [PATCH] mac80211: rework locking for txq scheduling / airtime fairness To: Yibo Zhao Cc: linux-wireless@vger.kernel.org, johannes@sipsolutions.net, =?UTF-8?Q?Toke_H=c3=b8iland-J=c3=b8rgensen?= References: <20190315100335.91445-1-nbd@nbd.name> From: Felix Fietkau Autocrypt: addr=nbd@nbd.name; prefer-encrypt=mutual; keydata= xsDiBEah5CcRBADIY7pu4LIv3jBlyQ/2u87iIZGe6f0f8pyB4UjzfJNXhJb8JylYYRzIOSxh ExKsdLCnJqsG1PY1mqTtoG8sONpwsHr2oJ4itjcGHfn5NJSUGTbtbbxLro13tHkGFCoCr4Z5 Pv+XRgiANSpYlIigiMbOkide6wbggQK32tC20QxUIwCg4k6dtV/4kwEeiOUfErq00TVqIiEE AKcUi4taOuh/PQWx/Ujjl/P1LfJXqLKRPa8PwD4j2yjoc9l+7LptSxJThL9KSu6gtXQjcoR2 vCK0OeYJhgO4kYMI78h1TSaxmtImEAnjFPYJYVsxrhay92jisYc7z5R/76AaELfF6RCjjGeP wdalulG+erWju710Bif7E1yjYVWeA/9Wd1lsOmx6uwwYgNqoFtcAunDaMKi9xVQW18FsUusM TdRvTZLBpoUAy+MajAL+R73TwLq3LnKpIcCwftyQXK5pEDKq57OhxJVv1Q8XkA9Dn1SBOjNB l25vJDFAT9ntp9THeDD2fv15yk4EKpWhu4H00/YX8KkhFsrtUs69+vZQwc0cRmVsaXggRmll dGthdSA8bmJkQG5iZC5uYW1lPsJgBBMRAgAgBQJGoeQnAhsjBgsJCAcDAgQVAggDBBYCAwEC HgECF4AACgkQ130UHQKnbvXsvgCgjsAIIOsY7xZ8VcSm7NABpi91yTMAniMMmH7FRenEAYMa VrwYTIThkTlQzsFNBEah5FQQCACMIep/hTzgPZ9HbCTKm9xN4bZX0JjrqjFem1Nxf3MBM5vN CYGBn8F4sGIzPmLhl4xFeq3k5irVg/YvxSDbQN6NJv8o+tP6zsMeWX2JjtV0P4aDIN1pK2/w VxcicArw0VYdv2ZCarccFBgH2a6GjswqlCqVM3gNIMI8ikzenKcso8YErGGiKYeMEZLwHaxE Y7mTPuOTrWL8uWWRL5mVjhZEVvDez6em/OYvzBwbkhImrryF29e3Po2cfY2n7EKjjr3/141K DHBBdgXlPNfDwROnA5ugjjEBjwkwBQqPpDA7AYPvpHh5vLbZnVGu5CwG7NAsrb2isRmjYoqk wu++3117AAMFB/9S0Sj7qFFQcD4laADVsabTpNNpaV4wAgVTRHKV/kC9luItzwDnUcsZUPdQ f3MueRJ3jIHU0UmRBG3uQftqbZJj3ikhnfvyLmkCNe+/hXhPu9sGvXyi2D4vszICvc1KL4RD aLSrOsROx22eZ26KqcW4ny7+va2FnvjsZgI8h4sDmaLzKczVRIiLITiMpLFEU/VoSv0m1F4B FtRgoiyjFzigWG0MsTdAN6FJzGh4mWWGIlE7o5JraNhnTd+yTUIPtw3ym6l8P+gbvfoZida0 TspgwBWLnXQvP5EDvlZnNaKa/3oBes6z0QdaSOwZCRA3QSLHBwtgUsrT6RxRSweLrcabwkkE GBECAAkFAkah5FQCGwwACgkQ130UHQKnbvW2GgCfTKx80VvCR/PvsUlrvdOLsIgeRGAAn1ee RjMaxwtSdaCKMw3j33ZbsWS4 Message-ID: <5005bfd2-c207-6c2b-ae87-71ef6a16980e@nbd.name> Date: Thu, 10 Oct 2019 07:56:32 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On 2019-10-10 04:43, Yibo Zhao wrote: > Hi Felix, > > In ath10k, we might have situations like, > > CPU0 CPU1 > ... ieee80211_txq_schedule_start() > ... while(ieee80211_next_txq()) { > ... driver dequeue packets from > txq > ... ieee80211_return_txq() > ieee80211_txq_schedule_start() ... > ieee80211_next_txq() } > driver dequeue packets from txq ieee80211_txq_schedule_end() > ieee80211_return_txq() > ieee80211_txq_schedule_end() > > The problem is while CPU1 is looping to dequeue txqs, the schedule_round > which is used to make sure no infinite loop will be changed in CPU0. So > a txq has already been scheduled will be scheduled again then the loop > won't be end at that point as our expected. Hi, I think this is something that should be fixed in the driver. The comment for ieee80211_txq_schedule_start() already states: "The driver must not call multiple TXQ scheduling rounds concurrently" The way that I'm dealing with this in mt76 is that I ensure that all txq scheduling is done from a single tasklet, which is scheduled from the tx status and the queue wake path. I think that approach should perform well in ath10k as well, and it will avoid the cost of waiting for a lock on one CPU while the other is scheduling tx already. - Felix