Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp407523imu; Mon, 5 Nov 2018 02:56:23 -0800 (PST) X-Google-Smtp-Source: AJdET5dRitrRVfeGx4vkn2+iptxif9Evdo+ry8xfn/vJDZiR/7JsUzRa7N2iGC0jpnRA7qcIyN0u X-Received: by 2002:a62:583:: with SMTP id 125-v6mr21425768pff.186.1541415383118; Mon, 05 Nov 2018 02:56:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541415383; cv=none; d=google.com; s=arc-20160816; b=gI/R7ja/KDkwIqvjEITzgq/HJRnMpcewnKOsw9Lat3+eeevI8qbIbGl8+AHMOu8NTw UHIqDTO8OOOekAe7XaA2KBJWnjAjWxRXOyiYTCp5Tb9OhX+4Ka2SnBOX37sPChhLsddQ p4Lnku61+uMMpm0tJFGAyyP5XCkD684z0cV+E93k65U17BLsgxTofPIp4xKhnsWG1A2s SC9rN21W9dagKyPCYpFdtqX8/P1QCPy6ZPWsVM1kr3xqlK+syaAu1nlhDLfI3+z1WLQz DPBqDxTp2wkV/bRPkyeFbhb2zBPmjbtaEtakyv7f1vX6hJQQ7wzapVpv6XKjAFKTIGvv ZF8g== 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; bh=ul6by3fmSldDSfX7W9kuvkwhNgBOYUMWaj1PrW4aBd4=; b=KNr5KuwRRjIuujgpV+VCjxbXP+kH1cDsMpcj7N7NuYAmfXJsumtx6e9p1CLdCQ4LzA 8UZCos9Qysd97noroHESQswZxrCpm06xYTUJYSRQ2SRdbducvSUAwEbYfp7VzSupatJa MmPe7luuxAZw0BTodKlLJLwZv+PyQxoJQWT9WgxmVXApE1Z27ISQE6wyI1McpuRqV69R V0wN96eZb/VCyxkI6i6bQ9MmKYH7ECMibRpm6BEWsfB0r/yV9zfvHkfG5lljUt8xqr+N V52u+Su3H0pk89osWB5/P66NQDSriCwT4NjUKCYNK8tn2qYVgqOi/Xv6OtOU8VrtyqIg wWtg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e3-v6si42798031pgg.530.2018.11.05.02.56.07; Mon, 05 Nov 2018 02:56:23 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728094AbeKEUOy (ORCPT + 99 others); Mon, 5 Nov 2018 15:14:54 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:39779 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726255AbeKEUOx (ORCPT ); Mon, 5 Nov 2018 15:14:53 -0500 Received: by mail-wr1-f65.google.com with SMTP id r10-v6so8976451wrv.6 for ; Mon, 05 Nov 2018 02:55:45 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ul6by3fmSldDSfX7W9kuvkwhNgBOYUMWaj1PrW4aBd4=; b=X5PUoE+IhbtdvdCOl8xEpZfEdtwDYob4kOVzhnfGw54F+C8GNLh+VoQVOcUGzeGqbI 7dRgs8sMih4aWFJVeH+jt/50Cvu9+lNgJeFubfY7Rqii1GLTLAvmj6f8xrLHpuswAl2X GgeYK+LriIJJPGf7CHW41soggsZ6YHPN1jHYO6k+XKb7SLd3oUY5/XV8IPRfl/vmH6Fc cH4Eqvea2aeriH82Vx1fBes4r3ybZhz/hqMwOjj5Vr3UHDP2B5oCmT3IU1vExknr6rVQ JvYEq6KhC9Z2xd33rVKesljlaSNIwVZDni40TKYSA0Mw2D1lq/ygnPoyWOGqAVDZ0JuX f+qg== X-Gm-Message-State: AGRZ1gJLRz1N2ldbwdYTGi8XIC9yz3e7GBexFZO3XX8dH0Di2nFsz6/G Tb09f+HRx8pyQUKerHNUuJLCyA== X-Received: by 2002:a5d:4bd2:: with SMTP id l18-v6mr19869276wrt.168.1541415344244; Mon, 05 Nov 2018 02:55:44 -0800 (PST) Received: from localhost.localdomain ([151.35.141.200]) by smtp.gmail.com with ESMTPSA id b66-v6sm2261036wmb.21.2018.11.05.02.55.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Nov 2018 02:55:43 -0800 (PST) Date: Mon, 5 Nov 2018 11:55:38 +0100 From: Juri Lelli To: Daniel Bristot de Oliveira Cc: luca abeni , Peter Zijlstra , Thomas Gleixner , Juri Lelli , syzbot , Borislav Petkov , "H. Peter Anvin" , LKML , mingo@redhat.com, nstange@suse.de, syzkaller-bugs@googlegroups.com, henrik@austad.us, Tommaso Cucinotta , Claudio Scordino Subject: Re: INFO: rcu detected stall in do_idle Message-ID: <20181105105538.GQ18091@localhost.localdomain> References: <20181019113942.GH3121@hirez.programming.kicks-ass.net> <20181019225005.61707c64@nowhere> <20181024120335.GE29272@localhost.localdomain> <20181030104554.GB8177@hirez.programming.kicks-ass.net> <20181030120804.2f30c2da@sweethome> <2942706f-db18-6d38-02f7-ef21205173ca@redhat.com> <20181031164009.GM18091@localhost.localdomain> <027899c5-c5ca-b214-2a87-abe17579724a@redhat.com> <20181101055512.GO18091@localhost.localdomain> <1bf857dc-d6ac-e505-82bd-dd28449d3a60@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1bf857dc-d6ac-e505-82bd-dd28449d3a60@redhat.com> 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 02/11/18 11:00, Daniel Bristot de Oliveira wrote: > On 11/1/18 6:55 AM, Juri Lelli wrote: > >> I meant, I am not against the/a fix, i just think that... it is more complicated > >> that it seems. > >> > >> For example: Let's assume that we have a non-rt bad thread A in CPU 0 generating > >> IPIs because of static key update, and a good dl thread B in the CPU 1. > >> > >> In this case, the thread B could run less than what was reserved for it, but it > >> was not causing the interrupts. It is not fair to put a penalty in the thread B. > >> > >> The same is valid for a dl thread running in the same CPU that is receiving a > >> lot of network packets to another application, and other legit cases. > >> > >> In the end, if we want to avoid non-rt threads starving, we need to prioritize > >> them some time, but in this case, we return to the DL server for non-rt threads. > >> > >> Thoughts? > > And I see your point. :-) > > > > I'd also add (maybe you mentioned this as well) that it seems the same > > could happen with RT throttling safety measure, as we are using > > clock_task there as well to account runtime and throttle stuff. > > Yes! The same problem can happen with rt scheduler as well! I saw this problem > first with the rt throttling mechanism when I was trying to make it work in the > microseconds granularity (it is only enforced in the schedule tick, so it is in > an ms granularity in practice). After using hr timers to do the enforcement in > the microseconds granularity, I was trying to let just fewer us for the non-rt. > But as the IRQ runtime was higher than these fewer us, the rt_rq was never > throttled. It is the same/similar behavior we see here. > > As we think in the rt throttling as "avoiding rt workload to consume more than > rt_runtime/rt_period", and considering that IRQs are a level of task with a > fixed priority higher than all the real-time related schedulers, i.e., deadline > and rt, we can safely argue that we can consider the IRQ time into the pool of > rt workload and account it in the rt_runtime. The easiest way to do it is to use > the rq_clock() in the measurement. I agree. > > The point is that the CBS has a dual goal: it avoids a task running for more > than its runtime (a throttling behavior), but it also is used as a guarantee of > runtime for the case in which the task behaves, and the system is not > overloaded. Considering we can have more load than we can schedule in a > multiprocessor - but that is another story. > > The the obvious reasoning here is: Ok boy, but the system IS overloaded in this > case, we have a RCU stall! And that is true if you look at the processor > starving RCU. But if the system has mode than one CPU, it could have CPU time > available in another CPU. So, we could just move the dl task from one CPU to > another. Mmm, only that in this particular case I believe IRQ load will move together with the migrating task and problem won't really be solved. :-/ > Btw, that is another point. We have the AC with the sum of the utilization of > all CPUs. But we do no enforcement for per-cpu utilization. If one set a single > thread with runtime=deadline=period (in a system with more than one CPU), and > run in a busy-loop, we will eventually have an RCU stall as well (I just did on > my box, I got a soft lockup). I know this is a different problem. But, maybe, > there is a general solution for both issues: This is true. However, the single 100% bandwidth task problem can be solved by limiting the maximum bandwidth a single entity can ask for. Of course we can get again to a similar sort of problem if multiple entities are then co-scheduled on the same CPU, for which we would need (residual) capacity awareness. This should happen less likely though, as there is a general tendency to spread tasks. > For instance, if the sum of the execution time of all "task" with priority > higher than the OTHER class (rt, dl, stop_machine, IRQs, NMIs, Hypervisor?) in a > CPU is higher than rt_runtime in the rt_period, we need to avoid what is > "avoidable" by trying to move rt and dl threads away from that CPU. Another > possibility is to bump the priority of the OTHER class (and we are back to the > DL server). Kind of weird though having to migrate RT (everything higher than OTHER) only to make some room for non-RT stuff. Also because one can introduce unwanted side effects on high prio workloads (cache related overheads, etc.). OTHER has also already have some knowledge about higher prio activities (rt,dl,irq PELT). So this seems to really leave us with affined tasks, of all priorities and kinds (real vs. irq). > > - Dude, would not be easy just changing the CBS? > > Yeah, but by changing the CBS, we may end up breaking the algorithms/properties > that rely on CBS... like GRUB, user-space/kernel-space synchronization... > > > OTOH, when something like you describe happens, guarantees are probably > > already out of the window and we should just do our best to at least > > keep the system "working"? (maybe only to warn the user that something > > bad has happened) > > Btw, don't get me wrong, I am not against changing CBS: I am just trying to > raise other viewpoints to avoid touching in the base of the DL scheduler, and > avoid punishing a thread that behaves well. > > Anyway, notifying that dl+rt+IRQ time is higher than the rt_runtime is another > good thing to do as well. We will be notified anyway, either by RCU or > softlockup... but they are side effects warning. By notifying that we have an > overload of rt or higher workload we will be pointing to the cause. Right. It doesn't solve the problem, but I guess it could help debugging.