Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp177591ybl; Wed, 11 Dec 2019 16:08:21 -0800 (PST) X-Google-Smtp-Source: APXvYqzHtFcaEHDo8j5Is3PIO/a4Rf3mDN2g31eaVld4nvXKbdi6G/0xa4HN9H/Ur2iV3fKtuXp4 X-Received: by 2002:a05:6808:210:: with SMTP id l16mr4702488oie.95.1576109301215; Wed, 11 Dec 2019 16:08:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576109301; cv=none; d=google.com; s=arc-20160816; b=r7qdqoW43RKiWLEPkA8DCxuyKeikTaJXSHDtoDZOSvQTjhSDW/L89OJ31K1iqevcy6 V8u6mFGblRxF/InsNovL4xsnY+APKHcPjzVb3wh/aryIyZwpeiREfzTSADdDtHA/BVPX nJn2qGfnzfhPB9EZjQ48VO3fg5fD1FidKP8VNzxJMHKOS8Fq3kPWs8rMmdPMiHidS/yF ctAHfdUpf7QQJdjzkS8CkyK1154xe6y/SDIGrh+9AuFifCxf+GQYdtNz0iyFMffLyebZ SZ7yRk8lO0ogJnzixECHWJ8fSuW9YFbKEGGVAeVeir0UhB5ptGNppyIzyU/n5U99MYTT 4Mlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:mime-version :message-id:date:dkim-signature; bh=+h6zMTJd2eON2xkPbR4jSlI/q1iX/u3EoAW/W4Wdsws=; b=KsnKqi3GWtDRUDnWnSak0f7sAsdz8/lZLXAzsytTvOWBpZHMLCAlIO6eGThRN9WKKY rDoyTHl8ECU5XwbAKrBLk7+vGUZmTygOzg08u6TTgkHO89FOSAxcaSQnE561MBNGiwfN ADCRsgwx3Wr74k1FxtpKGPLuR3Q0T1nm0dlcQY5Sh/+7p0O3IiqOS9H21axQC3asb1ps Hvjq+NerY1fwDHJAoA48TBh0zpFszUJ/MHiob3o/ZatwYPGZOOrE9gO7r9blO9ZUARjP luIDmd/DO4KJWPyno2930QG9tPeZnaayZMEg6KS+W16SOB32lDc6aqlvxY4rclGZz20x exRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=nflDkvqb; 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 d187si2170094oif.33.2019.12.11.16.08.07; Wed, 11 Dec 2019 16:08:21 -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=nflDkvqb; 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 S1727192AbfLLAHh (ORCPT + 99 others); Wed, 11 Dec 2019 19:07:37 -0500 Received: from mail-wr1-f74.google.com ([209.85.221.74]:42022 "EHLO mail-wr1-f74.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727183AbfLLAHh (ORCPT ); Wed, 11 Dec 2019 19:07:37 -0500 Received: by mail-wr1-f74.google.com with SMTP id k18so285872wrw.9 for ; Wed, 11 Dec 2019 16:07:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=+h6zMTJd2eON2xkPbR4jSlI/q1iX/u3EoAW/W4Wdsws=; b=nflDkvqbPW+NXBxKz+/TaxJ+hRiiFKs69ygPo8MTPhzi8E0PkZ+peZFvLmfASHed/C 67AvvgMQ/nqK5GxTUz9HaV8hYhwBZoZBcXMDiGZpCMXhb3sNGlPLeMxAF3RSDICRbdNK o35WYvqsPyaU2TBb9HBA5ILyP1ZmZonwbxmR50dRVLVp36X+Wzl/HzNdJe53pafj4rV1 AAu6wPJEZlHpNXz4J2raFHinOYDTm+/wK/PljSBBAJpidBFID8y2ERpp//5+CGcoS1Id /F4aaJYVvtwFDDQE+WJnF3s0/3s2K+yUNfjdMTLa/n9IOzkAcEfAYnh0sb5rBLbdaSLg N+wA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=+h6zMTJd2eON2xkPbR4jSlI/q1iX/u3EoAW/W4Wdsws=; b=LYnMirY+mLEz9DWO2H6qz9Uc3D377Exa5yIAbLRDynqumGh+PILTDSJCrUZE/v36Jf sTrVfLnwnZzxtNaFeoLaaxJquF8K0D0MR18iHJ823mK2j221yI3FdtAq7ttSg/d3De+7 8nczw7+SxyFa/OQfX7bHTrxN0pRA05j7Ec8gaCW4TALhuPQgXQz5jsSPdfQdKKTLq51F DpTug0jys5lM2C05q27YuYmkyIReuHNuE51LU1KIYNrlvKsb7URHBd6mXowJIMVyAPAE yj9S3ARpiT41c2hqwWOpAJ34G3R5zS4rTGTJ/tpe3/xzqHJePqgITtbyFyzxskdP9ezL oLBw== X-Gm-Message-State: APjAAAUHhvHRWFocXHpU4riMH/PD1zVmxsT3A5UT4nw6aZz5s2Qm5nB8 85L+sETQIV/3EX9Zp7Jlj5XR3cTQHA== X-Received: by 2002:adf:f311:: with SMTP id i17mr2688986wro.81.1576109254697; Wed, 11 Dec 2019 16:07:34 -0800 (PST) Date: Thu, 12 Dec 2019 01:07:08 +0100 Message-Id: <20191212000709.166889-1-elver@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.24.0.525.g8f36a354ae-goog Subject: [PATCH -rcu/kcsan 1/2] kcsan: Document static blacklisting options From: Marco Elver To: elver@google.com Cc: torvalds@linux-foundation.org, paulmck@kernel.org, mingo@kernel.org, peterz@infradead.org, will@kernel.org, tglx@linutronix.de, akpm@linux-foundation.org, stern@rowland.harvard.edu, dvyukov@google.com, mark.rutland@arm.com, parri.andrea@gmail.com, edumazet@google.com, linux-doc@vger.kernel.org, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org 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 Updates the section on "Selective analysis", listing all available options to blacklist reporting data races for: specific accesses, functions, compilation units, and entire directories. These options should provide adequate control for maintainers to opt out of KCSAN analysis at varying levels of granularity. It is hoped to provide the required control to reflect preferences for handling data races across the kernel. Signed-off-by: Marco Elver --- Documentation/dev-tools/kcsan.rst | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/Documentation/dev-tools/kcsan.rst b/Documentation/dev-tools/kcsan.rst index a6f4f92df2fa..65a0be513b7d 100644 --- a/Documentation/dev-tools/kcsan.rst +++ b/Documentation/dev-tools/kcsan.rst @@ -101,18 +101,28 @@ instrumentation or e.g. DMA accesses. Selective analysis ~~~~~~~~~~~~~~~~~~ -To disable KCSAN data race detection for an entire subsystem, add to the -respective ``Makefile``:: +It may be desirable to disable data race detection for specific accesses, +functions, compilation units, or entire subsystems. For static blacklisting, +the below options are available: - KCSAN_SANITIZE := n +* KCSAN understands the ``data_race(expr)`` annotation, which tells KCSAN that + any data races due to accesses in ``expr`` should be ignored and resulting + behaviour when encountering a data race is deemed safe. + +* Disabling data race detection for entire functions can be accomplished by + using the function attribute ``__no_kcsan`` (or ``__no_kcsan_or_inline`` for + ``__always_inline`` functions). To dynamically control for which functions + data races are reported, see the `debugfs`_ blacklist/whitelist feature. -To disable KCSAN on a per-file basis, add to the ``Makefile``:: +* To disable data race detection for a particular compilation unit, add to the + ``Makefile``:: KCSAN_SANITIZE_file.o := n -KCSAN also understands the ``data_race(expr)`` annotation, which tells KCSAN -that any data races due to accesses in ``expr`` should be ignored and resulting -behaviour when encountering a data race is deemed safe. +* To disable data race detection for all compilation units listed in a + ``Makefile``, add to the respective ``Makefile``:: + + KCSAN_SANITIZE := n debugfs ~~~~~~~ -- 2.24.0.525.g8f36a354ae-goog