From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yw1-f182.google.com (mail-yw1-f182.google.com [209.85.128.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 293582DB78C for ; Wed, 25 Feb 2026 19:49:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772048976; cv=none; b=dqp3kBF6WZB37ytb5wHV27ETHmVGOnxWuQgJxtQwfKuM6Ik0FLAbtX0dCDVtt8c9WQmzFojoFuz5mSpm3z254z7wOlsG/LSjl0uolo6rauZ7RcqirMKG1rWuOpI8dTmxwOAkbSvor2DloXCNZ96wPK+Nw611yANz6bYOBZm5DoE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772048976; c=relaxed/simple; bh=IwiTgpjkeqFMqWSFK6RU5LNOiF/JEUJlaNjNpyEVOUU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=J7NStjcJmzSdczeeC4yL6Kd2jtQnIgRKoa/Bhe5qh/qiKUtGoBZNTu7+SDNRnCcKtkMc0WHiXcv/EBHciGGnhIYeHvWIqUD2Xklb8Ide0CWHF9+XWrLHSpma1qAiYjrcjFGkos+cq2DeK+f7/GmQ3g4q+ZLb+d+6xLMjFCUqp6I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Zet2AlBP; arc=none smtp.client-ip=209.85.128.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Zet2AlBP" Received: by mail-yw1-f182.google.com with SMTP id 00721157ae682-7982c3b7da9so484187b3.1 for ; Wed, 25 Feb 2026 11:49:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1772048974; x=1772653774; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=lBrBuKxNKltSGjbyuexsLRyWWbzoDm03jz7Y5rzbxME=; b=Zet2AlBPmHI5Rv3ENu2Jk8uIbAvg0EVsgsP8PC0VlhGQij8l5+fdGVvEefRmdkgOpr PCv3UBXTWipbTyvSwKSaCn4Yqgc46U37V1SsWvYEF7y1latHLj3DnYtrJ352mBeI/MHN 264VOufHSa9ujJ4aWh2mhT/bpvLolzHu3er5BLvoLOnWexeNXpribzbeGjsEV5iBmY6C K/60NJECmyDJII91v4uH0MnCSDBpfvIGcO0RcRmzDMTsXGG06oLwDBMTOz+fJNmvwCiK orC8fbhqY72TX7Hoj/Ti/D+EG6kx4zhQKMjObyasbbvejm+bthPVNmnYUwvEWUnIm1WG oZbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772048974; x=1772653774; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=lBrBuKxNKltSGjbyuexsLRyWWbzoDm03jz7Y5rzbxME=; b=p6aN9zQUWoxqA7DTL9ZYiERLq98Ghc4O+1ztROmkPKaCKfya1jDCzAjn8Uyl/Ep6ta PYmkPlaHdtlR++z03JikNyhyGz1O2VrCyHdTH2FuO7YYT9+htLDej4EY0hv5o57m3muP wNZxCcsZbv1kh0aXVgL/kOOV3w4LWezxIMGek+dBuBjkRZqLj54OvZv/22pMSDk2BpnM r9wxgVGNEPeRW7Cq5dd9jvhim36mYMujiB5IL3GCg+BGIKQ7OvNRNXi8CESU/pPn9uat 5LgMyy6wTVMjq1xPRMSQYVypwP05m7Y16cY6CskzAPXwDJBnZAc17LEjMnDOOqW6pxLu e5Kg== X-Forwarded-Encrypted: i=1; AJvYcCUmozNJsfPXXsG99a/b4iu/k0OSihVenK+M7/FJIsFTtv7XR/7aFuVw2uAmPFWvTLW++dp5b9eapc92d84=@vger.kernel.org X-Gm-Message-State: AOJu0YxIwQZkFYnyhlsZMSN2pDaIEvjs6rUJPvgRy96lhp84BOb/YOwe AZrcQtiDlS/D1/w72aAVM7vEbAl7CBCh01pIo2X2xBEE/dTSQvVl4GZH X-Gm-Gg: ATEYQzxvus9sNnKknQEjee/a0+WbnwMcpt6Sg5gB8+3AXDFBzCEs3fdJdoRJmIlUCw8 YU0ktM/5Kk1BFsCTv1ln/oc28kF8OjJ8fSgY4irdovN1uPwuS0KwlLxBcnlChgAN3FRKZnCCNYP HIQQKCcCxIZvN8VS9JWwB5RTrvcsC9L071CPuvYpSa/lVLHHKLEGxs40YMqHY5X5rkNn3ajvA9k UxDMWrNI2VBB5QnwqUrdjyRD0/H+1moF9FVkF2RhVmHUQIPtruEMmneivlVHq0GhewN4MBEARNp vehJYuFoByGPm8gd4e9YHuef83GTW96EFGysw9BUcZW8YEFhma6C6kmDxFU3sZ0X0qqNoYO4m0h pMw1rAgUBeo0HRFei+4dJs8irS7ouQWw1dNepPTibGKqEyifnn40jCyVywRIfxy8w52ymG+0uDI 3XzR02i68YNv+XtCmRjO2pj40v3ARxAcfo1GakP9aA8nkz1Vk= X-Received: by 2002:a05:690c:6086:b0:796:3c99:1833 with SMTP id 00721157ae682-79829174a23mr160398677b3.60.1772048974112; Wed, 25 Feb 2026 11:49:34 -0800 (PST) Received: from devvm11784.nha0.facebook.com ([2a03:2880:25ff:74::]) by smtp.gmail.com with ESMTPSA id 00721157ae682-7982dbd9fa2sm60176917b3.18.2026.02.25.11.49.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Feb 2026 11:49:33 -0800 (PST) Date: Wed, 25 Feb 2026 11:49:31 -0800 From: Bobby Eshleman To: Mina Almasry Cc: Stanislav Fomichev , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Kaiyuan Zhang , Stanislav Fomichev , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Bobby Eshleman Subject: Re: [PATCH net] net: devmem: use READ_ONCE/WRITE_ONCE on binding->dev Message-ID: References: <20260223-devmem-membar-fix-v1-1-37dcae1e49f8@meta.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Wed, Feb 25, 2026 at 09:31:48AM -0800, Mina Almasry wrote: > On Wed, Feb 25, 2026 at 7:14 AM Bobby Eshleman wrote: > > > > On Tue, Feb 24, 2026 at 05:49:42PM -0800, Stanislav Fomichev wrote: > > > On 02/23, Bobby Eshleman wrote: > > > > From: Bobby Eshleman > > > > > > > > binding->dev is protected on the write-side in > > > > mp_dmabuf_devmem_uninstall() against concurrent writes, but due to the > > > > concurrent bare read in net_devmem_get_binding() it should be wrapped in > > > > a READ_ONCE/WRITE_ONCE pair to make sure no compiler optimizations play > > > > with the underlying register in unforeseen ways. > > > > > > > > Fixes: bd61848900bf ("net: devmem: Implement TX path") > > > > Signed-off-by: Bobby Eshleman > > Looks correct to me, and AFAIU Stan is right, we might as well > annotate all the reads of ->dev as technically there could be a dmabuf > uninstall happing concurrently on another CPU. I also think it's > probably good to annotate potential races. > > The ->dev write in dmabuf binding doesn't need WRITE_ONCE annotation I > guess because it's initialization, it can't race with any reads. > > This makes me wonder what other fields in dmabuf need annotations. I > hope I didn't miss many more. > > I would add this is really not a critical bug because > net_devmem_get_binding() is in TX path, and it is more than fine here > if we fail this check if there is an unbind happening in paraller with > sendmsg(), but it's probably good to annotate potential races anyway. > Sounds good. I'll take a look at some of the other fields while my mind is in this space. I agree about it being non-critical, good point about TX passing through fine on failed check. Best, Bobby