Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp2738139pxb; Mon, 31 Jan 2022 03:16:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJwqEu/Oe18kM/wouln/nuLRww9ksuJlQck0Oj4MnT5E+DPXshvP2uyIOujFP8RDF+2DGvQO X-Received: by 2002:a05:6402:1c1e:: with SMTP id ck30mr20697195edb.266.1643627810145; Mon, 31 Jan 2022 03:16:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643627810; cv=none; d=google.com; s=arc-20160816; b=oRnC8c1OclqFBUvtSBMPNP+tX8Vp9mX2zN46n6u5yKRaI5U6VtjckPLWQLJPJsLBVr iOGuYZMlO8ebidU1Ny72MV9+I5fQmNgLqfzTM8WNSut3p9dmrzYtvtLJ7ScDawcb2Mp2 5RpkIbmzI9mrPrERgTmbqj7TA1D6E9jsu6Slai0bTUJ+X0skwIX9Qv6j9/4CPhw9a8rv cOzNwdOaiqTDIB/xo8eDC0RF7Meud9S3J59fP09BfNAuMLvaFlxnyzrPiDv4eU94erW4 xGcsZQBXNe0fYeWEddidEEg7Tpf7v+/SV1e45elMcODloXZokcUCwrokRUDT9OmUyjRQ gcCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature :dkim-signature:date; bh=SWbLt59QRjjf4mfB+2ZMl5qQv7LD3/z5tyJey6mlcdw=; b=rR4tlZ/UlDDwYUIyErEnasXXDXq4KISyhusC3/ldOFQ+yFkZGH8294e8psGQvdR4L0 +EGV1jj7yn55qAbW+9A7N2g1DNq+BFZLZmmi3s3CEJBU41bHg6tf6L/NV0MHWYQE95BU hxu5eLWI1a6K9jJfU/9PY8taBTTbZ+wqIdL8bYkAOIiNqsyEFAXdoD6jc2Yuca+0YNMJ 8qKhRaJigbH4fOXdfacsWSQnssFAgYLW82H2umHiwVw9fqCL4/td3IoRwxuksKfopM1v zKOkQQhHOQDphfN0vJ3iCu0NBP1g8UWki58kDUf/BUuZp/fxmpqtFYsrNdF+SK8/QFAS I/BA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="N/Pys4MJ"; dkim=neutral (no key) header.i=@linutronix.de header.b=Tn7xOEIV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hp33si10118366ejc.663.2022.01.31.03.16.25; Mon, 31 Jan 2022 03:16:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="N/Pys4MJ"; dkim=neutral (no key) header.i=@linutronix.de header.b=Tn7xOEIV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350031AbiA1QTT (ORCPT + 99 others); Fri, 28 Jan 2022 11:19:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350009AbiA1QTR (ORCPT ); Fri, 28 Jan 2022 11:19:17 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5D3DC061714 for ; Fri, 28 Jan 2022 08:19:16 -0800 (PST) Date: Fri, 28 Jan 2022 17:19:13 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1643386754; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=SWbLt59QRjjf4mfB+2ZMl5qQv7LD3/z5tyJey6mlcdw=; b=N/Pys4MJJNYjFIbO6SBLi4q89mwxDz5yB58cRI3PyqXO/1PgJrrZ0VN6PORfGHQqEMKHIE 5X+4nJ0yMMogR3u3u0n45ehMCsBA0ytqQZEghAC4lG2pJU+olbghVTMm9nWzc3HQf53Xci 1yr9NSgWPa0VtZB8Qzr1R0azWN804/22sml0208Csfv0V1UBBXePwUdraHt0TW47aF2yYf PFcSgcwi9tZkCbhniy139NBZ8VZ9oiDqNaDQOt5S4ni7B376t+vkHAHSyqKqXIafL66HV5 8ez+6r0wcg4LijcKYMKDAmSR29F/EfPDmI4nlqJBK4tVs3ovU9anqkfzye4N2g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1643386754; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=SWbLt59QRjjf4mfB+2ZMl5qQv7LD3/z5tyJey6mlcdw=; b=Tn7xOEIVL7am3ZEBGblh9lDGM/RIJl5EO2LPn26MRYq2WT+kCucCK71eDjn0IEP8ZbQf1d 83FMDTqV7TwYVbAg== From: Sebastian Andrzej Siewior To: "Jason A. Donenfeld" Cc: Jonathan =?utf-8?Q?Neusch=C3=A4fer?= , Andy Lutomirski , LKML , Theodore Ts'o , Peter Zijlstra , Ingo Molnar , Will Deacon , Waiman Long , Boqun Feng Subject: Re: "BUG: Invalid wait context" in invalidate_batched_entropy Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022-01-28 17:04:13 [+0100], Jason A. Donenfeld wrote: > Hi Sebastian/Jonathan, > > On Fri, Jan 28, 2022 at 9:35 AM Sebastian Andrzej Siewior > wrote: > > This report is due to CONFIG_PROVE_LOCKING=y _and_ > > CONFIG_PROVE_RAW_LOCK_NESTING=y. It reports a nesting problem > > (raw_spinlock_t -> spinlock_t lock ordering) which becomes a real > > problem on PREEMPT_RT. > > Hmm, I'm still having a tough time reproducing this. I'm trying to > understand your intuition. Is the problem you see that something else > in the IRQ path uses a raw_spinlock_t, and then with that lock still > held, we call invalidate_batched_entropy(), which takes an ordinary > spinlock_t, non-raw? And taking a spinlock-t while holding a > raw_spinlock_t is illegal? Correct. You must not acquire a spinlock_t while holding a raw_spinlock_t. This is because on PREEMPT_RT the spinlock_t is a sleeping lock while raw_spinlock_t disables preemption/ interrupts and sleeping is not possible. Documentation/locking/locktypes.rst On non-PREEMPT both lock types (spinlock_t & raw_spinlock_t) behave in the same way but lockdep can tell them apart with CONFIG_PROVE_RAW_LOCK_NESTING=y and show code that is problematic on RT. > Jason Sebastian