Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D273C678DB for ; Sun, 5 Mar 2023 13:53:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229906AbjCENxk (ORCPT ); Sun, 5 Mar 2023 08:53:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229887AbjCENxZ (ORCPT ); Sun, 5 Mar 2023 08:53:25 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A622B30E8; Sun, 5 Mar 2023 05:52:56 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 03EA960B02; Sun, 5 Mar 2023 13:52:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 682E9C433EF; Sun, 5 Mar 2023 13:52:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678024375; bh=6DXEWvDLO0oazULhqYHOTTVDENA5Kb6QTRTb6/Zllwk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EPdxsN/tHsh1HJCZseIRpxoLp7yQfD44+Pj6TnOUrNRrsaf7I9yp7LdXqswikAsIY y87+tdI69fDMbaQzzwq118zJtJC2ic86GdM4esJNgpsX7DhybW0g2WC4WkUX7WgooI Yzt3CaDAXMYc/dPVAWQH0fPrkzgEnmWO8eSrwxegRjGToM0M9O+eqSJvxyOg1hoYlM VKrMDekbKogUqFcHIqrOeR+Oz6NvzTMpfSz2F8TOT0E2mDeUiHiLPgOlIfEZJHG6/Q Q7GSDls4dStz8ZgQ4ickHCiMb8K5OnFBuDQaTSauEMZKwpWJp6OQ2bJoEe2ZjxMoPz uF18Uowv9EpKw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Rohan McLure , Michael Ellerman , Sasha Levin , npiggin@gmail.com, christophe.leroy@csgroup.eu, ganeshgr@linux.ibm.com, alexandre.belloni@bootlin.com, heying24@huawei.com, linuxppc-dev@lists.ozlabs.org Subject: [PATCH AUTOSEL 6.2 12/16] powerpc/kcsan: Exclude udelay to prevent recursive instrumentation Date: Sun, 5 Mar 2023 08:52:03 -0500 Message-Id: <20230305135207.1793266-12-sashal@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230305135207.1793266-1-sashal@kernel.org> References: <20230305135207.1793266-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rohan McLure [ Upstream commit 2a7ce82dc46c591c9244057d89a6591c9639b9b9 ] In order for KCSAN to increase its likelihood of observing a data race, it sets a watchpoint on memory accesses and stalls, allowing for detection of conflicting accesses by other kernel threads or interrupts. Stalls are implemented by injecting a call to udelay in instrumented code. To prevent recursive instrumentation, exclude udelay from being instrumented. Signed-off-by: Rohan McLure Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20230206021801.105268-3-rmclure@linux.ibm.com Signed-off-by: Sasha Levin --- arch/powerpc/kernel/time.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c index e26eb6618ae5d..9d8665910350c 100644 --- a/arch/powerpc/kernel/time.c +++ b/arch/powerpc/kernel/time.c @@ -356,7 +356,7 @@ void vtime_flush(struct task_struct *tsk) } #endif /* CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */ -void __delay(unsigned long loops) +void __no_kcsan __delay(unsigned long loops) { unsigned long start; @@ -377,7 +377,7 @@ void __delay(unsigned long loops) } EXPORT_SYMBOL(__delay); -void udelay(unsigned long usecs) +void __no_kcsan udelay(unsigned long usecs) { __delay(tb_ticks_per_usec * usecs); } -- 2.39.2