Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1729411pxb; Wed, 10 Feb 2021 15:39:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJxtQ2RYCtwHzb8DyMT59Bn0s6dy4jVV5NOlnPfngTBd5p0MKHx6i3Gi+hQJamhGGtlpRzeU X-Received: by 2002:a17:906:d93:: with SMTP id m19mr5345362eji.212.1613000380529; Wed, 10 Feb 2021 15:39:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613000380; cv=none; d=google.com; s=arc-20160816; b=dhXh8wbfgAGxRdCsL3WgIjysVkKgujFFpLz0T0/yf4HFIKLHKQon69h0miJo7N00T5 b8lnw3r6dkzms+jWZup3daa8g/NMEPemspAl3eCkPhuTmddwBHX6cvvRCsNRwndt8JXo 1PAzT0LB1dQ6H3UhY0URO0NKLt3wLNa9747uVNZtXlsAYOA9q9lA4tJcZGo30BOfn2cK 3hwNw0GviyWWeiR8oHHjk2ZnAVXYC5x7gb7LsHCiaaOBCswEBSIQW3zimmisleW5kHJM wGvzySreXFH2xqnhSMY1unxIkbD+SIImc5c2jgSI4nZqtYqjIcfyHwGTJo3e03l8NsNw 9OCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:from:subject:cc:to:message-id:date; bh=kmkcoscn6LsLorZTRNsErSjewZ/CN7E7RiFFdXTsoOU=; b=Oj8cSJ8JxlmO5KrkeMhroB39jAtanObOQHlPcQQIBmEjfJdYxhAqLIx1OzaDqjHy6a irXTwGIAzOAhHvDUWOMm0b6fJgyydDnvao7VbOQ2OPA388DpLXdxTZexIlq4DMk15oaL oJBDuVFeWZSZz4Sye4WWJ9ja8m8SVS9iss7QV8MUz2VLK3Rz+hPeJI+8bs14NbU+VxGI rEbT2TSpsQn7DzPdYxCDFN2dHWs7coiI4nXh83OAw135aB8SNYZzo+MRrQx5ALsxJ1g6 9YrPxhVz4nfV1zy+Szw3xoCmvcqgZnI6BHmVE0OYfc+o6YF/YT56USk+dUoTSoFGq42h A2Ww== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j17si2419229edf.464.2021.02.10.15.39.16; Wed, 10 Feb 2021 15:39:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234064AbhBJXfE (ORCPT + 99 others); Wed, 10 Feb 2021 18:35:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234009AbhBJXeu (ORCPT ); Wed, 10 Feb 2021 18:34:50 -0500 X-Greylist: delayed 123 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Wed, 10 Feb 2021 15:34:09 PST Received: from mail.monkeyblade.net (shards.monkeyblade.net [IPv6:2620:137:e000::1:9]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84A55C06174A; Wed, 10 Feb 2021 15:34:08 -0800 (PST) Received: from localhost (unknown [IPv6:2601:601:9f00:477::3d5]) by mail.monkeyblade.net (Postfix) with ESMTPSA id 7D8694D25BDAF; Wed, 10 Feb 2021 15:34:07 -0800 (PST) Date: Wed, 10 Feb 2021 15:34:06 -0800 (PST) Message-Id: <20210210.153406.1774734837784815987.davem@davemloft.net> To: olteanv@gmail.com Cc: kuba@kernel.org, andrew@lunn.ch, vivien.didelot@gmail.com, f.fainelli@gmail.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bridge@lists.linux-foundation.org, roopa@nvidia.com, nikolay@nvidia.com, jiri@resnulli.us, idosch@idosch.org, claudiu.manoil@nxp.com, alexandre.belloni@bootlin.com, UNGLinuxDriver@microchip.com, vkochan@marvell.com, tchornyi@marvell.com, grygorii.strashko@ti.com, ioana.ciornei@nxp.com, ivecera@redhat.com, linux-omap@vger.kernel.org Subject: Re: [PATCH v3 net-next 07/11] net: prep switchdev drivers for concurrent SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS From: David Miller In-Reply-To: <20210210091445.741269-8-olteanv@gmail.com> References: <20210210091445.741269-1-olteanv@gmail.com> <20210210091445.741269-8-olteanv@gmail.com> X-Mailer: Mew version 6.8 on Emacs 27.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.2 (mail.monkeyblade.net [0.0.0.0]); Wed, 10 Feb 2021 15:34:08 -0800 (PST) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vladimir Oltean Date: Wed, 10 Feb 2021 11:14:41 +0200 > From: Vladimir Oltean > > Because the bridge will start offloading SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS > while not serialized by any lock such as the br->lock spinlock, existing > drivers that treat that attribute and cache the brport flags might no > longer work correctly. > > The issue is that the brport flags are a single unsigned long bitmask, > and the bridge only guarantees the validity of the changed bits, not the > full state. So when offloading two concurrent switchdev attributes, such > as one for BR_LEARNING and another for BR_FLOOD, it might happen that > the flags having BR_FLOOD are written into the cached value, and this in > turn disables the BR_LEARNING bit which was set previously. > > We can fix this across the board by keeping individual boolean variables > for each brport flag. Note that mlxsw and prestera were setting the > BR_LEARNING_SYNC flag too, but that appears to be just dead code, so I > removed it. > > Signed-off-by: Vladimir Oltean This needs updating because, as discussed, there is no race.