Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp6736777ybx; Mon, 11 Nov 2019 13:54:29 -0800 (PST) X-Google-Smtp-Source: APXvYqzWHSvTpfT5mO6yVisriFZsKCrXyM+AjYIP61mv0w6wChLgnRL7vPu8g5AZAgKgjoGHu63n X-Received: by 2002:a17:906:f24d:: with SMTP id gy13mr13182089ejb.159.1573509269576; Mon, 11 Nov 2019 13:54:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573509269; cv=none; d=google.com; s=arc-20160816; b=vgrDnb0ywvZPY7OasqskAvq2HaGtJlYPrOQS/GstY9cgawqdpeZKAAwUq2UFQCXXZ+ CywKz5XWE9L/WVFqDHNt2vZqUW6v2DaVhHBx665m1pDINEhGX6REWAugoWbCRGrpqT2R Yf4duOxETHNTlT7X5nFUNzWULozeNyo/nozzJTgvSL3fIzXUuYiFO80DE/bEhyLUxl5d MWh/MBfY7T4UuihPdvTrS8t6/8UXmSjoZ9TozHZa51niINxsV6PNwCrXXpTs7fX1aASe FDsSCnx6XoYKyVGJE/dxQ92QdFP4EMk4HRrvyPp7J/BvYuv+aPl/Tses1KgoTK9w1E/W bgoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=x5dR2X2FPjc0R4vKaFMq42of1ocjgN73FFpV0IAy3Es=; b=w4IiKxJcmPMkU6xx/66LPHKvowCcfdCxm/ddWmXKhBcRIvTJTpXc3JrUiamAy0DLlf KYcW45JJZbnotQRVxD2wWsZreOOa5e6qzqWNRt1V9arZwUGpfPV95XA711W0CO4emj1v tViIogaQSK6f4n/CPc+19BONjSY93EmwGOqTq1TrJ8aI945Jm+Ecayjp41/khLgE3dh6 JbhIpHqQFAfj9J2mb52x145jt238fhZrRZlqEaRja6UxLzPR81iOpUMp7idplXQTLusK CdLEUO5gwyD6gCdASrIGi/IP+q2kiibHfl0Ps2Ksuz4YtME1sNCW5la5LhQZwdGLcSYc n8lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Qy7hsN4r; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id pv8si10581570ejb.108.2019.11.11.13.54.05; Mon, 11 Nov 2019 13:54:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Qy7hsN4r; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726928AbfKKVxV (ORCPT + 99 others); Mon, 11 Nov 2019 16:53:21 -0500 Received: from mail-il1-f179.google.com ([209.85.166.179]:41559 "EHLO mail-il1-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726877AbfKKVxV (ORCPT ); Mon, 11 Nov 2019 16:53:21 -0500 Received: by mail-il1-f179.google.com with SMTP id q15so8388260ils.8 for ; Mon, 11 Nov 2019 13:53:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=x5dR2X2FPjc0R4vKaFMq42of1ocjgN73FFpV0IAy3Es=; b=Qy7hsN4rNqDIsADEty2zFKc9T419wkbTgjhkrGwsJBb0mS8oAXBvZmLuLbksEbS967 AS7SumZJtySJk+Uo7BlorvhZJ/5b9I8wZEi62BArK7PTRkStJ7lOmT7lWRpD/TaXyk5T l6oBe+cBgOHBhzLF0fHedCG3gbw2w7v8poM7XnJ2Wn09xLoLqO1YnMHVB6a1ePNU/BV1 lnf39TjhLmTLV75aN6SI7p8VuObJkzj5PtJamPDhv3MorHUDsDjxbKsoeHQDmWdX35/+ dxJpPyl8uSV6uOrQzRkX654Dtdl5cZVmvYrKkMIcy8V2OMcGBQiHwjzO8KfKmXXoHsZ1 IFcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=x5dR2X2FPjc0R4vKaFMq42of1ocjgN73FFpV0IAy3Es=; b=Xfjx2YhiBp3Y1IofMzfKBO/RH7ugSPcts0S3PW0gCpQd+NgDmzZJ18iQ3LSt3dvq/E 2Isuwb6PX1TbapoCHtoyx3uzJJ+cuEXJoc50p+bbHgAFx5Z5BHskvfrkGKSkxiqM5TxL 6yiWEPUW+T6E9kpGTSjhbld5hentEP/zNp9tZJtfzEODmzKDoEFiOQDEqdy+jk5Bm3VQ cuAervj3/u+rnIFArwfcqCSrfsIi8jNM79kkvOrYgBjzGdHKEagZLDGFuzjgA2a7J7Bf D6MiMShIRIZ3XPPY3aged/VN/EgiH2A1FlMNf5tGeTmuwJdPwejksLie/FWrPjuPdD5h pvKw== X-Gm-Message-State: APjAAAUkIgDTdy7plbNAxxC7pigGH5GE++a0AsR8/RRMRWmHyPhZ2WFO CWCECRlBb5U6HHMqyDpIZBnPBQTtetILOlY1Lx4KjQ== X-Received: by 2002:a92:99cb:: with SMTP id t72mr29681319ilk.218.1573509199768; Mon, 11 Nov 2019 13:53:19 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Eric Dumazet Date: Mon, 11 Nov 2019 13:53:07 -0800 Message-ID: Subject: Re: KCSAN: data-race in __alloc_file / __alloc_file To: Linus Torvalds Cc: Alan Stern , Marco Elver , Eric Dumazet , syzbot , linux-fsdevel , Linux Kernel Mailing List , syzkaller-bugs , Al Viro , Andrea Parri , "Paul E. McKenney" , LKMM Maintainers -- Akira Yokosawa Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 11, 2019 at 12:47 PM Linus Torvalds wrote: > > On Mon, Nov 11, 2019 at 12:43 PM Linus Torvalds > wrote: > > > > Yeah, maybe we could have some model for marking "this is statistics, > > doesn't need to be exact". > > Side note: that marking MUST NOT be "READ_ONCE + WRITE_ONCE", because > that makes gcc create horrible code, and only makes the race worse. > > At least with a regular add, it might stay as a single r-m-w > instruction on architectures that have that, and makes the quality of > the statistics slightly better (no preemption etc). > > So that's an excellent example of where changing code to use > WRITE_ONCE actually makes the code objectively worse in practice - > even if it might be the same in theory. Yes, I believe that was the rationale of the ADD_ONCE() thing I mentioned earlier. I do not believe we have a solution right now ? We have similar non atomic increments in some virtual network drivers doing "dev->stats.tx_errors++;" in their error path.