From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.bufferbloat.net (Postfix) with ESMTPS id 44A3C3B29E for ; Wed, 13 Nov 2019 09:02:20 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573653739; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8zN9uWkP7CUfQN6wLUGfJKeTOPoPLldWS17arxPNEg0=; b=Hh/kL+UDAbNumKy1S4Fg93VLi6OYiQWU5ucCbNy0y3IN/nRweSK972Uott+xT3dQLKHgBn jEqbVz8eF2Egd34vVIj4zjHv/D7yt8dW4AuofwU391hclSs3o4/FWVzfxIh49Pg3MRLh8n Mo7OsUsLipEDGuSo0ocAgMXzkTv7XmY= Received: from mail-lf1-f69.google.com (mail-lf1-f69.google.com [209.85.167.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-64-rIbbnAqKPjGe9eoWWrwpYw-1; Wed, 13 Nov 2019 09:02:18 -0500 Received: by mail-lf1-f69.google.com with SMTP id h3so791895lfp.17 for ; Wed, 13 Nov 2019 06:02:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=J+H+PxGzqPrRW5FjT+UNTmmU9n8VS97HbTwR5IJ901M=; b=ARdr82TOcb7Hgj43/t7LzjfEcKi5jMcEhWh5ym6uz/2/e7snZCauSGwjVOgfJiEzkt 9GSzpgZ7GgzW6XBSSvPSLrOhxywPbn+g7W8XhTs4vSpCqmbw05aIs+o9zGLGmSrGhptp yGTVtP43QVhWcKrgyQ/6pp1tNQSe3ksYdnYYxfITigO9GUTmPxlX224QZswlz74Nfx7Q 3nXSX+h0/rTvfsG2mdwmE1JY44teYjX2A1JIE4zMefqoBgaVVaHXYML8HuC7sQw/fcLo /Ix3iM1wQEEHoOp21XS7wt8FwaNjl5TGFtViyIn/xTfUMw+7GdAQsfinddlm/NjOsEHM +QwQ== X-Gm-Message-State: APjAAAUoxvap+83BzSuEsDICqP0iAn2SeS6wLan65QKuk/wUYQR2C/S6 XrfGaewUZfFGyT7WRq57wp/qIAYuPixOq5r38HmXZRSNLa3R6uCPutmUao+QBbr4LLHDaQRqGXt 7HAL5OL2TYohJ4XXNG87URnjLeGRM47XDKuo= X-Received: by 2002:a19:790c:: with SMTP id u12mr2971874lfc.183.1573653735659; Wed, 13 Nov 2019 06:02:15 -0800 (PST) X-Google-Smtp-Source: APXvYqwTR6Pu42EVoLqVM1tBLpy1vmX7MXyLbpDsHRkkP2CNzoiTuBWU8vSbHCfI5Wyc2HYKZIHBdg== X-Received: by 2002:a19:790c:: with SMTP id u12mr2971804lfc.183.1573653734783; Wed, 13 Nov 2019 06:02:14 -0800 (PST) Received: from alrua-x1.borgediget.toke.dk (borgediget.toke.dk. [85.204.121.218]) by smtp.gmail.com with ESMTPSA id y21sm886415ljm.25.2019.11.13.06.02.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Nov 2019 06:02:14 -0800 (PST) Received: by alrua-x1.borgediget.toke.dk (Postfix, from userid 1000) id 223C41803C7; Wed, 13 Nov 2019 15:02:13 +0100 (CET) From: Toke =?utf-8?Q?H=C3=B8iland-J=C3=B8rgensen?= To: Kan Yan Cc: Johannes Berg , linux-wireless@vger.kernel.org, Make-Wifi-fast , Felix Fietkau , Yibo Zhao , John Crispin , Lorenzo Bianconi , Rajkumar Manoharan , Kevin Hayes In-Reply-To: References: <20191112021136.42918-1-kyan@google.com> <20191112021136.42918-2-kyan@google.com> <871rudqpsg.fsf@toke.dk> X-Clacks-Overhead: GNU Terry Pratchett Date: Wed, 13 Nov 2019 15:02:13 +0100 Message-ID: <87woc3oowq.fsf@toke.dk> MIME-Version: 1.0 X-MC-Unique: rIbbnAqKPjGe9eoWWrwpYw-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Subject: Re: [Make-wifi-fast] [PATCH v7 1/2] mac80211: Implement Airtime-based Queue Limit (AQL) X-BeenThere: make-wifi-fast@lists.bufferbloat.net X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Nov 2019 14:02:20 -0000 Kan Yan 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 =3D atomic_read(&sta->airtime[ac].aql_tx_pending); >> if (warn_once(tx_airtime > old)) >> new =3D 0; >> else >> new =3D old - tx_airtime; >> if (atomic_cmpxchg(&sta->airtime[ac].aql_tx_pending, old, new) !=3D ol= d) >> 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