From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 53ABF1DDC26 for ; Fri, 13 Dec 2024 11:20:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734088834; cv=none; b=uTutWUg1Kr+kPZYIe2mtmJe65g/06RTd1oenn3YSXb+49DL/9fEl42IwwfF4dp0d4Jsfi/gWWcJsOVp7t/kWpskBNFdeQygm0Lvogf6a28+EKzACkI3CxWFtIsrvzv2Few5jHUvJetiPfodNaFlrzwTEghu5CythFyYqJfFUWWI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734088834; c=relaxed/simple; bh=eg4W9f1jDnJzzZ4g1xKPUPXcksmsk3KvDYWD+bOxVTQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=XEYH8448jR5W4noklCcBaqJEM9t9gaZto2imDzdbuAb6XGzIVg03mSmbAcLHYPUS4x4qXovixMXyqu8OdHsBunVg3ypTETUOkcPnttB7bsgru1dn177+6l0OK75qozmWoIuSmvO2wtDUY89fv3NQeuv2zUKQFTnmCkX5YSKbSPo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=cwbEbcwY; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="cwbEbcwY" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=3E5inui+/Uaht5Te51wP/9nA3zKpMlHtnK0zFj+UdQ4=; b=cwbEbcwYkE8yAW/AuxrDbnSI7R tScVCTQss0nj07HYf8Qi5HzVfcREk8u81GASn9GBESjY0mvtrlOi7TN+WfN1iLA+GCjgp4SaMfIyw 6/zFPqvLaqNKAyhTAD9hsdREjH+NnTxlylncMhXIgGLWC9fu48Oe3hQsC71wa5vJtYBOmMNm3ikkr 5WZEp/vj5i/+uaCobXF12tEWfLmCkvlgPO5lu3F+UUleAQgpK3E8O0XPpFu+5PZtJ6PGGYq3FHIjk WQBWPeFKOFYP0QAjqX9NlpeFf0dGGs6opipZcXBHerEq840XSnCEBmatKM4j8UdOPF7ktaXpPaRD/ XeA87Kmg==; Received: from 77-249-17-89.cable.dynamic.v4.ziggo.nl ([77.249.17.89] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.98 #2 (Red Hat Linux)) id 1tM3if-0000000CTta-0ZKq; Fri, 13 Dec 2024 11:20:29 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 38AA830049D; Fri, 13 Dec 2024 12:20:28 +0100 (CET) Date: Fri, 13 Dec 2024 12:20:28 +0100 From: Peter Zijlstra To: Thomas Gleixner Cc: David Woodhouse , Stefan Hajnoczi , Jason Wang , "x86@kernel.org" , hpa , dyoung , kexec , linux-ext4 , "Michael S. Tsirkin" , Stefano Garzarella , eperezma , Paolo Bonzini , ming.lei@redhat.com, Petr Mladek , John Ogness Subject: Re: Lockdep warnings on kexec (virtio_blk, hrtimers) Message-ID: <20241213112028.GE21636@noisy.programming.kicks-ass.net> References: <1f631458c180c975c238d4d33d333f9fa9a4d2a3.camel@infradead.org> <20241211124240.GA310916@fedora> <7717fe2ac0ce5f0a2c43fdab8b11f4483d54a2a4.camel@infradead.org> <87ldwl9g93.ffs@tglx> <10f5d22150b548ec271e0a847ba2eb91139e6f61.camel@infradead.org> <87a5d0aibc.ffs@tglx> <874j38a16p.ffs@tglx> Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <874j38a16p.ffs@tglx> On Fri, Dec 13, 2024 at 01:14:54AM +0100, Thomas Gleixner wrote: > --- a/kernel/sched/core.c > +++ b/kernel/sched/core.c > @@ -7276,7 +7276,7 @@ void rt_mutex_setprio(struct task_struct > #if !defined(CONFIG_PREEMPTION) || defined(CONFIG_PREEMPT_DYNAMIC) > int __sched __cond_resched(void) > { > - if (should_resched(0)) { > + if (should_resched(0) && system_state != SYSTEM_SUSPEND) { > preempt_schedule_common(); > return 1; > } Perhaps we should just do: if (should_resched(0) && !irqs_disabled()) That's more or less what preemptible() does too. Yes, mucking about with IF is expensive, but it's only done if preempt_count is agreeing we should schedule, which it shouldn't be most of the time.