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=-2.4 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 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 18130C47E49 for ; Wed, 23 Oct 2019 16:24:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E19E221A4C for ; Wed, 23 Oct 2019 16:24:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="aRXrGlK6" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407252AbfJWQYs (ORCPT ); Wed, 23 Oct 2019 12:24:48 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:60101 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2404822AbfJWQYr (ORCPT ); Wed, 23 Oct 2019 12:24:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571847887; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eanOm+wc4jMiTMvGZZMqtnxXgjKabvAJwYAPnub5fDU=; b=aRXrGlK6nW9STh26MP1i9tGRoLNhbL30i8GgsZ0Pgs/oDlSj0BkDp/Qtp+j0YrkI1HzF0B YYbH4l+8L85mJKH3kxw4CZWJv9mro3Ez9rDokap2RUHnxcyoUhjoMlfGkSo49RM/YWAZhP NteRVnptFFYq9zOy78qDHJjTgI5cAv4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-361-nn_WxBf4PueDGKR47J5rTQ-1; Wed, 23 Oct 2019 12:24:43 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EB51780183D; Wed, 23 Oct 2019 16:24:39 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.43.17.44]) by smtp.corp.redhat.com (Postfix) with SMTP id 364AE6362F; Wed, 23 Oct 2019 16:24:33 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Wed, 23 Oct 2019 18:24:39 +0200 (CEST) Date: Wed, 23 Oct 2019 18:24:32 +0200 From: Oleg Nesterov To: Marco Elver Cc: LKMM Maintainers -- Akira Yokosawa , Alan Stern , Alexander Potapenko , Andrea Parri , Andrey Konovalov , Andy Lutomirski , Ard Biesheuvel , Arnd Bergmann , Boqun Feng , Borislav Petkov , Daniel Axtens , Daniel Lustig , Dave Hansen , David Howells , Dmitry Vyukov , "H. Peter Anvin" , Ingo Molnar , Jade Alglave , Joel Fernandes , Jonathan Corbet , Josh Poimboeuf , Luc Maranget , Mark Rutland , Nicholas Piggin , "Paul E. McKenney" , Peter Zijlstra , Thomas Gleixner , Will Deacon , kasan-dev , linux-arch , "open list:DOCUMENTATION" , linux-efi@vger.kernel.org, Linux Kbuild mailing list , LKML , Linux Memory Management List , the arch/x86 maintainers Subject: Re: [PATCH v2 1/8] kcsan: Add Kernel Concurrency Sanitizer infrastructure Message-ID: <20191023162432.GC14327@redhat.com> References: <20191017141305.146193-1-elver@google.com> <20191017141305.146193-2-elver@google.com> <20191022154858.GA13700@redhat.com> MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: nn_WxBf4PueDGKR47J5rTQ-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/22, Marco Elver wrote: > > On Tue, 22 Oct 2019 at 17:49, Oleg Nesterov wrote: > > > > Just for example. Suppose that task->state =3D TASK_UNINTERRUPTIBLE, th= is task > > does __set_current_state(TASK_RUNNING), another CPU does wake_up_proces= s(task) > > which does the same UNINTERRUPTIBLE -> RUNNING transition. > > > > Looks like, this is the "data race" according to kcsan? > > Yes, they are "data races". They are probably not "race conditions" thoug= h. > > This is a fair distinction to make, and we never claimed to find "race > conditions" only I see, thanks, just wanted to be sure... > KCSAN's goal is to find *data races* according to the LKMM. Some data > races are race conditions (usually the more interesting bugs) -- but > not *all* data races are race conditions. Those are what are usually > referred to as "benign", but they can still become bugs on the wrong > arch/compiler combination. Hence, the need to annotate these accesses > with READ_ONCE, WRITE_ONCE or use atomic_t: Well, if I see READ_ONCE() in the code I want to understand why it was used. Is it really needed for correctness or we want to shut up kcsan? Say, why should wait_event(wq, *ptr) use READ_ONCE()? Nevermind, please forget. Btw, why __kcsan_check_watchpoint() does user_access_save() before try_consume_watchpoint() ? Oleg.