Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp571168ybm; Thu, 28 May 2020 09:42:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzrKasT2vKfIjDfQjkvphmnbSPoWzEGbPI8UHALLcPc2HiuewA5df7Rnb2r/40uWmGZeT2S X-Received: by 2002:a17:906:194b:: with SMTP id b11mr3660759eje.159.1590684122723; Thu, 28 May 2020 09:42:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590684122; cv=none; d=google.com; s=arc-20160816; b=l510pNp3gote+Dr71FL90GlQBe2UcivOgAEVd5KbYsyo252sy3QGmYJFBruLiDtxSs eNrTKm2vbopK1cgXjG5D3EJ/XU/ehoG/OGC5ZIbnYpQRGiYbCb3UmfDJTZ2BDfDwRVUI Ipohlp/tEnKyTHu4d8nk3yv9wfuWYaPZ2HlF1esVoUHQ00O//XOn9GmNKDvl6s+zBV6M XulQsXMndKvpT45Evxehehpfahy9ZE+fea0zeVbAZaGuHX8oURfVGRfFaU4CMmEr8bGF 2VoKfnXm6iXf+JUwIFB2J5bV1N4NTkHCH4P8kF7Y7pAjwLXfHFqatq/T0NdhpBB+zlst ptCg== 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 :reply-to:in-reply-to:references:mime-version:dkim-signature; bh=b49uRRn6kGfrBFDUIRU2bZkw+wlzpFf1iaU7drJseCA=; b=Uaw/OR0HM6Q5vru1Zl8tqHgw2d8ZHB/U8D3meOujuA9Fxs+rh2Wp0mJUbMLWI5e2HC Jx/FMtXmIX+NZLIddyWc1P6Hmd679okaL68m7W4vGt22/vvVX51Qd7NCl7Zk1IEaVOP8 8XH/75lxNtBZ2WKDOTW8U5NgOlyiO7rBhy+4fe0wMRIXcMbHGvNywza64fXpR6xLRsIc 44ZlChCmQdMUO0gRKtZlSgxbzgIV3S/r2DNTFPhv5qs9ysmn5pi8ywqrHuxcG3fzylHx RBXzDeHB02sFCxhY7DXL5HRlB2kFH7T89f0wEiW+0NMWq2qJrxYDe05FhmvppcaYD8IK vWzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="TQkg3Z/E"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 24si3272704ejy.536.2020.05.28.09.41.38; Thu, 28 May 2020 09:42:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="TQkg3Z/E"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405147AbgE1Qjo (ORCPT + 99 others); Thu, 28 May 2020 12:39:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405042AbgE1Qjm (ORCPT ); Thu, 28 May 2020 12:39:42 -0400 Received: from mail-io1-xd42.google.com (mail-io1-xd42.google.com [IPv6:2607:f8b0:4864:20::d42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2A31C08C5C6 for ; Thu, 28 May 2020 09:39:41 -0700 (PDT) Received: by mail-io1-xd42.google.com with SMTP id o5so30672363iow.8 for ; Thu, 28 May 2020 09:39:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:reply-to:from:date:message-id :subject:to:cc; bh=b49uRRn6kGfrBFDUIRU2bZkw+wlzpFf1iaU7drJseCA=; b=TQkg3Z/EVD8YVnUxgGDqSJyHE9iBgQe3Zuj5/VLLzaKcpc4fAD6BxqMR0oKTdWGBSo Z2/x46l+omTRRBESnQiNxT2C14gvD70DpyfkStQpXFHS/4H5ccTznK3j1Jl1Wa5Qg+pA W+4RGV5EaCaSb41CXrxBGsAlDN9BvBnXPZMNAcHofuxLXyqHOYtrx1vw2yaS6l/A8agz T987LnsaBisr4FIj1glHsnyy8M/YnRqFBgNkjxBqWhLnCaTH1R6qT9+SWpxy1A8oymLX 0l4Cnu104sHQ+l99P8r29dD4NqTvJCo7rbk+DAVUTPVQ7TUay8FU64SAwkD9vUA3SipH nnzg== 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:reply-to :from:date:message-id:subject:to:cc; bh=b49uRRn6kGfrBFDUIRU2bZkw+wlzpFf1iaU7drJseCA=; b=i3xdqwme2JJWYZ48JjfFfcQsjPdFXEC1ckDBtuDsUd3fPiPAWOpEZiS6IuJ58OduLQ AA9UZZpC04qnDyQ8OU3b6/Jw+ZevskryBIxWA3ZCdNtIpXt+f+DKdYMKQG9LhVaI1RZJ d+zHOoj9omcn3n/68ADhUrD+OY0827CHVYMcVjoLzacTt/SU6kQQcM1jrO8KrDpDEOxt 5FXPvvVoRKWBiyd0scgy/oillUGmq8Hdnh8x3ycWL9yjZeZVymtRhIpewcWAwAQqbJzT YGX0cYXlT4gl1naDeV+IWMzaBg4Intqo9j1oRnuFrPKDEJTUFvqMQnoMCOAiYFvO4jMP w9Dw== X-Gm-Message-State: AOAM532i+KCh6YUKxBZhoTBaWz/IG1LS03MEpsLyT0yDQ293lrg7cv5t s20JBW3lRt6ymmJ8IMR6+fXydW/wTKMo4YIpwtY= X-Received: by 2002:a02:ca18:: with SMTP id i24mr3395552jak.70.1590683981110; Thu, 28 May 2020 09:39:41 -0700 (PDT) MIME-Version: 1.0 References: <20200527103236.148700-1-elver@google.com> In-Reply-To: Reply-To: sedat.dilek@gmail.com From: Sedat Dilek Date: Thu, 28 May 2020 18:39:42 +0200 Message-ID: Subject: Re: [PATCH -tip] compiler_types.h: Optimize __unqual_scalar_typeof compilation time To: Marco Elver Cc: Arnd Bergmann , Will Deacon , Peter Zijlstra , Borislav Petkov , Thomas Gleixner , Ingo Molnar , clang-built-linux , "Paul E. McKenney" , Dmitry Vyukov , Alexander Potapenko , Andrey Konovalov , kasan-dev , "linux-kernel@vger.kernel.org" , Nick Desaulniers , Stephen Rothwell 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 Thu, May 28, 2020 at 5:16 PM Marco Elver wrote: > > On Thu, 28 May 2020 at 04:12, Sedat Dilek wrote: > > > [...] > > > > > > > > > > > In general, CONFIG_KCSAN=y and the defaults for the other KCSAN > > > > > options should be good. Depending on the size of your system, you > > > > > could also tweak KCSAN runtime performance: > > > > > https://lwn.net/Articles/816850/#Interacting%20with%20KCSAN%20at%20Runtime > > > > > -- the defaults should be good for most systems though. > > > > > Hope this helps. Any more questions, do let me know. > > > > > > > > > > > > > Which "projects" and packages do I need? > > > > > > > > I have installed: > > > > > > > > # LC_ALL=C apt-get install llvm-11 clang-11 lld-11 > > > > --no-install-recommends -t llvm-toolchain -y > > > > > > > > # dpkg -l | grep > > > > 1:11~++20200527111130+65030821d4a-1~exp1~20200527091804.3261 | awk > > > > '/^ii/ {print $1 " " $2 " " $3}' | column -t > > > > ii clang-11 > > > > 1:11~++20200527111130+65030821d4a-1~exp1~20200527091804.3261 > > > > ii libclang-common-11-dev > > > > 1:11~++20200527111130+65030821d4a-1~exp1~20200527091804.3261 > > > > ii libclang-cpp11 > > > > 1:11~++20200527111130+65030821d4a-1~exp1~20200527091804.3261 > > > > ii libclang1-11 > > > > 1:11~++20200527111130+65030821d4a-1~exp1~20200527091804.3261 > > > > ii libllvm11:amd64 > > > > 1:11~++20200527111130+65030821d4a-1~exp1~20200527091804.3261 > > > > ii lld-11 > > > > 1:11~++20200527111130+65030821d4a-1~exp1~20200527091804.3261 > > > > ii llvm-11 > > > > 1:11~++20200527111130+65030821d4a-1~exp1~20200527091804.3261 > > > > ii llvm-11-runtime > > > > 1:11~++20200527111130+65030821d4a-1~exp1~20200527091804.3261 > > > > > > > > Is that enough? > > > > > > Just clang-11 (and its transitive dependencies) is enough. Unsure what > > > your installed binary is, likely "clang-11", so if you can do "make > > > CC=clang-11 defconfig" (and check for CONFIG_HAVE_KCSAN_COMPILER) > > > you're good to go. > > > > > > > I was able to build with clang-11 from apt.llvm.org. > > > > [ build-time ] > > > > Normally, it takes me approx. 05:00 to build with clang-10 > > (10.0.1-rc1) and Linux v5.7-rc7. > > > > This time start: 21:18 and stop: 03:45 means 06:27 - took 01:27 longer. > > > > Samsung Ultrabook 2nd generation aka Intel Sandybridge CPU with 'make -j3'. > > > > [ diffconfig ] > > > > BUILD_SALT "5.7.0-rc7-2-amd64-clang" -> "5.7.0-rc7-3-amd64-clang" > > CLANG_VERSION 100001 -> 110000 > > +CC_HAS_ASM_INLINE y > > +HAVE_ARCH_KCSAN y > > +HAVE_KCSAN_COMPILER y > > +KCSAN y > > +KCSAN_ASSUME_PLAIN_WRITES_ATOMIC y > > +KCSAN_DEBUG n > > +KCSAN_DELAY_RANDOMIZE y > > +KCSAN_EARLY_ENABLE y > > +KCSAN_IGNORE_ATOMICS n > > +KCSAN_INTERRUPT_WATCHER n > > +KCSAN_NUM_WATCHPOINTS 64 > > +KCSAN_REPORT_ONCE_IN_MS 3000 > > +KCSAN_REPORT_RACE_UNKNOWN_ORIGIN y > > +KCSAN_REPORT_VALUE_CHANGE_ONLY y > > +KCSAN_SELFTEST y > > +KCSAN_SKIP_WATCH 4000 > > +KCSAN_SKIP_WATCH_RANDOMIZE y > > +KCSAN_UDELAY_INTERRUPT 20 > > +KCSAN_UDELAY_TASK 80 > > > > I am seeing this data-races: > > > > root@iniza:~# LC_ALL=C dmesg -T | grep 'BUG: KCSAN: data-race' > > [Thu May 28 03:51:53 2020] BUG: KCSAN: data-race in > > mutex_spin_on_owner+0xe0/0x1b0 > > [Thu May 28 03:52:00 2020] BUG: KCSAN: data-race in mark_page_accessed > > / workingset_activation > > [Thu May 28 03:52:02 2020] BUG: KCSAN: data-race in > > mutex_spin_on_owner+0xe0/0x1b0 > > [Thu May 28 03:52:08 2020] BUG: KCSAN: data-race in > > blk_mq_sched_dispatch_requests / blk_mq_sched_dispatch_requests > > [Thu May 28 03:52:10 2020] BUG: KCSAN: data-race in dd_has_work / > > dd_insert_requests > > [Thu May 28 03:52:11 2020] BUG: KCSAN: data-race in > > mutex_spin_on_owner+0xe0/0x1b0 > > [Thu May 28 03:52:13 2020] BUG: KCSAN: data-race in > > page_counter_try_charge / page_counter_try_charge > > [Thu May 28 03:52:15 2020] BUG: KCSAN: data-race in ep_poll_callback / > > ep_send_events_proc > > [Thu May 28 03:52:21 2020] BUG: KCSAN: data-race in > > mutex_spin_on_owner+0xe0/0x1b0 > > [Thu May 28 03:52:25 2020] BUG: KCSAN: data-race in > > mutex_spin_on_owner+0xe0/0x1b0 > > [Thu May 28 03:52:26 2020] BUG: KCSAN: data-race in dd_has_work / > > deadline_remove_request > > [Thu May 28 03:52:31 2020] BUG: KCSAN: data-race in dd_has_work / > > deadline_remove_request > > [Thu May 28 03:52:38 2020] BUG: KCSAN: data-race in dd_has_work / > > deadline_remove_request > > [Thu May 28 03:52:53 2020] BUG: KCSAN: data-race in dd_has_work / > > dd_insert_requests > > [Thu May 28 03:52:56 2020] BUG: KCSAN: data-race in dd_has_work / > > deadline_remove_request > > [Thu May 28 03:52:59 2020] BUG: KCSAN: data-race in > > blk_mq_sched_dispatch_requests / blk_mq_sched_dispatch_requests > > [Thu May 28 03:53:25 2020] BUG: KCSAN: data-race in > > rwsem_spin_on_owner+0x102/0x1a0 > > [Thu May 28 03:53:25 2020] BUG: KCSAN: data-race in > > page_counter_try_charge / page_counter_try_charge > > [Thu May 28 03:53:39 2020] BUG: KCSAN: data-race in do_epoll_wait / > > ep_poll_callback > > [Thu May 28 03:53:39 2020] BUG: KCSAN: data-race in find_next_and_bit+0x30/0xd0 > > [Thu May 28 03:53:41 2020] BUG: KCSAN: data-race in dd_has_work / > > dd_insert_requests > > [Thu May 28 03:53:43 2020] BUG: KCSAN: data-race in do_epoll_wait / > > ep_poll_callback > > [Thu May 28 03:53:45 2020] BUG: KCSAN: data-race in dd_has_work / > > dd_insert_requests > > [Thu May 28 03:53:46 2020] BUG: KCSAN: data-race in > > blk_mq_sched_dispatch_requests / blk_mq_sched_dispatch_requests > > [Thu May 28 03:53:47 2020] BUG: KCSAN: data-race in > > rwsem_spin_on_owner+0x102/0x1a0 > > [Thu May 28 03:54:02 2020] BUG: KCSAN: data-race in dd_has_work / > > deadline_remove_request > > [Thu May 28 03:54:11 2020] BUG: KCSAN: data-race in find_next_and_bit+0x30/0xd0 > > [Thu May 28 03:54:19 2020] BUG: KCSAN: data-race in > > rwsem_spin_on_owner+0x102/0x1a0 > > [Thu May 28 03:55:00 2020] BUG: KCSAN: data-race in > > mutex_spin_on_owner+0xe0/0x1b0 > > [Thu May 28 03:56:14 2020] BUG: KCSAN: data-race in dd_has_work / > > deadline_remove_request > > [Thu May 28 03:56:50 2020] BUG: KCSAN: data-race in dd_has_work / > > deadline_remove_request > > [Thu May 28 03:56:50 2020] BUG: KCSAN: data-race in dd_has_work / > > deadline_remove_request > > [Thu May 28 03:56:52 2020] BUG: KCSAN: data-race in > > tick_nohz_next_event / tick_nohz_stop_tick > > [Thu May 28 03:56:58 2020] BUG: KCSAN: data-race in > > blk_mq_sched_dispatch_requests / blk_mq_sched_dispatch_requests > > [Thu May 28 03:57:58 2020] BUG: KCSAN: data-race in > > blk_mq_sched_dispatch_requests / blk_mq_sched_dispatch_requests > > [Thu May 28 03:58:00 2020] BUG: KCSAN: data-race in dd_has_work / > > deadline_remove_request > > [Thu May 28 03:58:07 2020] BUG: KCSAN: data-race in > > tick_nohz_next_event / tick_nohz_stop_tick > > [Thu May 28 03:58:44 2020] BUG: KCSAN: data-race in > > mutex_spin_on_owner+0xe0/0x1b0 > > [Thu May 28 03:58:49 2020] BUG: KCSAN: data-race in __bitmap_subset+0x38/0xd0 > > [Thu May 28 03:59:46 2020] BUG: KCSAN: data-race in > > tick_nohz_next_event / tick_nohz_stop_tick > > [Thu May 28 04:00:25 2020] BUG: KCSAN: data-race in dd_has_work / > > deadline_remove_request > > [Thu May 28 04:00:26 2020] BUG: KCSAN: data-race in > > tick_nohz_next_event / tick_nohz_stop_tick > > > > Full dmesg output and linux-config attached. > > Thank you for the report. There are a number of known data races. Note > that, we do not think it's wise to rush fixes for data races, > especially because each one requires careful analysis of what the > appropriate response is. In the meantime, also have a look at these 2 > articles (if you haven't already), which describes the current state > of things: > > 1. https://lwn.net/Articles/816850/ > 2. https://lwn.net/Articles/816854/ > Hi Marco, thanks for your feedback. The first article I have read already. That does not mean I am a KCSAN expert now. As you say each data-race needs an individual analysis. Just one last number: Building again a Linux v5.7-rc7 on a clang-11-compiled and kcsan-enabled linux-kernel took me... one hour longer (6 instead of 5 hours, start: 12:14 and stop: 18:15) Regards, - Sedat -