From: "Toke Høiland-Jørgensen" <toke@redhat.com>
To: Kan Yan <kyan@google.com>
Cc: Johannes Berg <johannes@sipsolutions.net>,
linux-wireless@vger.kernel.org,
Make-Wifi-fast <make-wifi-fast@lists.bufferbloat.net>,
Felix Fietkau <nbd@nbd.name>, Yibo Zhao <yiboz@codeaurora.org>,
John Crispin <john@phrozen.org>,
Lorenzo Bianconi <lorenzo@kernel.org>,
Rajkumar Manoharan <rmanohar@codeaurora.org>,
Kevin Hayes <kevinhayes@google.com>
Subject: Re: [Make-wifi-fast] [PATCH v7 1/2] mac80211: Implement Airtime-based Queue Limit (AQL)
Date: Wed, 13 Nov 2019 15:02:13 +0100 [thread overview]
Message-ID: <87woc3oowq.fsf@toke.dk> (raw)
In-Reply-To: <CA+iem5vrM0iF+yvS9m==UWnhp=DFV924ir-0nHcn6cwarEjZNA@mail.gmail.com>
Kan Yan <kyan@google.com> writes:
> Thanks for the review. I will pick up your new patches and give it a
> try tomorrow.
>
>> Why is this setting sta and device limits to the same value?
>
> local->aql_txq_limit_low is not the per device limit, but the default
> txq_limit for all STAs. Individual stations can be configured with
> non-default value via debugfs entry
> "netdev:interface_name_x/stations/mac_addr_x/airtime". "aql_threshold"
> is the device limit for switching between the lower and higher per
> station queue limit.
Oh, right, I see. But in that case, should writing the default really
stomp on all the per-station values? If I set the value of a station, I
wouldn't expect it to change just because I changed the default value
afterwards?
>> Also, are you sure we won't risk write tearing when writing 32-bit
>> values without locking on some architectures?
>
> Does mac80211 ever runs in any 16-bit architectures? Even in an
> architecture that write to 32-bit value is not atomic, I don't think
> there is any side-effect for queue limit get wrong transiently in rare
> occasions. Besides, the practical value of those queue limits should
> always fit into 16 bits.
I'm not sure about the platform characteristics of all the weird tiny
MIPS boxes that run OpenWrt; which is why I'm vary of making any
assumptions that it is safe :)
But yeah, I suppose you're right that since we're just setting the
limit, it is not going to be a huge concern here...
>> I don't think this is right; another thread could do atomic_inc()
>> between the atomic_read() and atomic_set() here, in which case this
>> would clobber the other value.
>> I think to get this right the logic would need to be something like
>> this:
>> retry:
>> old = atomic_read(&sta->airtime[ac].aql_tx_pending);
>> if (warn_once(tx_airtime > old))
>> new = 0;
>> else
>> new = old - tx_airtime;
>> if (atomic_cmpxchg(&sta->airtime[ac].aql_tx_pending, old, new) != old)
>> goto retry;
>> (or use an equivalent do/while).
>
> That's indeed not right. However, if a potential aql_tx_pending
> underflow case is detected here (It should never happen), reset it to
> 0 maybe not the best remedy anyway. I think it is better just
> WARN_ONCE() and skip updating aql_tx_pending all together, so the
> retry or loop can be avoided here. What do you think?
If we don't reset the value to zero may end up with a device that is
unable to transmit. Better to reset it I think, even if this is never
supposed to happen...
-Toke
next prev parent reply other threads:[~2019-11-13 14:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-12 2:11 [Make-wifi-fast] [PATCH v7 0/2] " Kan Yan
2019-11-12 2:11 ` [Make-wifi-fast] [PATCH v7 1/2] mac80211: " Kan Yan
2019-11-12 11:47 ` Toke Høiland-Jørgensen
2019-11-13 2:27 ` Kan Yan
2019-11-13 14:02 ` Toke Høiland-Jørgensen [this message]
2019-11-14 2:26 ` Kan Yan
2019-11-12 2:11 ` [Make-wifi-fast] [PATCH v7 2/2] mac80211: Use Airtime-based Queue Limits (AQL) on packet dequeue Kan Yan
2019-11-12 22:42 ` kbuild test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://lists.bufferbloat.net/postorius/lists/make-wifi-fast.lists.bufferbloat.net/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87woc3oowq.fsf@toke.dk \
--to=toke@redhat.com \
--cc=johannes@sipsolutions.net \
--cc=john@phrozen.org \
--cc=kevinhayes@google.com \
--cc=kyan@google.com \
--cc=linux-wireless@vger.kernel.org \
--cc=lorenzo@kernel.org \
--cc=make-wifi-fast@lists.bufferbloat.net \
--cc=nbd@nbd.name \
--cc=rmanohar@codeaurora.org \
--cc=yiboz@codeaurora.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox