Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2827826pxk; Mon, 28 Sep 2020 00:34:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxkfOUlauavvh8m0qkj0RBUQFSvHCd80H9INzETWPsiKuiH+AimAhjMO5PQD27qdmW0RRMA X-Received: by 2002:aa7:c48d:: with SMTP id m13mr296623edq.326.1601278441268; Mon, 28 Sep 2020 00:34:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601278441; cv=none; d=google.com; s=arc-20160816; b=AgCjJaQloiZGBWEg4CQDpcyO/ZxHkLKXDQkFlBzRbab4xUJyia7BkTYRhh0ZTOJLEk bJHZcq/OOSvjhyiwjj/89UXbbZSP5g1Qw5mflh7iEe3VB8CfXZZ9UlJf1q26BXqUcOD5 ngWXgcSwUW+ns/emaw3fyMIPWl8rTWVLqxjGy91v3ghAT8YVrwOaVrGptSYLiyYQ0Brr UenYPA8KHJoBUFengX5dMmQqu+6+ej36493POK1qvD7aHOeMpocX5F0pBUxI93Opc0G1 afz0ZI83h+4z+/HsvW42RBlqjN8cI+bn58VMsSRpQLT0nwT7PRfCrrSK0z2DbTFbylvX PCng== 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:date:dkim-signature; bh=9a4RQ/cVE8L9jRWNlJ9jl2x1mUr9n344j0WMZjuDA5s=; b=UBDUfUFoI2yBgpoRC3v6ynWepJmSlNlSlgdtlGJR2PoxAiSOmsJScyljiZuliovR4y /SutCzLWPgOzMLHKfGc3jaMoyKTDaAjDPyAZOXfbVOebFTDabe7tPjfOcUYPHigM5B4r Lt+NXo65R8bulogMbKmRCY/zisQn40SJjTqt9MohpK07fXXKFTHlsdhWf+L9hzduFPZC +WPQBMc7OlhoEZKDhB7DjAtHNnsnbhRZNl0WahxnQt/RbHGw6BLnvbRR6R0FQM4Txl+a jP22kIYhW0/MgyL7T6KHu7ck1g1DxkLgHElbM1XfEpbZmL+IUE8z5mUgM4qETbtTyGPE pMrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=aZUJAjjm; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mc20si89084ejb.571.2020.09.28.00.33.38; Mon, 28 Sep 2020 00:34:01 -0700 (PDT) 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=@infradead.org header.s=casper.20170209 header.b=aZUJAjjm; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726566AbgI1HcV (ORCPT + 99 others); Mon, 28 Sep 2020 03:32:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726440AbgI1HcV (ORCPT ); Mon, 28 Sep 2020 03:32:21 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1339CC0613CE for ; Mon, 28 Sep 2020 00:32:21 -0700 (PDT) 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=9a4RQ/cVE8L9jRWNlJ9jl2x1mUr9n344j0WMZjuDA5s=; b=aZUJAjjmdP/OsenQWBHc6mHLmD wUWPfx0OuGGuItQ8dnzsPdhenqd0uKm2ziu731VRm3PGPK1Ajck7Rod1Xag7kANv3RJrg+TDQrR7q 4uXD2+FaPtg9dqtPeeqnLlIdUMY8hncZygc8hy8284KxTntU8ImrhrmCoXG1LGpW8qDsWOm0vhfMt /oXesj5Rf2hfbjpWIkfAv/72ZyuCoaH7nicXiY2A7O9dyeUQftM50dzmttUpdmqruGs2MyF6fNdV8 RmT8/tiGtY4sYeGyXRHSMcaKoolyZTKnWr+vL2v6UmB9Qj/JUOB3YNgdIVh4v6LHS14yfBP4SzSOz jSedQIeQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMndm-0007Qh-PS; Mon, 28 Sep 2020 07:32:07 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 5CDE9300F7A; Mon, 28 Sep 2020 09:32:03 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 0AB142019499B; Mon, 28 Sep 2020 09:32:03 +0200 (CEST) Date: Mon, 28 Sep 2020 09:32:02 +0200 From: Peter Zijlstra To: Chengming Zhou Cc: linux-kernel@vger.kernel.org, pmladek@suse.com, sergey.senozhatsky@gmail.com, rostedt@goodmis.org, mingo@redhat.com, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, bsegall@google.com, mgorman@suse.de, songmuchun@bytedance.com Subject: Re: [PATCH 2/2] sched: mark PRINTK_DEFERRED_CONTEXT_MASK in __schedule() Message-ID: <20200928073202.GA2611@hirez.programming.kicks-ass.net> References: <20200927161130.33172-1-zhouchengming@bytedance.com> <20200927161130.33172-2-zhouchengming@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200927161130.33172-2-zhouchengming@bytedance.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 28, 2020 at 12:11:30AM +0800, Chengming Zhou wrote: > The WARN_ON/WARN_ON_ONCE with rq lock held in __schedule() should be > deferred by marking the PRINTK_DEFERRED_CONTEXT_MASK, or will cause > deadlock on rq lock in the printk path. It also shouldn't happen in the first place, so who bloody cares. > Signed-off-by: Chengming Zhou > Signed-off-by: Muchun Song > --- > kernel/sched/core.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > index 2d95dc3f4644..81d8bf614225 100644 > --- a/kernel/sched/core.c > +++ b/kernel/sched/core.c > @@ -4444,6 +4444,7 @@ static void __sched notrace __schedule(bool preempt) > */ > rq_lock(rq, &rf); > smp_mb__after_spinlock(); > + printk_deferred_enter(); > > /* Promote REQ to ACT */ > rq->clock_update_flags <<= 1; > @@ -4530,6 +4531,7 @@ static void __sched notrace __schedule(bool preempt) > rq_unlock_irq(rq, &rf); > } > > + printk_deferred_exit(); > balance_callback(rq); > } NAK printk_deferred is an abomination, kill that.