From patchwork Wed Aug 17 16:26:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 12946240 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30968C32771 for ; Wed, 17 Aug 2022 16:27:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 116FA8D0007; Wed, 17 Aug 2022 12:27:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0C7198D0005; Wed, 17 Aug 2022 12:27:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E6F168D0005; Wed, 17 Aug 2022 12:27:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id DA7D28D0005 for ; Wed, 17 Aug 2022 12:27:39 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id A25001C4F3E for ; Wed, 17 Aug 2022 16:27:39 +0000 (UTC) X-FDA: 79809615438.27.F51C729 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf18.hostedemail.com (Postfix) with ESMTP id 03F4D1C01B4 for ; Wed, 17 Aug 2022 16:27:38 +0000 (UTC) From: Sebastian Andrzej Siewior DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1660753657; 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=pKc+6HUSNpaxlBjXSX1XTp4QrP/t25TRKhHhhX/hF54=; b=FpU5qd203NglSjouxtHxwHoFNL1T2ZLmljndcWC4FtmBFWjgUqwHAjv7zQvsovs6hCxhlX JoHA0FMFOkBHqqoKdp7EjJdeRWc5Rn4pgzL62l1FMpBxxWCZ+0csVl9GHyvibFAee9cf9n OSA1Tb0ugOTGnMu1nFM4VKdTkKVezo30Ta4GQ3squD4pDt0OHMXmNMcw+ygtvY66XPLoMK vg5p1TnDFQA7yOOLOnrjP/QULpMws95kTgxqnbYqy2ioH17zW3J3ui+pCgV/JZX9xHJe5+ ZLk6Mz/fYw8wN5r5rvTm83XCKdbXLKNlarnAneLdFP+vrPc4BYaxzimqyBEPDA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1660753657; 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=pKc+6HUSNpaxlBjXSX1XTp4QrP/t25TRKhHhhX/hF54=; b=VeiXr1hZu9YMVGXyrDrMs79lKviokSPPt/kOD1hYDXn1qxwRf9t8Nj70PwNgMW7CRyMxjK iYibp+Y7KobngcAQ== 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 5/9] mm/debug: Provide VM_WARN_ON_IRQS_ENABLED() Date: Wed, 17 Aug 2022 18:26:59 +0200 Message-Id: <20220817162703.728679-6-bigeasy@linutronix.de> In-Reply-To: <20220817162703.728679-1-bigeasy@linutronix.de> References: <20220817162703.728679-1-bigeasy@linutronix.de> MIME-Version: 1.0 ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=FpU5qd20; dkim=pass header.d=linutronix.de header.s=2020e header.b=VeiXr1hZ; spf=pass (imf18.hostedemail.com: domain of bigeasy@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=bigeasy@linutronix.de; dmarc=pass (policy=none) header.from=linutronix.de ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1660753659; a=rsa-sha256; cv=none; b=O+mjbHRJ4va4d91vmVD+XnlilD/D5x4wTb0Pds/RP8DQHG7aeIQJ04KWI0o1CHocd7b7Nq gvJqXthA0aQ7pjyxxYB4ibHKF37rieo2zFEgWDdScMjEqbPeXm+6RTTQN0CWUhMX/qClkQ C+FbZSiEOVTf6wgLEQXAw1W2MfSg5ic= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1660753659; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=pKc+6HUSNpaxlBjXSX1XTp4QrP/t25TRKhHhhX/hF54=; b=YBF9UVgqqPZH++5S7hkjK8ju6yjqBj4rJ7HL0Ikaxf6YDRY/kZZVax7kITflpVoyf/v731 Ar3E7tYHvvdGW3jyoqr9OCrueVu3Bt51SdpPtMTxAfmIrWCBO0L5OYU1IdNMTcDCx2AJFp /l7B7/Ko8ScvxxcrEXOde4gm834zV40= Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=FpU5qd20; dkim=pass header.d=linutronix.de header.s=2020e header.b=VeiXr1hZ; spf=pass (imf18.hostedemail.com: domain of bigeasy@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=bigeasy@linutronix.de; dmarc=pass (policy=none) header.from=linutronix.de X-Rspam-User: X-Rspamd-Server: rspam12 X-Stat-Signature: f9hosdbxxffqgn8r53w33xumfc58ayi3 X-Rspamd-Queue-Id: 03F4D1C01B4 X-HE-Tag: 1660753658-595397 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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=y and PREEMPT_RT=n. Signed-off-by: Thomas Gleixner Cc: Andrew Morton Cc: linux-mm@kvack.org Signed-off-by: Sebastian Andrzej Siewior --- 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 +#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. +config DEBUG_VM_IRQSOFF + def_bool DEBUG_VM && !PREEMPT_RT + config DEBUG_VM bool "Debug VM" depends on DEBUG_KERNEL