Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp2063940ybg; Thu, 24 Oct 2019 04:19:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqxop7k3aCLRSlYR5PouqvA9Wn99UmD64WRJ0PmoeKEqeYBtjVN2o4BxRDk1GPJY2cxj302u X-Received: by 2002:aa7:d305:: with SMTP id p5mr1387601edq.80.1571915994205; Thu, 24 Oct 2019 04:19:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571915994; cv=none; d=google.com; s=arc-20160816; b=AZYmWn4nsX5SecvRPNPXDCkJMtK4NG4hTYUeRievCMlsUpYJ9BJ7Z7NzpYK4KcEs3E y3M4TXxB8zPCJ6FE71BbBA7FBU1WPJJbdOP/P+yDylL7EW9roPrM40vCdTIl8vbyz7vf gZGYnlLJwGHnf1IrKGuo3Q0VelR1ZBHIcTIgtflbTyXwgntJARdOORspb3epnRLIFmd8 as4/EjT5HRG10zp+QCWyFFRv+nR89GRyUV4mZciOOJcwO9chEauVQnim4Nqb3IAb2qCn z3tRZfp5D/9HVnl1zGO/Xn1mVcSEkBJ8Uxv0AtWkXkGEJVvA+oNUa2M+wnBe2wxblgnr HxPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:user-agent:in-reply-to:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=eanOm+wc4jMiTMvGZZMqtnxXgjKabvAJwYAPnub5fDU=; b=nwjCowNJkgtWhTSDa+0ufAEmQB+prR+yIy3c+6fShl+woY58XMbncVWPaAHd935aOX LAfJgrjNrOh8eBB/bZbrIywtIVbUSzZTPn2VwVN5v8PwRkcHMOXpj7t9tm/s/Lql/cZn xBAw1zdaxkb8pH6iJZXrU5o457XBpP34aTtp24G+Y/NbVcjGycoh2QTUNXQdOPCiYQde eoQX0BK5npKTKLT2woilCWuVXVh6qgWYnV8f9llJNzjUR36M5TuX40b6L9gul6Qn1Dof 0PcMQbKzO4DGRUcjF5AUfVGp0rQpj082IA8TmcCVc5aekJrnWY3iG+/Bsw8aQgi4Mpwb OuNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=aRXrGlK6; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e15si9310803ejt.370.2019.10.24.04.19.29; Thu, 24 Oct 2019 04:19:54 -0700 (PDT) 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=@redhat.com header.s=mimecast20190719 header.b=aRXrGlK6; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407247AbfJWQYs (ORCPT + 99 others); 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.