Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1064438iog; Mon, 13 Jun 2022 20:37:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzs6uhIRREAEZvBLaxecnpGdM+ZI03kirfM5zKFsToBCQMuF2KZuJpPmJGKMwyX+iwE6f7o X-Received: by 2002:a63:fe16:0:b0:3fe:3f58:dcff with SMTP id p22-20020a63fe16000000b003fe3f58dcffmr2637370pgh.342.1655177823306; Mon, 13 Jun 2022 20:37:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655177823; cv=none; d=google.com; s=arc-20160816; b=PnwOL+tIOuyxqD5SpHkQ8vey4q21csFlKOCbQCQARxkJJvs+fFoC4G+3MNITCyzPNd P46qIcID4Hp0878Xl5ThIUOz5Sd8HUD10R7Exd7qMd4hfcy7GqMemSedC0tlELdIx2nx pT/M2mbhci28vsJW+M74rG9DMsoelD1tEnAf3BfCQcIQGj2+N4nXpTLvzeCwK7IeOQkh FpkCoYhLBhRJ7e1l0D55JZhYnR4d5yUK7A8SJGlHsAsx2WvjDgnYDmlgmGJ8cCjTX5Hn fidigQlD0N1wqOv3AeA6/lEwigNIc5oyMoCdkVpOz+ccD6toDSCpOPl08ZQ12NRg7MkQ J3mA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=g3mqYamZ9ECxMTH2OhgonHSi3DzY5xW7LdRVI7ZvpIQ=; b=hq83b2OjhS8Uu7kvHdUrlk85ptyHI8uuDKqTfCytMdTOurbS7E5ur/GvApCH6dIwA0 0kQyAK/syCw+9uk7vruhTpvtILPXMxGzfcDls1lHs5YlejSEBOEOIsgJWbfpo/xEGYxI /fOwgLQYufUD0sy8nYyKWX6xMQ58mf3RuN1Wv4vgKzl4zKaqh1AtQI6u79PqybERcpvi Yrw6NZa2OzsgETbOArl5TTk3+LtMeleYThB9zK+eVP7LnA5b4+RmbVXIErnqjqKYB3pP 3HO6IRuGDkkVrzxwIs+0jgSuyZSlIAM/KLKlUv60BAETNgQc2k49Kf0oAkWXHWZOKmRe tlsg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c12-20020a170902c2cc00b001542a6e4c9bsi4676523pla.485.2022.06.13.20.36.47; Mon, 13 Jun 2022 20:37:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245702AbiFNDUQ (ORCPT + 99 others); Mon, 13 Jun 2022 23:20:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351355AbiFNDUN (ORCPT ); Mon, 13 Jun 2022 23:20:13 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 207412E69C; Mon, 13 Jun 2022 20:20:12 -0700 (PDT) Received: from dggpemm500024.china.huawei.com (unknown [172.30.72.55]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4LMYZm4jndzDrD4; Tue, 14 Jun 2022 11:19:44 +0800 (CST) Received: from dggpemm500001.china.huawei.com (7.185.36.107) by dggpemm500024.china.huawei.com (7.185.36.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 14 Jun 2022 11:20:09 +0800 Received: from [10.174.177.243] (10.174.177.243) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 14 Jun 2022 11:20:08 +0800 Message-ID: <2737609c-78d9-b679-f2d6-a681614f68b5@huawei.com> Date: Tue, 14 Jun 2022 11:20:07 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH v4 2/2] arm64: kcsan: Support detecting more missing memory barriers Content-Language: en-US To: Mark Rutland CC: , , , , , Jonathan Corbet , , References: <20220523113126.171714-1-wangkefeng.wang@huawei.com> <20220523113126.171714-3-wangkefeng.wang@huawei.com> From: Kefeng Wang In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.243] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Will and Catalin, kindly ping... On 2022/5/23 22:16, Mark Rutland wrote: > On Mon, May 23, 2022 at 07:31:26PM +0800, Kefeng Wang wrote: >> As "kcsan: Support detecting a subset of missing memory barriers"[1] >> introduced KCSAN_STRICT/KCSAN_WEAK_MEMORY which make kcsan detects >> more missing memory barrier, but arm64 don't have KCSAN instrumentation >> for barriers, so the new selftest test_barrier() and test cases for >> memory barrier instrumentation in kcsan_test module will fail, even >> panic on selftest. >> >> Let's prefix all barriers with __ on arm64, as asm-generic/barriers.h >> defined the final instrumented version of these barriers, which will >> fix the above issues. >> >> Note, barrier instrumentation that can be disabled via __no_kcsan with >> appropriate compiler-support (and not just with objtool help), see >> commit bd3d5bd1a0ad ("kcsan: Support WEAK_MEMORY with Clang where no >> objtool support exists"), it adds disable_sanitizer_instrumentation to >> __no_kcsan attribute which will remove all sanitizer instrumentation fully >> (with Clang 14.0). Meanwhile, GCC does the same thing with no_sanitize. >> >> [1] https://lore.kernel.org/linux-mm/20211130114433.2580590-1-elver@google.com/ >> >> Acked-by: Marco Elver >> Signed-off-by: Kefeng Wang > Having built this with GCC 12.1.0 and LLVM 14.0.0, I think this patch itself > doesn't introduce any new problems, and logically makes sense. With that in > mind: > > Acked-by: Mark Rutland > > As an aside, having scanned the resulting vmlinux with objdump, there are > plenty of latent issues where we get KCSAN instrumentation where we don't want > it (e.g. early/late in arm64's entry-common.o). The bulk of those are due to > missing `nonistr` or `__always_inline`, which we'll need to fix up. > > Thanks, > Mark. > >> --- >> arch/arm64/include/asm/barrier.h | 12 ++++++------ >> 1 file changed, 6 insertions(+), 6 deletions(-) >> >> diff --git a/arch/arm64/include/asm/barrier.h b/arch/arm64/include/asm/barrier.h >> index 9f3e2c3d2ca0..2cfc4245d2e2 100644 >> --- a/arch/arm64/include/asm/barrier.h >> +++ b/arch/arm64/include/asm/barrier.h >> @@ -50,13 +50,13 @@ >> #define pmr_sync() do {} while (0) >> #endif >> >> -#define mb() dsb(sy) >> -#define rmb() dsb(ld) >> -#define wmb() dsb(st) >> +#define __mb() dsb(sy) >> +#define __rmb() dsb(ld) >> +#define __wmb() dsb(st) >> >> -#define dma_mb() dmb(osh) >> -#define dma_rmb() dmb(oshld) >> -#define dma_wmb() dmb(oshst) >> +#define __dma_mb() dmb(osh) >> +#define __dma_rmb() dmb(oshld) >> +#define __dma_wmb() dmb(oshst) >> >> #define io_stop_wc() dgh() >> >> -- >> 2.35.3 >> > .