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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1467D6B6DA for ; Wed, 30 Oct 2024 21:05:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7FFEF6B00A1; Wed, 30 Oct 2024 17:05:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7AF266B00A5; Wed, 30 Oct 2024 17:05:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6776E6B00A6; Wed, 30 Oct 2024 17:05:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 3E9CA6B00A1 for ; Wed, 30 Oct 2024 17:05:29 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 0165DA0F4F for ; Wed, 30 Oct 2024 21:05:28 +0000 (UTC) X-FDA: 82731498234.01.330CE99 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf16.hostedemail.com (Postfix) with ESMTP id 4037C180004 for ; Wed, 30 Oct 2024 21:05:01 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Dtz6TJ3k; spf=pass (imf16.hostedemail.com: domain of "SRS0=rUt/=R2=paulmck-ThinkPad-P17-Gen-1.home=paulmck@kernel.org" designates 139.178.84.217 as permitted sender) smtp.mailfrom="SRS0=rUt/=R2=paulmck-ThinkPad-P17-Gen-1.home=paulmck@kernel.org"; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1730322113; h=from:from:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=W63dxzR61iELVyFdI+F9Lm9cDA3lWQH9GFiwf3VbvWs=; b=3olsItPCTfEQf27FE9f2NQRPVfDp4krou5a5hBsps7pZ38tC6M2muPly7yMLKQSRvcp3+x Z87oqKBeK0jSA7zpr9NPD+S8j9kxe0Rb/eB2CHHKRmzsiqcZR3O6PMLVU4H6SdeMTjzrhY 8z7bM7zAlJcZd2jwnVK7NrhLVcZ07Is= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Dtz6TJ3k; spf=pass (imf16.hostedemail.com: domain of "SRS0=rUt/=R2=paulmck-ThinkPad-P17-Gen-1.home=paulmck@kernel.org" designates 139.178.84.217 as permitted sender) smtp.mailfrom="SRS0=rUt/=R2=paulmck-ThinkPad-P17-Gen-1.home=paulmck@kernel.org"; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1730322113; a=rsa-sha256; cv=none; b=OsZmepyNNnv7nLXrhKLMIQqWGXNIr2hc9MIJKeVX/3aXGHX7NVyex35D9kb8pSP1iBPt53 UWDc0hs+TzSBnxEszAtNa+kPdzckPBwTbr8YcZXgriOjy28wMHMKYT3/NhGcQwWSkkHBiZ fMj8tttK26aYtvsa/t0IS49/DSXCdt8= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 4A6825C5950; Wed, 30 Oct 2024 21:04:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0A13C4CECE; Wed, 30 Oct 2024 21:05:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1730322325; bh=ypfxW/NOsBShw1OGtEN1J0mz1RYRrV8CLlKTh75EDoI=; h=Date:From:To:Cc:Subject:Reply-To:From; b=Dtz6TJ3kEnFviiF8o/yP9LQhrtWccymKMICMU0ILeg7O5JfkMxwUFRxNUiClxpyYO MjudHVFGL52YBW+Mjcgc27f+g15JhypkEeSW7fci2SfNQQEfbY+7PLYc4HC1DuNEEO //ot8T2WlYeD0gUuTbVAgNN3wS3N3JNYHt5YglQp6lYuFKXNMWE3FijnvTtN/fUxBP 2shjmUoJyOmVzTjB1Xw/KbEOIuwzEsgwGEp+MASCOChd3TIxi2Fq+r3LJrPSMy4U6b urdWDR8bhenx36QMfgjj21I8D6HkAtZbj1WONFUxBhusw/3aTjJ11QoIjuqHL7EVmf SuZxbm4aoc1yA== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 84629CE0BB3; Wed, 30 Oct 2024 14:05:24 -0700 (PDT) Date: Wed, 30 Oct 2024 14:05:24 -0700 From: "Paul E. McKenney" To: linux-next@vger.kernel.org, linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, linux-mm@kvack.org Cc: sfr@canb.auug.org.au, bigeasy@linutronix.de, longman@redhat.com, boqun.feng@gmail.com, elver@google.com, cl@linux.com, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, akpm@linux-foundation.org, vbabka@suse.cz Subject: [BUG] -next lockdep invalid wait context Message-ID: <41619255-cdc2-4573-a360-7794fc3614f7@paulmck-laptop> Reply-To: paulmck@kernel.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 4037C180004 X-Stat-Signature: t38r3pt63y8ifwgj6ef11u58zdsp4ica X-Rspam-User: X-HE-Tag: 1730322301-468410 X-HE-Meta: U2FsdGVkX1+bOjlrj/UZK8D1EemOtB1E46Xk2s6mgTs6NbdRk9gNf91AL91H+b+MUNsTskbpX2mns38H3a9HhNmc/Oz2IA3tImwbnAE26katdrA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ClbA9cJ7w20IXHrx3bDCr+GQIBpi8Qr8v6Pgg0cmWGsn691HpwnbbhbPfqT6vsrvuhtqnhs4sO1pLU7VthRwzCcleSwFEfi2UktfXq01SU8pMLFFKr7fQ0b+L403zYyu+6oKCZrx2tLB57zjODrn9hkK7roLCh5rGTPa7SvjfPSRkD6w0P4yBcuVgRXbW3hURWM4T6kkiz/AgNHXickJwAg23tSNhaQjw8mrg4OHYKTimKdB67I3HwgnTVKjnOlZ6zg3Yj60aA1GJKmoh67vCF4Soic41LoEmQjQ2zTvLgpmW1ZWFNLt6zBtNA715mpdgEx5x/rj2Zsrlb2Ash2cNJjazh1XXN3hXgbqGqncqRDFqEV7hrKqxa/VVYjMJ2Jz+mgwYXyePIQyQc7rwH7oKYVkaZw3+2Yl1Uiz8RLiUVE30Bg3v0pP/T2epeelb3Uehs6p99Q7E9X82nOCLx19a3DxbeHPFoSeKTs4w+IsAqFTnZsUIYmphtRySxKmjLrqw7rREYXEDPUCPZonwIEXS 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: List-Subscribe: List-Unsubscribe: Hello! The next-20241030 release gets the splat shown below when running scftorture in a preemptible kernel. This bisects to this commit: 560af5dc839e ("lockdep: Enable PROVE_RAW_LOCK_NESTING with PROVE_LOCKING") Except that all this is doing is enabling lockdep to find the problem. The obvious way to fix this is to make the kmem_cache structure's cpu_slab field's ->lock be a raw spinlock, but this might not be what we want for real-time response. This can be reproduced deterministically as follows: tools/testing/selftests/rcutorture/bin/kvm.sh --torture scf --allcpus --duration 2 --configs PREEMPT --kconfig CONFIG_NR_CPUS=64 --memory 7G --trust-make --kasan --bootargs "scftorture.nthreads=64 torture.disable_onoff_at_boot csdlock_debug=1" I doubt that the number of CPUs or amount of memory makes any difference, but that is what I used. Thoughts? Thanx, Paul ------------------------------------------------------------------------ [ 35.659746] ============================= [ 35.659746] [ BUG: Invalid wait context ] [ 35.659746] 6.12.0-rc5-next-20241029 #57233 Not tainted [ 35.659746] ----------------------------- [ 35.659746] swapper/37/0 is trying to lock: [ 35.659746] ffff8881ff4bf2f0 (&c->lock){....}-{3:3}, at: put_cpu_partial+0x49/0x1b0 [ 35.659746] other info that might help us debug this: [ 35.659746] context-{2:2} [ 35.659746] no locks held by swapper/37/0. [ 35.659746] stack backtrace: [ 35.659746] CPU: 37 UID: 0 PID: 0 Comm: swapper/37 Not tainted 6.12.0-rc5-next-20241029 #57233 [ 35.659746] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014 [ 35.659746] Call Trace: [ 35.659746] [ 35.659746] dump_stack_lvl+0x68/0xa0 [ 35.659746] __lock_acquire+0x8fd/0x3b90 [ 35.659746] ? start_secondary+0x113/0x210 [ 35.659746] ? __pfx___lock_acquire+0x10/0x10 [ 35.659746] ? __pfx___lock_acquire+0x10/0x10 [ 35.659746] ? __pfx___lock_acquire+0x10/0x10 [ 35.659746] ? __pfx___lock_acquire+0x10/0x10 [ 35.659746] lock_acquire+0x19b/0x520 [ 35.659746] ? put_cpu_partial+0x49/0x1b0 [ 35.659746] ? __pfx_lock_acquire+0x10/0x10 [ 35.659746] ? __pfx_lock_release+0x10/0x10 [ 35.659746] ? lock_release+0x20f/0x6f0 [ 35.659746] ? __pfx_lock_release+0x10/0x10 [ 35.659746] ? lock_release+0x20f/0x6f0 [ 35.659746] ? kasan_save_track+0x14/0x30 [ 35.659746] put_cpu_partial+0x52/0x1b0 [ 35.659746] ? put_cpu_partial+0x49/0x1b0 [ 35.659746] ? __pfx_scf_handler_1+0x10/0x10 [ 35.659746] __flush_smp_call_function_queue+0x2d2/0x600 [ 35.659746] __sysvec_call_function_single+0x50/0x280 [ 35.659746] sysvec_call_function_single+0x6b/0x80 [ 35.659746] [ 35.659746] [ 35.659746] asm_sysvec_call_function_single+0x1a/0x20 [ 35.659746] RIP: 0010:default_idle+0xf/0x20 [ 35.659746] Code: 4c 01 c7 4c 29 c2 e9 72 ff ff ff 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa eb 07 0f 00 2d 33 80 3e 00 fb f4 c3 cc cc cc cc 66 66 2e 0f 1f 84 00 00 00 00 00 90 90 90 90 90 [ 35.659746] RSP: 0018:ffff888100a9fe68 EFLAGS: 00000202 [ 35.659746] RAX: 0000000000040d75 RBX: 0000000000000025 RCX: ffffffffab83df45 [ 35.659746] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffffffa8a5f7ba [ 35.659746] RBP: dffffc0000000000 R08: 0000000000000001 R09: ffffed103fe96c3c [ 35.659746] R10: ffff8881ff4b61e3 R11: 0000000000000000 R12: ffffffffad13f1d0 [ 35.659746] R13: 1ffff11020153fd2 R14: 0000000000000000 R15: 0000000000000000 [ 35.659746] ? ct_kernel_exit.constprop.0+0xc5/0xf0 [ 35.659746] ? do_idle+0x2fa/0x3b0 [ 35.659746] default_idle_call+0x6d/0xb0 [ 35.659746] do_idle+0x2fa/0x3b0 [ 35.659746] ? __pfx_do_idle+0x10/0x10 [ 35.659746] cpu_startup_entry+0x4f/0x60 [ 35.659746] start_secondary+0x1bc/0x210 [ 35.659746] common_startup_64+0x12c/0x138 [ 35.659746]