Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1685373imu; Wed, 12 Dec 2018 02:29:04 -0800 (PST) X-Google-Smtp-Source: AFSGD/UqmBztbqnwMFV4tFi4Pjz1XGUZUFvw0ajSvJdpdF6/rMhu/EkKkYGuOOETC/g6RS20/sda X-Received: by 2002:a62:848d:: with SMTP id k135mr19498746pfd.47.1544610544417; Wed, 12 Dec 2018 02:29:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544610544; cv=none; d=google.com; s=arc-20160816; b=vbkSTwyaoL5ZGZjNsGI8XsVw1i2DDb1w8yIDRC6aRi0dSwXI2esE43reUPnZX4N5eI 8c9PumapJ0UImRqAJP8vQjIlALYns5+Fn8RY4txnc2YSSFBkThDkpvbpJjwt7IYaQRI7 JU7yVq7GRgH9gfPAiV6LJlPaDgoqji6OB/inBGFcqSc6crbB845foGkJMBvC5aMUAojk sfUxuK7KqE8NC5ira1CymV59y2tRTacoyUn/gxsqHaRm5M/uhdSFfwfhCxzKYeyIXrA/ Ts8MNQwHNugjgG09Mx/v1tes9HBV0PIF7XOXc603VCTjNdYwwc/EpDqoBi4pLUxPMzrW lI3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature; bh=oLSNPA3/9UENkYRpSsrZU42VVYNLtub/x8vrizd4AO4=; b=Qc3LGBCvKjWg7Cv28wPjhYSvwjPmm+ydU8EMOZaKe5YgWdk6qG6cMqjZ47a7XKiyEa 4ihSywC/OUlz/N9roLciw+BDWjiyQF1HZKJfbjY+c7XxnSi2FPjESsAt2rRXEAo61wHk W9HBqZ5vIAsFazZ8hkJkVD9z/iL18oX3XozFWchQIjYsGbs0R2Ur1lS8dh8kBgWYS+ek c9YrjEQcLf4ckIaBQAnoRb0SKv6snDlte9UO0yqu5Jr2O68jsEeDBsyd+sT/uf9c08Dj XIK0VGHwucVjJ0Iz79nSWZgxxxtWJpXLIwn5sbvoNy16zogHvBnBXp7+Tjfut25SKx+f ougA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@ffwll.ch header.s=google header.b=hxVifcbT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m1si14374488pgm.194.2018.12.12.02.28.40; Wed, 12 Dec 2018 02:29:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@ffwll.ch header.s=google header.b=hxVifcbT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727085AbeLLK1C (ORCPT + 99 others); Wed, 12 Dec 2018 05:27:02 -0500 Received: from mail-ed1-f67.google.com ([209.85.208.67]:42286 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726591AbeLLK1B (ORCPT ); Wed, 12 Dec 2018 05:27:01 -0500 Received: by mail-ed1-f67.google.com with SMTP id j6so15071545edp.9 for ; Wed, 12 Dec 2018 02:27:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=oLSNPA3/9UENkYRpSsrZU42VVYNLtub/x8vrizd4AO4=; b=hxVifcbTokxv1Bl8kF/YFZYictX03q0l//sF4rxf2dmnXhHoWKPO0KaA55lVY/PBF0 eJcDumzMW7Ea4x1UZ8gmoB9Y6xLKcMqUNae8qFxnKjAYxcoeR+sOoailpflUUR7+vHTN 4nDcRixEIQhJEYkmyPPcDfGrCEqirqi6zHqUY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=oLSNPA3/9UENkYRpSsrZU42VVYNLtub/x8vrizd4AO4=; b=afkO08aH9jnXqzWc3FygCvXw8D8P/hAODvOhHHGMDXJ5I09iADKo1ArM9iolgnwIbf 7LwVuBR/zsNLJ6LXIqJ78vxAdHwsrYnfdvyNdIpjgEwRFSl6kWXjhOg95osBWZ/BSvY4 vAN5SFRIZXc4/aDBDq95mCRNGlzsorYRhA8Nim9Es06MWzep/BmmqlAuPpVm0va+BcN0 lhZ75W2h8yzjJudDLSa+uevrtyn8a5C+3IbQBooETxlRIcHqkxGHhmjit8jLGl1lnQBZ MzjWqXTjhkReoqxdj4nxodLWygp9MRVy+vZJ68HZWRAW9G5YAqxrGkvAPbjaxOX0rqG/ 2vBg== X-Gm-Message-State: AA+aEWabj8S4RJ2x7vOwTvrynmm4Cc7C7E2NM6zjiXk0dUVoI1ce9yxl XNikfHP+DJLAD6fAJ8DZiyLWvg== X-Received: by 2002:a05:6402:8d2:: with SMTP id d18mr9769490edz.119.1544610419782; Wed, 12 Dec 2018 02:26:59 -0800 (PST) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id f4sm4829230edb.21.2018.12.12.02.26.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 12 Dec 2018 02:26:58 -0800 (PST) Date: Wed, 12 Dec 2018 11:26:56 +0100 From: Daniel Vetter To: Peter Zijlstra Cc: Michal Hocko , Daniel Vetter , Intel Graphics Development , DRI Development , LKML , linux-mm@kvack.org, Andrew Morton , David Rientjes , Christian =?iso-8859-1?Q?K=F6nig?= , =?iso-8859-1?B?Suly9G1l?= Glisse , Daniel Vetter Subject: Re: [PATCH 2/4] kernel.h: Add non_block_start/end() Message-ID: <20181212102656.GS21184@phenom.ffwll.local> Mail-Followup-To: Peter Zijlstra , Michal Hocko , Intel Graphics Development , DRI Development , LKML , linux-mm@kvack.org, Andrew Morton , David Rientjes , Christian =?iso-8859-1?Q?K=F6nig?= , =?iso-8859-1?B?Suly9G1l?= Glisse , Daniel Vetter References: <20181210103641.31259-1-daniel.vetter@ffwll.ch> <20181210103641.31259-3-daniel.vetter@ffwll.ch> <20181210141337.GQ1286@dhcp22.suse.cz> <20181210144711.GN5289@hirez.programming.kicks-ass.net> <20181210150159.GR1286@dhcp22.suse.cz> <20181210152253.GP5289@hirez.programming.kicks-ass.net> <20181210162010.GS1286@dhcp22.suse.cz> <20181210163009.GR5289@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181210163009.GR5289@hirez.programming.kicks-ass.net> X-Operating-System: Linux phenom 4.18.0-2-amd64 User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 10, 2018 at 05:30:09PM +0100, Peter Zijlstra wrote: > On Mon, Dec 10, 2018 at 05:20:10PM +0100, Michal Hocko wrote: > > > OK, no real objections to the thing. Just so long we're all on the same > > > page as to what it does and doesn't do ;-) > > > > I am not really sure whether there are other potential users besides > > this one and whether the check as such is justified. > > It's a debug option... > > > > I suppose you could extend the check to include schedule_debug() as > > > well, maybe something like: > > > > Do you mean to make the check cheaper? > > Nah, so the patch only touched might_sleep(), the below touches > schedule(). > > If there were a patch that hits schedule() without going through a > might_sleep() (rare in practise I think, but entirely possible) then you > won't get a splat without something like the below on top. We have a bunch of schedule() calls in i915, for e.g. waiting for multiple events at the same time (when we want to unblock if any of them fire). And there's no might_sleep in these cases afaict. Adding the check in schedule() sounds useful, I'll include your snippet in v2. Plus try a bit better to explain in the commit message why Michal suggested these. Thanks, Daniel > > > > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > > > index f66920173370..b1aaa278f1af 100644 > > > --- a/kernel/sched/core.c > > > +++ b/kernel/sched/core.c > > > @@ -3278,13 +3278,18 @@ static noinline void __schedule_bug(struct task_struct *prev) > > > /* > > > * Various schedule()-time debugging checks and statistics: > > > */ > > > -static inline void schedule_debug(struct task_struct *prev) > > > +static inline void schedule_debug(struct task_struct *prev, bool preempt) > > > { > > > #ifdef CONFIG_SCHED_STACK_END_CHECK > > > if (task_stack_end_corrupted(prev)) > > > panic("corrupted stack end detected inside scheduler\n"); > > > #endif > > > > > > +#ifdef CONFIG_DEBUG_ATOMIC_SLEEP > > > + if (!preempt && prev->state && prev->non_block_count) > > > + // splat > > > +#endif > > > + > > > if (unlikely(in_atomic_preempt_off())) { > > > __schedule_bug(prev); > > > preempt_count_set(PREEMPT_DISABLED); > > > @@ -3391,7 +3396,7 @@ static void __sched notrace __schedule(bool preempt) > > > rq = cpu_rq(cpu); > > > prev = rq->curr; > > > > > > - schedule_debug(prev); > > > + schedule_debug(prev, preempt); > > > > > > if (sched_feat(HRTICK)) > > > hrtick_clear(rq); > > > > -- > > Michal Hocko > > SUSE Labs -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch