From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.4 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4334BC5DF60 for ; Fri, 8 Nov 2019 17:56:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1421320673 for ; Fri, 8 Nov 2019 17:56:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="V8oNGLl6" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731238AbfKHR4D (ORCPT ); Fri, 8 Nov 2019 12:56:03 -0500 Received: from mail-io1-f41.google.com ([209.85.166.41]:38255 "EHLO mail-io1-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730114AbfKHR4D (ORCPT ); Fri, 8 Nov 2019 12:56:03 -0500 Received: by mail-io1-f41.google.com with SMTP id i13so5942473ioj.5 for ; Fri, 08 Nov 2019 09:56:02 -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=MIOSuIKsUyxB2M4djsqhXbm2T/JzMnIFwkmpg6fA+Ms=; b=V8oNGLl6qjTwrqheJvYzesqyiTnVno/IaIKZP7pJ0WT49dXpmErqA83AXZMdzOh2SG Je/FJRqdTlTebSps9vRJEZZnhUyn6Fj2UBX5ciMlsYJKfUxgPInxODDuST1cz+4KMYNH SuNHQQsWbmzYnw3dfuGcLU/7NjZxthkcmPq5okSnoxlVARkA/OdPsgIZoXLnMAOlMt7S zTdXwAgGiSxiPRc2XWy0p5rvSHw2pg+QxEvL49oKQfyV/NZQn634FIvPKmy17CH6ObwM 7wbxbM4eY+lazZepLnUuSJ+f5XQM2rzBJYrjP0t2GzSa+cDpnD9udXUOflC/ynZOoMuK aKRw== 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=MIOSuIKsUyxB2M4djsqhXbm2T/JzMnIFwkmpg6fA+Ms=; b=WQg3GYycyBa1LQ+Ont1rHSOt9UJsiPOLxfLmy/uov+yP5rUC+xbvdakMzh9cpi6ic4 9tDV8li9YwdahRQNKYowbbpzczBP1sFzwJWibzVaPmgB9N7TYkEHQIRhQzldg7+QKGdu 8nT9/giGgmEuyOWyelaRh5ltAATSFtU1fHihdDsta0z4R8aAL1cepXE4EqQ2nADtD/Sw XjoD3/2qCTHoRegBO4nifOEIhpbLsHWkmXFA9XoJRx8cMdDviIc3Vmm7xHRu3k6GUhgS 4B6d+vvw+6CKiD7PEpxJsybqNSxREQ0Fi9WFrVavf4gx8sEVnAWuNTddSHopqXPQlayt MQXA== X-Gm-Message-State: APjAAAV0ESD+alexKfGYGHDWFXN3i12YaMWCIe23OrTdKN0fkxHkjeso 6KJCrRNzXi8quwhM7M2loPucFqpp24hCS3gnGAR2eg== X-Google-Smtp-Source: APXvYqw5kzvzbfFmFDbCNHG+gzaOMReqKjx6GVYSfTWVORZ0fuGL3qIL3c2gzxQ4/m2ex05aMkaCgR5t4+n0/KB6Phs= X-Received: by 2002:a5d:8953:: with SMTP id b19mr12142211iot.168.1573235761783; Fri, 08 Nov 2019 09:56:01 -0800 (PST) MIME-Version: 1.0 References: <000000000000c422a80596d595ee@google.com> <6bddae34-93df-6820-0390-ac18dcbf0927@gmail.com> In-Reply-To: From: Eric Dumazet Date: Fri, 8 Nov 2019 09:55:50 -0800 Message-ID: Subject: Re: KCSAN: data-race in __alloc_file / __alloc_file To: Linus Torvalds Cc: Eric Dumazet , syzbot , Marco Elver , linux-fsdevel , Linux Kernel Mailing List , syzkaller-bugs , Al Viro Content-Type: text/plain; charset="UTF-8" Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Archived-At: List-Archive: List-Post: On Fri, Nov 8, 2019 at 9:53 AM Eric Dumazet wrote: > > On Fri, Nov 8, 2019 at 9:39 AM Linus Torvalds > wrote: > > > I'd hope that there is some way to mark the cases we know about where > > we just have a flag. I'm not sure what KCSAN uses right now - is it > > just the "volatile" that makes KCSAN ignore it, or are there other > > ways to do it? > > I dunno, Marco will comment on this. > > I personally like WRITE_ONCE() since it adds zero overhead on generated code, > and is the facto accessor we used for many years (before KCSAN was conceived) > BTW, I would love an efficient ADD_ONCE(variable, value) Using WRITE_ONCE(variable, variable + value) is not good, since it can not use the optimized instructions operating directly on memory.