Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2406702ybl; Mon, 20 Jan 2020 02:18:58 -0800 (PST) X-Google-Smtp-Source: APXvYqxkCgiAzIffV9MaFgKqlxq6lrFj7bq1q2foTW515cCiBbqkMCPpha0I2V2ArXbOADWbgn1P X-Received: by 2002:aca:5608:: with SMTP id k8mr12465543oib.88.1579515538456; Mon, 20 Jan 2020 02:18:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579515538; cv=none; d=google.com; s=arc-20160816; b=t49PQgefV2pXIN/rnGrvkZ8h2nbi4wL04MQ9kbTnM4sT7jrxXiCiyX5hGCsr1YPAQs vQfyOoxI6uc8N7dHdS9zzJZIIJFhVg1kyPyv1rnYkKgMEyacL6gm41G+nDJv1lMaLw9f 5wWOEN/7JjzJZGKlYecoUfEtoWYXbowaNToB00M29N3x9L1dL0SiiheBpuv/anA5+MWX 8/iFAlq0tB7f/wzpOiE8WVgmaPHmyAFv1PGzIXVM/I74vodjT/vwmsBHEidncVBRdSKZ trUd48O6xft7jwzk98auSMikoH+oPq51tVWiupk92jEpwEKEFTmqrX2BU5hARNGh3fsf zctg== 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:message-id:subject:cc :to:from:date:dkim-signature; bh=gztlN05IQZuOK4W6S4SylxVz4OdRtg3T258KyW9CMgg=; b=MSHhXI29orjEhd6AwONcpe38l+YVYx12pDXkmtg89eu1JgsCQPmKxBUAOgL85iwJ5c sqkmVu6sgK5Q9qgzroIvLb9WigqyIJQyAzi8IC+9O5svhdwVvIcprwZJkxhIwABWBSbV SYuul0SmFXOC/qXteeDIIBjQ63/Q7424XoFvUCGjRHe7csii5LOVvoHjhxQwsX+EldHU 2qy4E3FhufeNgeQdHKLmZ56akzSaOchDXFJxvQvcaicqTAsxsC695XMDvvKyptKzQMVB bzt+tZ7D+cQO80wmNhkaKqJdmWHJXnENS38yJnHXU1NTQnbzQTbW9rJCwA1/8325fc8M bzcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=XJcn4xDG; 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 g22si18128489otp.55.2020.01.20.02.18.46; Mon, 20 Jan 2020 02:18:58 -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=@infradead.org header.s=merlin.20170209 header.b=XJcn4xDG; 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 S1727026AbgATKRa (ORCPT + 99 others); Mon, 20 Jan 2020 05:17:30 -0500 Received: from merlin.infradead.org ([205.233.59.134]:34200 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726125AbgATKRa (ORCPT ); Mon, 20 Jan 2020 05:17:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=gztlN05IQZuOK4W6S4SylxVz4OdRtg3T258KyW9CMgg=; b=XJcn4xDGGPQYbnCszSKBw9t5B LU4e5ux4iin89IR5TGzNDbwlXg0z2XQRNSxQCDZiZpSfnOfQCxS/9UWQ9grbYMElOdqU+5/hzytEt 7/WwvYhZS+9yH3DN5SYdTjmRa+bJw98fpipggGjr7QaryGLJiy2xnLm/d6zio3YYvPnuNeyoe+Mu3 OUXa5Me3vOpovYKrLffPIfiVFbOuSHMyBRIkg1TvHQLmFbhs7Jwn5FmWDTsAJ1mCwe+BpreUZ+JY/ xVJUJoUXjNYaMcu92TMbR/8sYt3K6GtjeKvj8Cj9gtvLqbuem7BHnAcuSEoNgRZK8iGikF8i5F2Gs 7OvHbzpng==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1itU75-0003c9-OY; Mon, 20 Jan 2020 10:16:55 +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 CE00F305E4E; Mon, 20 Jan 2020 11:15:13 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 62A352041FB24; Mon, 20 Jan 2020 11:16:52 +0100 (CET) Date: Mon, 20 Jan 2020 11:16:52 +0100 From: Peter Zijlstra To: Qian Cai Cc: mingo@redhat.com, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, paulmck@kernel.org, tglx@linutronix.de, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] sched/core: fix illegal RCU from offline CPUs Message-ID: <20200120101652.GM14879@hirez.programming.kicks-ass.net> References: <20200113190331.12788-1-cai@lca.pw> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200113190331.12788-1-cai@lca.pw> 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, Jan 13, 2020 at 02:03:31PM -0500, Qian Cai wrote: > In the CPU-offline process, it calls mmdrop() after idle entry and the > subsequent call to cpuhp_report_idle_dead(). Once execution passes the > call to rcu_report_dead(), RCU is ignoring the CPU, which results in > lockdep complaints when mmdrop() uses RCU from either memcg or > debugobjects, so it by scheduling mmdrop() on another online CPU. > > According to the commit a79e53d85683 ("x86/mm: Fix pgd_lock deadlock"), > mmdrop() is not interrupt-safe, and called from > smp_call_function_single() could end up running mmdrop() from the IPI > interrupt handler. > Surely the critical information contained in these nearly 100 lines of splat can be more consicely represented? > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > index 90e4b00ace89..1863a6fc4d82 100644 > --- a/kernel/sched/core.c > +++ b/kernel/sched/core.c > @@ -6194,7 +6194,8 @@ void idle_task_exit(void) > current->active_mm = &init_mm; > finish_arch_post_lock_switch(); > } > - mmdrop(mm); > + smp_call_function_single(cpumask_first(cpu_online_mask), > + (void (*)(void *))mmdrop_async, mm, 0); > } Bah.. that's horrible. Surely we can find a better place to do this in the whole hotplug machinery. Perhaps you can have takedown_cpu() do the mmdrop()?