Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp3294067lqo; Wed, 15 May 2024 05:48:56 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV8zI3ezn1j9MVAq7BeH9sLW3Qz7gNM/UXakhXfmXVCsJZB6O4AkK/AzV4Ou8Xr5ufYguupKzW43fXC5zXe/zdcbRJN5V+A0d6tgggs7A== X-Google-Smtp-Source: AGHT+IF1MBqd44Rkq9DiC7N5rvv2ydpgg3bo5FwdsE2e6jLDf4m1bNrRdJN6wi3gmKtfoqFo5uk6 X-Received: by 2002:a17:903:947:b0:1e3:1526:77d5 with SMTP id d9443c01a7336-1ef43d28152mr198333545ad.23.1715777336428; Wed, 15 May 2024 05:48:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715777336; cv=pass; d=google.com; s=arc-20160816; b=F4bLM4ZLbw1Q018R0bfWGo297jxwBl/nF1ZYGFTc2H8VKGMe1RkU+Qe7MEWxNxglQz GqYBnvtC+4tR+rjK/RJe17Bh2TXB8FbU2YCe76e7/pTenC+Ma70lWuvdRnx0fwHg8xTg iv4rAMZL9kkpoDjC9xD4ZTvfuvXUVpEO7UOPn3uPz9mjWNBFDFz3Cs61xfBvehGw5ckE 544Y3QLXfSurWUGfbCrgOps+Nfu0CNCpGnGRuU2Ken646UFEBDIihNdL+8CQGXwxhYTc e4M6mxzngseLIzUuNS2lqcOJsRq+ULBBJ7nXi8JQIPgNGQLCfGRZF1dQuoJctZwmfHT9 jUIw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=sy59NphfPqntinjd5ZYesz8gWQ4Cizffpl3PRbnsf+I=; fh=PcuQqpIk1f51uu8/KuOCKpbilCp9d05YzXv3N0KZZxM=; b=0Jots4qLQLQyI/ayUHKJMuWY3oNvh2Dh5PWYaD4omw02uTMV3TZCFmGdMHMsmdRHA8 tahx4xpTSZlykM5mK59dfaVYOiuN6bhCHuek1ZYU3BRfA3Q8KQ+jf6Ay5KTkX8NL61+n ije/t1URa7O7IYr6RiDFo4WWESZQVVkSBmtdRmY+r0Yl7ae0xU5VnfcwCS4osBFU8r6g nY4ztJvBO6mEYMOqK6u04eis5jkgk4K9IZIWycPgBrnQohfCT6SzoYbNhmN4QnmfLCNm fJpxLw0diwmfxLldgMKMR7g+jVrfqR4y34/8O+2y8kvCgvz+kjbNw3vbVLc+pHYgLm6r ALmg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-179852-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-179852-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d9443c01a7336-1ef0bad7968si129535645ad.135.2024.05.15.05.48.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 05:48:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-179852-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-179852-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-179852-linux.lists.archive=gmail.com@vger.kernel.org" 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id F2EB8283790 for ; Wed, 15 May 2024 12:48:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EA9A184D14; Wed, 15 May 2024 12:48:47 +0000 (UTC) Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.46]) (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 C52AD3BB4D; Wed, 15 May 2024 12:48:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715777327; cv=none; b=Hyj7jLkdmckdfeq4yZqzWiDdHUE9O6TZ977VcjpfoPXXkikE1f0CMvU12nfqExYqj03dILkcklZo/PyFkMeJ/ICBPZ98y/2QydX6tkr3DM/VfGysY8lNHtVEBSzkrjgQaRR2qodFFzHXAMIvbmb0H7kqq/tj1RS+A3ICaUtfGGw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715777327; c=relaxed/simple; bh=nprHZDVkoDXa4zAfHxBxTmKTZ9CZ5jcVwcp317JYYaQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=jFiF4JSbSy6Mc9qZHZWllzFNyzPu9KwYWqxEwNPIqfS2c4N6SEsrtXDEj+acyO90eXVvpcxuQgkPlBojyES/HOQaZIOnvsSOz/1ljp3B25YKPD1045nWlcHvAVS7CQdma581EbjGVrQq7vgIATjLfAYPHwrOkxtk/Bih2k2NKr4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.218.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f46.google.com with SMTP id a640c23a62f3a-a5a7d28555bso197009766b.1; Wed, 15 May 2024 05:48:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715777324; x=1716382124; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=sy59NphfPqntinjd5ZYesz8gWQ4Cizffpl3PRbnsf+I=; b=j9Y3Det3WPw8x8Pn1HFr9920DuM1WTKEmTUhrBSdOS9CF6wiipOXyhcxs41Tss25LK vzECFy+SKLBkmCjvszZIIZ4lJklpNgVEHQtYL6ivxZrvYuVLCACdfbo2FYEWMK+8aMre rN8qtDZ5BUI4MSo5GiYDxS3oZtLeAugc6NeNOwMuR+3lZSiws/22qQsQ1x0MGFAF08u7 vnFNnbYgfh2QIrfWinNMsBFNR4uRtDcfcK/xrGuhGEfUmArsP3hyCrJA83lg3HqJWt2l AGh3qFLzJOrNOvtbas7YnPnesnDsrzdoxj8SsWQ8XbHLzSW4DIfcW1jcbwbq8556i3Uu SSJg== X-Forwarded-Encrypted: i=1; AJvYcCVJMuQSkA7DFr/5SLZhujveMMdNsiL14dJ8ajGekR5B+VuheoBqHDXY32/DYg9XTWAAhQWQL769yfdGxPdYGk1irfISVlO+nnwl4ELj1zIIduVYJg1mhMgwYmhK9mc8aGBd+7DFKIn2g4I= X-Gm-Message-State: AOJu0YxoY6EptuCL91FKZqVkGkeIbW0V8evPxneqCsOM4nojlwhKBHxM f3Um6FxikPhfvs4PQAv380JnMbv7lZzNjgQiBQyrbAzq45ljtGfa X-Received: by 2002:a17:906:4150:b0:a59:8fae:f5c8 with SMTP id a640c23a62f3a-a5a2d54c160mr1052783666b.7.1715777324011; Wed, 15 May 2024 05:48:44 -0700 (PDT) Received: from gmail.com (fwdproxy-lla-116.fbsv.net. [2a03:2880:30ff:74::face:b00c]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a5a17b01a2esm851686266b.185.2024.05.15.05.48.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 05:48:43 -0700 (PDT) Date: Wed, 15 May 2024 05:48:41 -0700 From: Breno Leitao To: Marco Elver , paulmck@kernel.org Cc: paulmck@kernel.org, Bart Van Assche , Jens Axboe , "open list:BLOCK LAYER" , open list Subject: Re: [PATCH] block: Annotate a racy read in blk_do_io_stat() Message-ID: References: <4d230bac-bdb0-4a01-8006-e95156965aa8@acm.org> <447ad732-3ff8-40bf-bd82-f7be66899cee@paulmck-laptop> <59ec96c2-52ce-4da1-92c3-9fe38053cd3d@paulmck-laptop> 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=us-ascii Content-Disposition: inline In-Reply-To: On Wed, May 15, 2024 at 09:58:35AM +0200, Marco Elver wrote: > On Wed, 15 May 2024 at 01:47, Paul E. McKenney wrote: > > On Mon, May 13, 2024 at 10:13:49AM +0200, Marco Elver wrote: > > +Use of volatile and __data_racy > > +------------------------------- > > + > > +Adding the volatile keyword to the declaration of a variable causes both > > +the compiler and KCSAN to treat all reads from that variable as if they > > +were protected by READ_ONCE() and all writes to that variable as if they > > +were protected by WRITE_ONCE(). > "volatile" isn't something we encourage, right? In which case, I think > to avoid confusion we should not mention volatile. After all we have > this: Documentation/process/volatile-considered-harmful.rst Since you mentioned this document, the other day I was reading volatile-considered-harmful.rst document, and I was surprised that there is no reference for READ_ONCE() primitive at all (same for WRITE_ONCE). # grep -c READ_ONCE Documentation/process/volatile-considered-harmful.rst 0 From my perspective, READ_ONCE() is another way of doing real memory read (volatile) when you really need, at the same time keeping the compiler free to optimize and reuse the value that was read. Should volatile-considered-harmful.rst be also expanded to cover READ_ONCE()? Thanks! --breno