Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp1894577ybc; Wed, 13 Nov 2019 06:04:12 -0800 (PST) X-Google-Smtp-Source: APXvYqxicKjB6pZzjLfaUu1V9l1E7wHI2fIvJVc3g9v0gM0AJo4WhEIbnn+w3NvK3MH/dVLKOzqJ X-Received: by 2002:a17:906:d0d2:: with SMTP id bq18mr2786821ejb.217.1573653852735; Wed, 13 Nov 2019 06:04:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573653852; cv=none; d=google.com; s=arc-20160816; b=vdKS59EEwPAKWy4fpCn0z71zMBY84ex88F8RF5ARhT5KxpZj8DRKdFdiojY+HtDOrR /ij7ydXHGyRyB3UxAoKtZ8M6imMK9BSgt7CQcIhFHfn/TmX8NZGe+2uCOmi5jnMhkGQi sOKaWzqqteN1QjMK60ITqPSA9XuxiEbU6sMCxDMYiCc3bwTaEiLR3Mk3KCJYqY2xfXkm ZwtZAz58nL2io1FvxP/S/S8Zd+rcVzaMPiYDqBozNK24BGwn+d9KH0zux/oGMXr/NVVs +9Uh3Y2SbZLqMTOrKR3eYLrFfHLwwvnFdXksLkjV0Nu6U4iaj2/XJZCTigxrXldez130 hd6w== 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:mime-version :message-id:date:references:in-reply-to:subject:cc:to:from :dkim-signature; bh=8zN9uWkP7CUfQN6wLUGfJKeTOPoPLldWS17arxPNEg0=; b=toCbBEiRq1r6VxwNeYEuK8Ll78BFfHWNKoBza/WdeKjyp7aaP4eaHyE3uhexb4aWhU N20Vb9OWmhfnbOZGyB7sKuQ48zWJkJ1Zzi2w3Elj7EdM8Cq5oSGE8J2MEmI3sXrI1VpQ jApYv3oAuJeR4FUv+w3dzpvn/TCej7ao6fk/FK3xLcTBgDSImo2/z4Qatz+72+m+2+Fd vdnTCsL7gMmX/C7yF4d7stYI8ilQp0Hs7O0V6ir8399zyGOlhAMquRREte9kx4G2v8X2 pvg4bPcM/THLIOHnzWZ1J90DVXAcnFMj2OoPn03Z/7tPxkKHcxWaSPZ9l21AceZNQa9I TkWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=MzKJiB3g; 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=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o8si1900488edi.34.2019.11.13.06.03.08; Wed, 13 Nov 2019 06:04:12 -0800 (PST) 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=@redhat.com header.s=mimecast20190719 header.b=MzKJiB3g; 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=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727445AbfKMOCW (ORCPT + 99 others); Wed, 13 Nov 2019 09:02:22 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:59216 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727129AbfKMOCV (ORCPT ); Wed, 13 Nov 2019 09:02:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573653740; 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=MzKJiB3gHGhauhEQnzmI6wFrrAPZidZHILoacaygOE6hPXvXnIpB7E9TQTNvuMjxUXLVtt wcoo6bJlUzL/jpneCMDBVO0/96Z+r1NbPRgvDOHKUuSxs4kXujpMBzqQiECMWd4kyojOUc IPe0XIdtDVGRX756CcTvdST3P5k8ruI= Received: from mail-lj1-f198.google.com (mail-lj1-f198.google.com [209.85.208.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-222-1W355UsHO5qpZlGIFzpGnw-1; Wed, 13 Nov 2019 09:02:16 -0500 Received: by mail-lj1-f198.google.com with SMTP id e12so243514ljk.19 for ; Wed, 13 Nov 2019 06:02:16 -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=OXoSm6/C5XHv7FeDljWm90+CKX370KHBHBV0iiMEZrJZ60h58Z0KfDOn4cXj9Hmjlv CAp56T5gEpprLZ6IXSype3ig8no7xBUMz0yZ3429KzuSV3jJMKybhBgaBwwRTuMwg79j qIzKallCUblMpyrIJwIKlRa6zlSuTdZa1mivRNdlVF8x5/zq+Jzt3yg4OeSjl6HZoJ7W Qv6CFL2HQbujyZjhwTdEEHdUTU4IGB4WGy6r8DCv9Yitegj9tdhVFkFNZcSdxIp0amW5 Q/a1TDo4K3X2bu9h4Z5FE/D4KZhUfmfgFbvXIJH5DWRhX3udK9DLNoMxBjS/FCDVSMJN leUA== X-Gm-Message-State: APjAAAWqaido9lkaFvz2Yc4+/MBG7DARyyFpPhyAKaEDRRSFV/nqGJfV /enPzvPAN0SYSD54fGOJN6nELkOboSgdPX42WVHWAsAdP4nE0aOgOhc+4P8HJHdaRFsJY4rYw/j 4KwNLB4D0tMJ85Ca0pkvfnGRGtTk= X-Received: by 2002:a19:790c:: with SMTP id u12mr2971852lfc.183.1573653735327; Wed, 13 Nov 2019 06:02:15 -0800 (PST) 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 Subject: Re: [PATCH v7 1/2] mac80211: Implement Airtime-based Queue Limit (AQL) 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: 1W355UsHO5qpZlGIFzpGnw-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org 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