Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp334646lql; Mon, 11 Mar 2024 04:24:52 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVqSGLy4LXlxzKP0FsnbzheDE4wZzoGNW/hOHK0c6kak43oLXuzyFCZVqw/9Y3ggJnGAqPK2bNjtw9K6aeVdUiWOgvfxVBStnDPrDF76A== X-Google-Smtp-Source: AGHT+IH5NXe8QP55pQTkiIKw+/FA6O3WkJfmP1wh05wYiHMpsGThpbpqcuq8JgJejo7xN4/K4jmC X-Received: by 2002:a17:903:182:b0:1dd:860c:bc10 with SMTP id z2-20020a170903018200b001dd860cbc10mr6324670plg.57.1710156291830; Mon, 11 Mar 2024 04:24:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710156291; cv=pass; d=google.com; s=arc-20160816; b=w9mE93DpYepld5SwLprA+EKqj5/wYO2OJhZhMRP5YnjOpDYSBZ6q1PmOC5m+3AJGsK G9ZCPd/ZOok+1eLLpwF6pMOiJgPlbI51ohGrVR91tlmNBxzsZvrMRcumYYQLxFSGGqXO K/PQPa6YWa3KJNK2QzrVtyTqJpZOoMmVIIeA93jB+OzFPU9uCZLQxa9shSzD62iJB7hh jr3yHo0/H/nPavsYY41vu+LqoKGn9VPcG7StwjHK+9g5DZ7sO3ii7PxWRX+Hb9XE7OvR Tv5epxRr8HNeo80NYFOJwzt22flUnBRy0iRJGBtVRUogUQTYq+GJoqZgJBeGrXBhvMKf xtnA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=AKJUPIi5ehiXACBaHP8MmBAHSQKfOjojtQyJv7fZX+c=; fh=XP3LCPTs5cj8PsdqeVmtUQlVN9yl18VhHBxzetGgYE8=; b=1GWXKSrSBFZtkcgaj4b5n8LYoEbK3MOWxNK62pjxJoN54hmwDGDdLIKux7qX9/pfla /2BVltKnorCTFY1cJT0UdmvYLEX5Zi6jRYy0Nh2eOgrC4mH40dVxJUHkyi0R4yTsF43q yZna8jAE0KCzOE+mq+eJRyhua2QSKaVtnR5AzBly8OuseoYTq6B0FFNJJ97BHq8drA3z UYzgpcjo9Wpv6eThH6d2UA2fo8+MDibpjNYxPy1hJBxI/WJPLltnYBQOv1eksqqgEeYj ns0lQuO5jcXvDEATAwjGhY/Tzhqkc1HsxP3lCGjQlCVsIWFYdcGFdfw8QPG2KdImX+5g Mfaw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-98758-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-98758-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id h11-20020a170902f70b00b001dda3fb4b20si1002094plo.559.2024.03.11.04.24.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 04:24:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-98758-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-98758-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-98758-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 842322820C8 for ; Mon, 11 Mar 2024 11:24:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BB8113C47D; Mon, 11 Mar 2024 11:24:35 +0000 (UTC) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E57343BBF6 for ; Mon, 11 Mar 2024 11:24:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.255 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710156275; cv=none; b=HPOnSHQyzWB+cxbJ2jC4lmL3wn5lusCwVXfWcNmYkD+bIknbslNMwvrx8eOSBC85fzhMRSI8UIP7cWT2jLUvhoi+WoRw8jh4k3FuChBFfrte4cmtJnMi4x0pCbs28hQ/lEYs/Y4rcRWkEM5JyG2x4b9G36AmQKGlZHomnPzijN0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710156275; c=relaxed/simple; bh=87WVZ0PBli/RXm37Y5K39EPeq7giUbkZeUO+FJta81g=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=LTLMhNAk3qD/TzlioIA5NEjEyOGlIzJUAsaYXzej/3Mav5zTqFuYNlamo15OIu43HK10RDKDTxTZiqhYcpOGW2JJBbP6noYYysPMpXg6IGyqoTaEKZSrWI08XgCNHuffkZJIHxvFE35jve5F+JaBbNt5illMAueHLWcegL9ou4g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.255 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.105]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4TtZB80BlGz1Q9YQ; Mon, 11 Mar 2024 19:22:24 +0800 (CST) Received: from kwepemd100011.china.huawei.com (unknown [7.221.188.204]) by mail.maildlp.com (Postfix) with ESMTPS id 4CBB81400F4; Mon, 11 Mar 2024 19:24:28 +0800 (CST) Received: from M910t.huawei.com (10.110.54.157) by kwepemd100011.china.huawei.com (7.221.188.204) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.28; Mon, 11 Mar 2024 19:24:26 +0800 From: Changbin Du To: Ingo Molnar , Andrew Morton , Peter Zijlstra , Juri Lelli , Vincent Guittot CC: Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , , , Alexander Potapenko , , Changbin Du , Marco Elver Subject: [PATCH] mm: kmsan: fix instrumentation recursion on preempt_count Date: Mon, 11 Mar 2024 19:23:30 +0800 Message-ID: <20240311112330.372158-1-changbin.du@huawei.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemd100011.china.huawei.com (7.221.188.204) This disables msan check for preempt_count_{add,sub} to fix a instrumentation recursion issue on preempt_count: __msan_metadata_ptr_for_load_4() -> kmsan_virt_addr_valid() -> preempt_disable() -> __msan_metadata_ptr_for_load_4() With this fix, I was able to run kmsan kernel with: o CONFIG_DEBUG_KMEMLEAK=n o CONFIG_KFENCE=n o CONFIG_LOCKDEP=n KMEMLEAK and KFENCE generate too many false positives in unwinding code. LOCKDEP still introduces instrumenting recursions issue. But these are other issues expected to be fixed. Cc: Marco Elver Signed-off-by: Changbin Du --- kernel/sched/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 9116bcc90346..5b63bb98e60a 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -5848,7 +5848,7 @@ static inline void preempt_latency_start(int val) } } -void preempt_count_add(int val) +void __no_kmsan_checks preempt_count_add(int val) { #ifdef CONFIG_DEBUG_PREEMPT /* @@ -5880,7 +5880,7 @@ static inline void preempt_latency_stop(int val) trace_preempt_on(CALLER_ADDR0, get_lock_parent_ip()); } -void preempt_count_sub(int val) +void __no_kmsan_checks preempt_count_sub(int val) { #ifdef CONFIG_DEBUG_PREEMPT /* -- 2.25.1