From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EAED3C10DCE for ; Mon, 9 Mar 2020 02:38:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B8AE22072A for ; Mon, 9 Mar 2020 02:38:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583721526; bh=NYBnKnoFGHiKr8KFP5sPc644yQ3JlTxiVZ/OVEyT5kM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=diAwwr8F8n8zqFZeQjIvz1NKVnHHLj8Hxvdzk6i/QTxsgZQYabquWLETBHEnLNZsI 7bl7pRuH41vYEEE9GtWSVd8AF3oRgcAxYKNKnj1/VRFa/+JQPNmte4/9Oem0ZMAWgQ /6rwLaSv6n+MB9MT42NRZA56OzHITEnbmrgaLXpw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726780AbgCICiq (ORCPT ); Sun, 8 Mar 2020 22:38:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:49420 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726363AbgCICip (ORCPT ); Sun, 8 Mar 2020 22:38:45 -0400 Received: from localhost (lfbn-ncy-1-985-231.w90-101.abo.wanadoo.fr [90.101.63.231]) (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 1967920675; Mon, 9 Mar 2020 02:38:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583721524; bh=NYBnKnoFGHiKr8KFP5sPc644yQ3JlTxiVZ/OVEyT5kM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ZoL5T7WMQ1L5KDgXAkmHsFCSmrpvYGWHDYhIsPfh2SNqKbDbBJXqmI6gsl5tz1+dm rw33KSreeT0C31iozs1WGnkwVbboEvSWzW+nxTJD+plXMvbYqDnFHtbF+7B3dMOJhA 79dptiGbAhG3DT5Ia1hzMdbu9qL/+NGDRkGikkIk= Date: Mon, 9 Mar 2020 03:38:42 +0100 From: Frederic Weisbecker To: Alex Belits Cc: "mingo@kernel.org" , "peterz@infradead.org" , "rostedt@goodmis.org" , "tglx@linutronix.de" , "linux-api@vger.kernel.org" , "catalin.marinas@arm.com" , "linux-arm-kernel@lists.infradead.org" , "netdev@vger.kernel.org" , "davem@davemloft.net" , "linux-arch@vger.kernel.org" , "will@kernel.org" Subject: Re: [EXT] Re: [PATCH 08/12] task_isolation: don't interrupt CPUs with tick_nohz_full_kick_cpu() Message-ID: <20200309023841.GC9615@lenoir> References: <4473787e1b6bc3cc226067e8d122092a678b63de.camel@marvell.com> <20200306160341.GE8590@lenoir> <646a22fd24e8dfeb1eb3101ae7be2b88e91dbfa3.camel@marvell.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <646a22fd24e8dfeb1eb3101ae7be2b88e91dbfa3.camel@marvell.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-api-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-api@vger.kernel.org On Sun, Mar 08, 2020 at 07:28:22AM +0000, Alex Belits wrote: > On Fri, 2020-03-06 at 17:03 +0100, Frederic Weisbecker wrote: > > On Wed, Mar 04, 2020 at 04:12:40PM +0000, Alex Belits wrote: > > > From: Yuri Norov > > > > > > For nohz_full CPUs the desirable behavior is to receive interrupts > > > generated by tick_nohz_full_kick_cpu(). But for hard isolation it's > > > obviously not desirable because it breaks isolation. > > > > > > This patch adds check for it. > > > > > > Signed-off-by: Alex Belits > > > --- > > > kernel/time/tick-sched.c | 3 ++- > > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > > > diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c > > > index 1d4dec9d3ee7..fe4503ba1316 100644 > > > --- a/kernel/time/tick-sched.c > > > +++ b/kernel/time/tick-sched.c > > > @@ -20,6 +20,7 @@ > > > #include > > > #include > > > #include > > > +#include > > > #include > > > #include > > > #include > > > @@ -262,7 +263,7 @@ static void tick_nohz_full_kick(void) > > > */ > > > void tick_nohz_full_kick_cpu(int cpu) > > > { > > > - if (!tick_nohz_full_cpu(cpu)) > > > + if (!tick_nohz_full_cpu(cpu) || task_isolation_on_cpu(cpu)) > > > return; > > > > I fear you can't do that. A nohz full CPU is kicked for a reason. > > As for the other cases, you need to fix the callers. > > > > In the general case, randomly ignoring an interrupt is a correctness > > issue. > > Not ignoring, just delaying until we are back from userspace. We know > that everything was done on this CPU when we successfully entered > userspace in isolated mode -- otherwise we would be kicked out. We > restart timers when we are back in kernel again on cleanup, so things > will be back to normal at that point. Between those moments we can just > as well remain in userspace and forget about the timers until we are > back in kernel. Well, if another CPU requests the tick on our isolated CPU, we can't ignore it. This can be a posix cpu timer belonging to our process, a timer bound to our CPU or tasks added to our CPU that require the scheduler tick. Denying any of that can crash the kernel randomly. The only thing we can do is to simply avoid these situations. But those are requirements anyway if you want to run a task undisturbed.