Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2926884rdb; Mon, 4 Dec 2023 11:14:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IG/TYDy7S7KGLXjFiW9JBM2A2o/e/zlonsQhq8/OriqWRiylnSkGg4+W4/ij7R52Wbfju8L X-Received: by 2002:a17:90b:1e0b:b0:286:99a9:f4ce with SMTP id pg11-20020a17090b1e0b00b0028699a9f4cemr46024pjb.12.1701717262513; Mon, 04 Dec 2023 11:14:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701717262; cv=none; d=google.com; s=arc-20160816; b=KlU0W6MvNIVbNnDhR/I2dDXOkxEv7M/SV9HnxXJWw95Jel/HTJr4kTvpaHkkym3FvU d02D/5CEI/UCR04GjYhY6Pwsc7mN5vGMT+M5qV0y9aXbl32UUuLrNoR+2cjDm/ySJ1CN Wd5e+oCQZAVtuGZjVxacQAK+ezWqf7tkbuci0zodioqnAmSFjm9NQUaLk5s9cHVhaeLD nysN3Jyo74bLBF1RY2u70m+Ctw8TZWCGFwJlkxk0FgsSz0yfRvA0vp3Zv74ugNo0lYAP ltIM18hG7vWCb+rfqryHzWJNb05D9/GWky1oZJ9W1/XLbm4xu0FQMJxYeJ9OFMP58hnv pTOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:content-transfer-encoding:references:in-reply-to:date:cc :to:from:subject:message-id:dkim-signature; bh=cNlMeT3xAHKdW5JqeRIRrQRlGuoKFvLyZE2ObsR7G6Y=; fh=33XtzQ/E2pdadowxwg/0e1DZz7ZaQldbm6WDiovYgRU=; b=nu8J3zgtjobvEHegVMk6EtTtAvuyC8p5wEdvGo3yXHNCcSAeKp/gcbq3usShUDzwdi 87l5aqgCpkoSR36+BevXISBRT5y2J1TwrdaZ+ftglaEGF+SpYPoWSq1S8pXKhYQP685h fg3dUP0VqTrfxV9wIKThCd0RTjZc6ubvPG9RKAWDa9/jb2Y0Dk0t+DPjMYeLBGrq8462 gVh02ZUZw5DHFG7oWkUJIAxPeaR6hbBhxF18fj00Ocn8c1+f2fh0sAGm0s1TDqD+zDaP CWZYC9OXNTO4p4AORKKByvVF2tZO+J9DuMMECP0G4gKztwwSRpu0M/oMyNaPXvLkVE5l Iakg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=a0pHQDJQ; spf=pass (google.com: domain of linux-wireless+bounces-390-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-390-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id jb17-20020a170903259100b001d00a92b9d4si6501842plb.575.2023.12.04.11.14.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 11:14:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-390-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=a0pHQDJQ; spf=pass (google.com: domain of linux-wireless+bounces-390-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-390-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 71051B20999 for ; Mon, 4 Dec 2023 19:14:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 994A631594; Mon, 4 Dec 2023 19:14:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b="a0pHQDJQ" X-Original-To: linux-wireless@vger.kernel.org Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:242:246e::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3E00D5; Mon, 4 Dec 2023 11:14:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=MIME-Version:Content-Transfer-Encoding: Content-Type:References:In-Reply-To:Date:Cc:To:From:Subject:Message-ID:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=cNlMeT3xAHKdW5JqeRIRrQRlGuoKFvLyZE2ObsR7G6Y=; t=1701717253; x=1702926853; b=a0pHQDJQkW4r4666hNmHRVdEy/0nNcV9SbfekuJMguYjHHE vo+8mNYgl6ZvDjBdEUCMchTNV7/QQibjqd5TrfDoR6tlrNGNKSpx8kc/mRhXlCTdbCANJJjxdzojk B8CzNycm4Q5sGvMwMZU738JVUKJZ9XnUzmCJPizrr68mF5fG72408jcs2yXQRFmFszc2v7Rv0ZdZ2 B4kwrR69dITmOVvOuF6q9qg6rKu4uKiD3R0/IFdGIsMquHC8VYUg8v+BUM5HfCQSaioq+Tdiow9Sm Czy3t+3Ps9FI8UJDHxnMwaRqZLzfJBIMVFQGx8NabyZ31rTLPYWGKQ19IXEHStoA==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1rAEOR-0000000FCrb-3biE; Mon, 04 Dec 2023 20:14:12 +0100 Message-ID: Subject: Re: [PATCH wireless-next 0/3] netlink carrier race workaround From: Johannes Berg To: Jakub Kicinski Cc: linux-wireless@vger.kernel.org, netdev@vger.kernel.org Date: Mon, 04 Dec 2023 20:14:10 +0100 In-Reply-To: <20231204082354.78122161@kernel.org> References: <346b21d87c69f817ea3c37caceb34f1f56255884.camel@sipsolutions.net> <20231201104329.25898-5-johannes@sipsolutions.net> <20231201162844.14d1bbb0@kernel.org> <339c73a6318bf94803a821d5e8ea7d4c736dc78e.camel@sipsolutions.net> <20231202104655.68138ab4@kernel.org> <20231204082354.78122161@kernel.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.50.1 (3.50.1-1.fc39) Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-malware-bazaar: not-scanned On Mon, 2023-12-04 at 08:23 -0800, Jakub Kicinski wrote: > On Sun, 03 Dec 2023 19:51:28 +0100 Johannes Berg wrote: > > I think I wouldn't mind now, and perhaps if we want to sync in netlink > > we should also do this here so that it's consistent, but I'm not sure > > I'd want this to be the only way to do it, I might imagine that someone > > might want this in some kind of container that doesn't necessarily have > > (full) access there? Dunno. >=20 > Also dunno :) We can add a "sync" version of netif_carrier_ok() > and then call if from whatever places we need. [note: netif_carrier_ok(), not netif_carrier_on(), almost confused that] Yeah I guess we can have a netif_carrier_ok_sync(), though it feels kind of dubious to hide such an important detail in the middle of a netlink message building: if (nla_put_string(skb, IFLA_IFNAME, dev->name) || ... #ifdef CONFIG_RPS nla_put_u32(skb, IFLA_NUM_RX_QUEUES, dev->num_rx_queues) || #endif put_master_ifindex(skb, dev) || nla_put_u8(skb, IFLA_CARRIER, netif_carrier_ok(dev)) || ... Also, if we ever _do_ want to make it optional, then it's problematic, do we do netif_carrier_ok_maybe_sync(dev, sync)? ;-) > > We _could_ also use an input attribute on the rtnl_getlink() call to > > have userspace explicitly opt in to doing the sync before returning > > information? >=20 > Yeah, maybe.. IMHO a more "Rusty Russell API levels" thing to do would > be to allow opting out, as those who set the magic flag "know what they > are doing" and returning unsync'ed carrier may be surprising. > Also a "don't sync flag" we can add later, once someone who actually > cares appears, avoiding uAPI growth =F0=9F=98=81=EF=B8=8F >=20 > Anyway, up to you :) Heh. But do I want to get blamed for the (perhaps inevitable?) performance regression? I guess I'll try ... Actually I could even still combine this with the netif carrier up count in the wireless events, so we only have to do the rtnl_getlink if we haven't seen an event yet, and - in the likely common case - save the extra roundtrip? Though I guess it's not a huge problem, it's once per connection basically. johannes