Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7080968ybi; Thu, 1 Aug 2019 02:56:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqxOLw/bh+JVWJCy27CANM1z94y+pUf95LL3/BNuLJ23d1PQrXp3FA2in1PyQ6VpYngLb1/e X-Received: by 2002:a63:6fcf:: with SMTP id k198mr116981574pgc.276.1564653381445; Thu, 01 Aug 2019 02:56:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564653381; cv=none; d=google.com; s=arc-20160816; b=N9ivVj2IWE/pezQhFDjILGqp0ssTg845iH/dO1DR4HLSsM0Ee9Xt7m33Y1IYTlyu6A 5LHw3TxlNh+72JTOULtg+zWgd1ny9XPRq4froqayvENxhX3iDwiC/kB+4w12aMaHZTox X5f6r0G9LhVdO1s+I8qm9ULHq2/Ac+4t4bvXudLiX9MHjzGDp/x4is05XKcZ8EBonJCs +SEwd7yTuKppQe0JB9FGKWO2wipbXMUwexgVkbS2v+ivCU5tCHm6WP8x6ZC3/iRCEvj1 /hNfVmkDyS61VPNiAnlHOlvxLAyzSngZkDP2KFOulIusMuOUOXeq2rgmviclChsELkZp xoag== 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:references:in-reply-to:date:to:from:subject:message-id; bh=McbrQ0sWS0X5h1np4YH5WmFcuOs2g8UFkha3K2pYs/k=; b=GUeVW/hZF+fSNQZaouWoMYxf6BTclFk4DsQjWRgWwdt1PYlHotvnnR9GbQYh2yexhb wkxZIhPocDk/y834ThUVI37LnHqvsk00D4UInfOz3cGXs671xLaUL9MYOAcxrT2Xglpu 2/hfA95FinB28KERqiUak6AaEUpWYz6MdbTKpkjtVjo/HKsNK4OWQ+zWyS38qzyNB6DF tl4pyoiUu0fWOLSj84JM41BxZ5dlOTGKkWQJdL1HxPui7cB6dUrV2bfIhXvnDX00Bdh4 xdiPu9jj0BQBjixAeITPLLgXGlDHStvIGr1cc3WMQhjvy9sGUpNHYuHqOyRhhv33DGIi OJKA== 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 q10si21766453pff.223.2019.08.01.02.56.06; Thu, 01 Aug 2019 02:56:21 -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; 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 S1731071AbfHAJN7 (ORCPT + 99 others); Thu, 1 Aug 2019 05:13:59 -0400 Received: from s3.sipsolutions.net ([144.76.43.62]:56164 "EHLO sipsolutions.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726799AbfHAJN7 (ORCPT ); Thu, 1 Aug 2019 05:13:59 -0400 Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ht79o-0001uN-JU; Thu, 01 Aug 2019 11:13:56 +0200 Message-ID: Subject: Re: [RFCv1 2/2] nl80211: Don't split-dump for clients with large buffers From: Johannes Berg To: Denis Kenzior , linux-wireless@vger.kernel.org Date: Thu, 01 Aug 2019 11:13:55 +0200 In-Reply-To: <20190801071455.4974-2-denkenz@gmail.com> (sfid-20190801_091504_260738_7DFFEF78) References: <20190801071455.4974-1-denkenz@gmail.com> <20190801071455.4974-2-denkenz@gmail.com> (sfid-20190801_091504_260738_7DFFEF78) Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.5 (3.30.5-1.fc29) 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 On Thu, 2019-08-01 at 02:14 -0500, Denis Kenzior wrote: > + /* > + * auto-detect support for large buffer sizes: af_netlink > + * will allocate skbufs larger than 4096 in cases where > + * it detects that the client receive buffer (given to > + * recvmsg) is bigger. In such cases we can assume that > + * performing split dumps is wasteful since the client > + * can likely safely consume the entire un-split wiphy > + * message in one go without the extra message header > + * overhead. > + */ > + if (skb_tailroom(skb) > 4096) { > + state->large_message = true; > + state->split = false; > + } Hmm. That's kinda a neat idea, but I don't think it's a good idea. Have you checked how long the message is now? Since we *did* in fact hit the previous limit, and have added a *lot* of things since then (this was years ago, after all), I wouldn't be surprised if we're reasonably close to the new limit you propose even now already. Also, keep in mind that there are some devices that just have an *enormous* amount of channels, and that's only going to increase (right now with 6/7 GHz, etc.) So in general, given all the variable things we have here, all this buffer size estimation doesn't seem very robust to me. You could have any number of variable things in a message: * channel list - which we alleviated somewhat by having a separate channel dump, so not all data is included here (which I guess you'll complain about next :P) * nl80211_send_mgmt_stypes() things are also a bit variable, and we keep adding interface types etc., and some devices may support lots of frames (there's an upper bound, but it's not that small) * interface combinations - only getting more complex with more complex devices and more concurrency use cases * vendor commands have no real limit * I'm sure measurement use cases will only increases * and generally of course we keep adding to everything Also, I don't really buy the *need* for this since you're just removing a few kernel/user roundtrips here when new devices are discovered, a rare event. The parsing isn't really any more complicated for the userspace side. Regarding the other patch, I think most of the above also applies there. I can sort of see how you think it's *nice* to have all the data right there, but I really don't see why you're so hung up about having to request the full information ... And I really don't want to see this hit the wall again in the future, in some weird scenarios with devices that have lots of . > It should be safe to assume that any users of these new unsolicited > NEW_WIPHY events are non-legacy clients, which can use a > larger receive buffer for netlink messages. Since older, legacy clients > did not utilize NEW_WIPHY events (they did not exist), it is assumed > that even if the client receives such a message (even if truncated), no > harm would result and backwards-compatibility would be kept. Interesting idea, but no, in general you cannot assume that. Older clients might have added support for NEW_WIPHY without fixing the split dumps first ... Also, you mention in the code that messages are truncated, but I'm pretty sure they're just dropped, not truncated. And finally, I also see no reason to send out many KB of data for what might in the end (e.g. in iw) just be a debug message. But really I think the thing that kills this proposal is the fact that it reintroduces a message size limit (even if higher now) that we're somewhat likely to hit in the future. johannes