Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2862645pxk; Mon, 28 Sep 2020 01:56:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwScPrNnydYeWDGg4TFzbRZC9xeMO1EBe/uvxS+kc0hbOWrgDSylE0LgcMse5RtDwuUzDTm X-Received: by 2002:aa7:d458:: with SMTP id q24mr563757edr.23.1601283388028; Mon, 28 Sep 2020 01:56:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601283388; cv=none; d=google.com; s=arc-20160816; b=aqvfRDJhpgQG/o94+djoGIAn01OcN9PQnaXc/RUPsFflmuhZwiSI9/SIiJvIt0opis YHDnfCzHDAOnh9SYPC4+DVnoLJBz68ejUFzCsKqLw006GOSNy0+qBSMlzCOcJGhohq7i hMQTcOEngZgsi//EVaGNh702P0Vu7TEEY9rJddfMXUXAmGSb8V4/IFjxu90zdwPvJ9o8 B5+Vl9qxNC+9UleftotCZlU4HZoJIP9uTYvVEAXJUWPtBfgcYt74dPixsRSsHLEu8vqh rXhVY3+OraRzpXRh5WTtbTvBxgbGMrrTZlHpOACa+DFGZ5GdjA+wbwKlCFRloD00Wzfr ODaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject:dkim-signature; bh=UL/lVkSmikJzYStgGU/M4soguRl9I/oKkU7pcTJ2KgY=; b=ULhI2WrBhA+b5FDLiV6XrTdxbs4NcXsVbzY4OzFmMqVSrj5ghooL6FHZLHQ/NOn84I YFrYDN6uLyjnwLkw3ZBrs9lhim6PguoA2GLOyPbHhC2/0nSbBCzd8uChvXmMweGHxOUv +f7A3yOAPLDb1VA2UCuz4j5Mq3kUAsQj8Mg6HdNTg6+1Z5GWRUfzC5hbtMwq8fhMKt09 m/lhLKZOTXJfnFgiWgbpftyeJ51nAIPybLpy/FLRy/xOYWCGRWL8PwqcdWTIO9pE+owu gJ4ShkHWbx5ADilz8or1adJxSCkGa2l5LX5tfhvDqb+6CUGgNoLUdwl7HEqTpNQAZZsk LMCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20150623.gappssmtp.com header.s=20150623 header.b=WDPRDV59; 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=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q12si219078ejs.146.2020.09.28.01.56.05; Mon, 28 Sep 2020 01:56:28 -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=@bytedance-com.20150623.gappssmtp.com header.s=20150623 header.b=WDPRDV59; 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=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726565AbgI1IzA (ORCPT + 99 others); Mon, 28 Sep 2020 04:55:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726440AbgI1IzA (ORCPT ); Mon, 28 Sep 2020 04:55:00 -0400 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D255C0613CE for ; Mon, 28 Sep 2020 01:55:00 -0700 (PDT) Received: by mail-pg1-x542.google.com with SMTP id t14so263416pgl.10 for ; Mon, 28 Sep 2020 01:55:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=UL/lVkSmikJzYStgGU/M4soguRl9I/oKkU7pcTJ2KgY=; b=WDPRDV59OnPMjfOSSjLrFBblWexDaJ+Mjpz2mCqna8N9xSjdi4kqfBwWO7Nb22/ssd OUInVy1PkH5YwWsLeTbJmp3H0TFKMNcyrLqJ15sw7jinrI55adDYm9AP7Azy/wkG+DAz nuSfnea19KXH3N9LujfWC1KXVsiiQGaSDXQ7DnmTMPhdU+wldVvrGK+a5RamHIIyipcW +Uu1+RF9FEsxnRnWQ/iSPxFDnf74XE9cnxAVpWph2K1qkPog7qShGY1OElijT8CaDoe5 jLTI+5EZ3DOQrIIdRH6EOZJba97V05zhguZUtfSXFHVGKNzYFZ0Ld8WtvoWwXFxaZ759 V15A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=UL/lVkSmikJzYStgGU/M4soguRl9I/oKkU7pcTJ2KgY=; b=jd082wFtwbVaNtfmmF1S+xOnmuw+DdomB2P1iZhE12z1Zy6bTJeQdrhD7NrvrNmO4m oUn1AKdvIPtelqj8IK+gWE1BhttobUh3PrZrILRt6QdhkCcbHYDSowu5wXjZIePhEKOn JY/NVxx/eNIn232rwooyCygdxeBuq1rx53xUEfPCKaR3ZNpucbsocN8XqrDAjkTlXr1o HJHVVrneM+aaGoECOHIZMxcZ1RyutRu1VFX6qT1HXNiqtTRBHztL+nT+HFKYqrjIiT8i BblEzKUPop4hTE+NoVKcSm0z/QxMnVSoEmhwMSOsprTyrbPgxQbKcm+nrKCsBzRwEuiZ njBw== X-Gm-Message-State: AOAM5316cW5y4gnQwOyX4HvsWjd809KKBPEEwTd9NI2SIrdJRJ4mUfhB 3mXDXJiYzO0ft1xVOxTGd0vf8A== X-Received: by 2002:a17:902:d695:b029:d2:86d0:b6fb with SMTP id v21-20020a170902d695b02900d286d0b6fbmr637844ply.41.1601283299897; Mon, 28 Sep 2020 01:54:59 -0700 (PDT) Received: from [10.86.118.224] ([103.136.221.68]) by smtp.gmail.com with ESMTPSA id q5sm697744pfb.184.2020.09.28.01.54.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 28 Sep 2020 01:54:59 -0700 (PDT) Subject: Re: [External] Re: [PATCH 2/2] sched: mark PRINTK_DEFERRED_CONTEXT_MASK in __schedule() To: Peter Zijlstra 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 References: <20200927161130.33172-1-zhouchengming@bytedance.com> <20200927161130.33172-2-zhouchengming@bytedance.com> <20200928073202.GA2611@hirez.programming.kicks-ass.net> From: Chengming Zhou Message-ID: <40ab934e-5b8b-735b-da65-3043efab9fdc@bytedance.com> Date: Mon, 28 Sep 2020 16:54:53 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <20200928073202.GA2611@hirez.programming.kicks-ass.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 在 2020/9/28 下午3:32, Peter Zijlstra 写道: > 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. Yes, but if our box deadlock just because a WARN_ON_ONCE, we have to reboot : ( So these WARN_ON_ONCE have BUG_ON effect ?  Or we should change to use BUG_ON ? Thanks. >> 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.