Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp6171793ybf; Thu, 5 Mar 2020 14:45:01 -0800 (PST) X-Google-Smtp-Source: ADFU+vuVAJ8fGsa/Ax0FmiL891049xSpvvzgOt5diMPpTHdEMl7j8B39o5/H3VNb6bPNue/4fp1y X-Received: by 2002:a9d:7cc2:: with SMTP id r2mr171494otn.152.1583448300929; Thu, 05 Mar 2020 14:45:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583448300; cv=none; d=google.com; s=arc-20160816; b=mh4pxsWRrNgwzo5S6rBH4r1cxfZ/mrLm0Cnv/g/uuJjxYxWZU2ch7fqv5DdPHHrk8t 8dlEsB3sm177Qsr0ojdMI88fn2p8j15p8zs1wBvG/SgvlOdgpF/Qo9mm9i60IkAE6+0d KnnAcX8gocnCHImige76xIzP4nRwofdQLeai0qYbasaOI2tN1BfQs+b6v2hSee4pTQx0 cubfZFCwX1jN+ImPMrncQwf7xBjwcNY8fmCC2kLo8pIutSVCm8TueCajfQN5UaY+zQ3f r8aemP/dtL7ZRof8sVRvlUbbMA/uSB/zvR78xdxALjs1f3eODUkpYrQMop/RjNaZ/Uwt FGdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=O3u3Ro9v8WomyledTiqjdA3COqYTw8KdIkLB+O1J5vU=; b=wf3kV77UKc5YS+JtwW7f0Ihh8sgFdlVGtM8j+2yAnixD3Wo/lhG2LfjMf7ZfC4wJB2 xO3YwlcfHZ9IiMjAYOeb1Q8mb61hfbpDv5Es+opzs775VZMIMemBW6aB7a44nE/QREFR pHlgh6rSieazEk4juNsp2Hbev1ikoLxFTcgsg+yuQefkUW8CkOHPT09EjZEcpYVhUfM7 sKAmezhzl1Y76wVLbCIWHD7WHew42BRip1b3CGvTRBBo+ns11+yhTkm0EqzeibLLL+fU KFrmQLnDq1KRjCE0YC2OYVB76aV0uB1doEPTH7lN8bzuA7AqUozwJcDx1Ksp3dAJHqPa /DSg== ARC-Authentication-Results: i=1; mx.google.com; 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 b68si254993oii.117.2020.03.05.14.44.48; Thu, 05 Mar 2020 14:45:00 -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; 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 S1726191AbgCEWo0 (ORCPT + 99 others); Thu, 5 Mar 2020 17:44:26 -0500 Received: from mail.kernel.org ([198.145.29.99]:55996 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726145AbgCEWoZ (ORCPT ); Thu, 5 Mar 2020 17:44:25 -0500 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C431B206E6; Thu, 5 Mar 2020 22:44:24 +0000 (UTC) Date: Thu, 5 Mar 2020 17:44:23 -0500 From: Steven Rostedt To: Jann Horn Cc: Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Andrew Morton , Frederic Weisbecker , kernel list Subject: Re: [PATCH v2] exit: Move preemption fixup up, move blocking operations down Message-ID: <20200305174423.7294c48b@gandalf.local.home> In-Reply-To: References: <20200305220657.46800-1-jannh@google.com> <20200305171344.1f35d971@gandalf.local.home> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 5 Mar 2020 23:30:13 +0100 Jann Horn wrote: > On Thu, Mar 5, 2020 at 11:13 PM Steven Rostedt wrote: > > On Thu, 5 Mar 2020 23:06:57 +0100 > > Jann Horn wrote: > > > > > With CONFIG_DEBUG_ATOMIC_SLEEP=y and CONFIG_CGROUPS=y, kernel oopses in > > > non-preemptible context look untidy; after the main oops, the kernel prints > > > a "sleeping function called from invalid context" report because > > > exit_signals() -> cgroup_threadgroup_change_begin() -> percpu_down_read() > > > can sleep, and that happens before the preempt_count_set(PREEMPT_ENABLED) > > > fixup. > > > > > > It looks like the same thing applies to profile_task_exit() and > > > kcov_task_exit(). > > > > > > Fix it by moving the preemption fixup up and the calls to > > > profile_task_exit() and kcov_task_exit() down. > [...] > > > + if (unlikely(in_atomic())) { > > > + pr_info("note: %s[%d] exited with preempt_count %d\n", > > > + current->comm, task_pid_nr(current), > > > + preempt_count()); > > > > This should be more than a pr_info. It should also probably state the > > "Dazed and confused, best to reboot" message. > > > > Because if something crashed in a non preempt section, it may likely be > > holding a lock that it will never release, causing a soon to be deadlock! > > I didn't write that code, I'm just moving it around. :P But I guess if Ah, I didn't scroll down enough to see it was just moved. > you want, I can change it in the same patch... something like this on > top? Does that look reasonable? No, an update to the text should be done as a separate patch, as it is a different type of change. Thanks, -- Steve > > if (unlikely(in_atomic())) { > - pr_info("note: %s[%d] exited with preempt_count %d\n", > + pr_emerg("note: %s[%d] exited with preempt_count %d, > system might deadlock, please reboot\n", > current->comm, task_pid_nr(current), > preempt_count()); > preempt_count_set(PREEMPT_ENABLED);