Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp912166ybl; Thu, 12 Dec 2019 06:52:42 -0800 (PST) X-Google-Smtp-Source: APXvYqzXXFiP3dBC535N1M7i7Entrxa6mrDBMBOtgu0NJ6tzY8Hq3Q58yWIxIYfmFy50t+K+lHjj X-Received: by 2002:aca:c7cb:: with SMTP id x194mr5278978oif.157.1576162361760; Thu, 12 Dec 2019 06:52:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576162361; cv=none; d=google.com; s=arc-20160816; b=No882VWr990SnPFmLpVr6OgFmH4bwREDJ0W6LApSoXHD9enqipcvfj4TgKkqiNBDp+ ucDbcSYc44+2H/4iF275tOweKJWkHSk/qVUH/1spOIT5/ORbaCz1CCmQOJx2JCCKwx3s YpvUPv7f+H3m1Uljy/6YRD6x33Vb/phz1ZuvXbVcI7TD1yyE2K9lLkv5NsoMqqQ0zxF/ WirwrgObddMr87i8PDAM6pdrvP8R22LhKqNeAwxaBWJ7DlFB7Sp+POCFZ6hDJXE62/Fy 11hdkwiTMtoBOMhV++VaJkHR9lgE1XhFVIlHXTJ2efzNXh3yyu6+ydwTtvJCT1VdrrVD cBlQ== 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 :user-agent:date:cc:to:from:subject:message-id; bh=93fNZq+TAwMZUQPGqwO2W2d1b2Isfo/iFm8xX+xE0IA=; b=p/b+w6KJmKT5F5MCPKdol9OvRyiUCcHmH6p5DspT7dH0OVJaXWYZ5TZkGmbyzammP1 tQmy7AV3l4EHruzZidi7eroKmI5bkwaPuJS6YlnWTwslH3qOayFrviovoDjhzbl2mEBc sdcLyUjZRrQdd4iP4qdpoleOMhSKyK7oa5iouHOz6Lpuq/AzkE3ydL5KIjxCR/gPoClx m3rYbJfoTm5Hxy4w8N8Hg4JWke4rRsR8nQnyNO+Q7N8UCEkEBRz9BXB8SZ5V4jJneqkB vMCWOq1bhZfEcqbDh6tctPMhottkyqKjedJoKElrTlctXUzz9Xy7IY9ygscxgct5REAL /7kQ== ARC-Authentication-Results: i=1; mx.google.com; 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 a9si3157524oib.59.2019.12.12.06.52.16; Thu, 12 Dec 2019 06:52:41 -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; 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 S1728939AbfLLOuW (ORCPT + 99 others); Thu, 12 Dec 2019 09:50:22 -0500 Received: from s3.sipsolutions.net ([144.76.43.62]:42610 "EHLO sipsolutions.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728905AbfLLOuW (ORCPT ); Thu, 12 Dec 2019 09:50:22 -0500 Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.92.3) (envelope-from ) id 1ifPnH-007Ghk-QV; Thu, 12 Dec 2019 15:50:19 +0100 Message-ID: <14cedbb9300f887fecc399ebcdb70c153955f876.camel@sipsolutions.net> Subject: debugging TCP stalls on high-speed wifi From: Johannes Berg To: Eric Dumazet Cc: Toke =?ISO-8859-1?Q?H=F8iland-J=F8rgensen?= , linux-wireless@vger.kernel.org, netdev@vger.kernel.org Date: Thu, 12 Dec 2019 15:50:18 +0100 Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.34.2 (3.34.2-1.fc31) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Hi Eric, all, I've been debugging (much thanks to bpftrace) TCP stalls on wifi, in particular on iwlwifi. What happens, essentially, is that we transmit large aggregates (63 packets of 7.5k A-MSDU size each, for something on the order of 500kB per PPDU). Theoretically we can have ~240 A-MSDUs on our hardware queues, and the hardware aggregates them into up to 63 to send as a single PPDU. At HE rates (160 MHz, high rates) such a large PPDU takes less than 2ms to transmit. I'm seeing around 1400 Mbps TCP throughput (a bit more than 1800 UDP), but I'm expecting more. A bit more than 1800 for UDP is about the max I can expect on this AP (it only does 8k A-MSDU size), but I'd think TCP then shouldn't be so much less (and our Windows drivers gets >1600). What I see is that occasionally - and this doesn't happen all the time but probably enough to matter - we reclaim a few of those large aggregates and free the transmit SKBs, and then we try to pull from mac80211's TXQs but they're empty. At this point - we've just freed 400+k of data, I'd expect TCP to immediately push more, but it doesn't happen. I sometimes see another set of reclaims emptying the queue entirely (literally down to 0 packets on the queue) and it then takes another millisecond or two for TCP to start pushing packets again. Once that happens, I also observe that TCP stops pushing large TSO packets and goes down to sometimes less than a single A-MSDU (i.e. ~7.5k) in a TSO, perhaps even an MTU-sized frame - didn't check this, only the # of frames we make out of this. If you have any thoughts on this, I'd appreciate it. Something I've been wondering is if our TSO implementation causes issues, but apart from higher CPU usage I see no real difference if I turned it off. I thought so because it splits up the SKBs into those A- MSDU sized chunks using skb_gso_segment() and then splits them down into MTU-sized all packed together into an A-MSDU using the hardware engine. But that means we release a bunch of A-MSDU-sized SKBs back to the TCP stack when they transmitted. Another thought I had was our broken NAPI, but this is TX traffic so the only RX thing is sync, and I'm currently still using kernel 5.4 anyway. Thanks, johannes