From mboxrd@z Thu Jan 1 00:00:00 1970 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 9DE40ECAA25 for ; Thu, 25 Aug 2022 16:42:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239604AbiHYQmW (ORCPT ); Thu, 25 Aug 2022 12:42:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242849AbiHYQmC (ORCPT ); Thu, 25 Aug 2022 12:42:02 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAEB4BA175 for ; Thu, 25 Aug 2022 09:41:54 -0700 (PDT) From: Sebastian Andrzej Siewior DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1661445701; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/sTDmikhifvT+jyCYSjHJibnGmKic2QnilMTiV7/DbU=; b=obMubdUd6EYGlMUE+9dZPkyrahV0KRgisk2845KsBngVKkRtiS/Msafs4/lAf5+xakKTZ/ GF/JrVvH839LGCfDXeW7jRQH1sCUYlyLY9jRMxBcmm8Dejy2OsJQrmodMkwVQcftSEiRkW EEOvcB3OI/zRussbsWUnJgWhcmoAGZPbEi8kDl9CbpK3DIX4/nnk5IRaY1IEp0MA/+aRS7 WUnCopuwdPLuK8XTQH+j2Sgxsx+MnhGCAXz4I3H8y+aEF054nxFtl/wIFeoeK8RmFMXGLI v0eiMX71mbgaS6WpTMLEcDqeu0mTrd2ekCrmJTPJVcX4OVj17fWIGAMkQah5kQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1661445701; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/sTDmikhifvT+jyCYSjHJibnGmKic2QnilMTiV7/DbU=; b=HuR+XllO9XxgzG30p0gBGiEYr0BVeZQinpJziXEn5D8nhFALUt02pQEhbjGpt6BqBFKpLY 2uMIOQAaGXq31vDA== To: linux-kernel@vger.kernel.org Cc: Thomas Gleixner , Peter Zijlstra , Steven Rostedt , Linus Torvalds , Matthew Wilcox , Andrew Morton , linux-mm@kvack.org, Sebastian Andrzej Siewior Subject: [PATCH v2 4/8] mm/debug: Provide VM_WARN_ON_IRQS_ENABLED() Date: Thu, 25 Aug 2022 18:41:27 +0200 Message-Id: <20220825164131.402717-5-bigeasy@linutronix.de> In-Reply-To: <20220825164131.402717-1-bigeasy@linutronix.de> References: <20220825164131.402717-1-bigeasy@linutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Thomas Gleixner Some places in the VM code expect interrupts disabled, which is a valid expectation on non-PREEMPT_RT kernels, but does not hold on RT kernels in some places because the RT spinlock substitution does not disable interrupts. To avoid sprinkling CONFIG_PREEMPT_RT conditionals into those places, provide VM_WARN_ON_IRQS_ENABLED() which is only enabled when VM_DEBUG=3Dy a= nd PREEMPT_RT=3Dn. Signed-off-by: Thomas Gleixner Cc: Andrew Morton Cc: linux-mm@kvack.org Signed-off-by: Sebastian Andrzej Siewior Acked-by: Peter Zijlstra (Intel) --- include/linux/mmdebug.h | 6 ++++++ lib/Kconfig.debug | 3 +++ 2 files changed, 9 insertions(+) diff --git a/include/linux/mmdebug.h b/include/linux/mmdebug.h index 15ae78cd28536..b8728d11c9490 100644 --- a/include/linux/mmdebug.h +++ b/include/linux/mmdebug.h @@ -94,6 +94,12 @@ void dump_mm(const struct mm_struct *mm); #define VM_WARN(cond, format...) BUILD_BUG_ON_INVALID(cond) #endif =20 +#ifdef CONFIG_DEBUG_VM_IRQSOFF +#define VM_WARN_ON_IRQS_ENABLED() WARN_ON_ONCE(!irqs_disabled()) +#else +#define VM_WARN_ON_IRQS_ENABLED() do { } while (0) +#endif + #ifdef CONFIG_DEBUG_VIRTUAL #define VIRTUAL_BUG_ON(cond) BUG_ON(cond) #else diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 072e4b289c13e..c96fc6820544c 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -803,6 +803,9 @@ config ARCH_HAS_DEBUG_VM_PGTABLE An architecture should select this when it can successfully build and run DEBUG_VM_PGTABLE. =20 +config DEBUG_VM_IRQSOFF + def_bool DEBUG_VM && !PREEMPT_RT + config DEBUG_VM bool "Debug VM" depends on DEBUG_KERNEL --=20 2.37.2