Path: csiph.com!news.freedyn.net!aioe.org!bofh.it!news.nic.it!robomod From: luca abeni Newsgroups: linux.kernel Subject: Re: [PATCH 1/2] sched/deadline: add per rq tracking of admitted bandwidth Date: Thu, 11 Feb 2016 13:50:02 +0100 Message-ID: References: X-Original-To: Juri Lelli Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unitn-it.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :organization:mime-version:content-type:content-transfer-encoding; bh=PCp07V9cLxecEPY8LCbbLSTyrZNYX3EbNCR2FFEFXTI=; b=ygI/IMxjvGPDBrWwZsczvXmXp5249ebLS2B0fWYkGY0yTWFkhj88dqLvfhjCITxHP8 JX9VKDUQd3Yotm4EaasmCIs3GNEHN0SxFk+DVdLsqAdG7+zcCYQrqTcWREzvayQvIr5e 2WRiZg6U2Eb+OEFzJxaFmZiAinzx/XRxjkav2aJoGCi/hmeNNaaptS4zZc6fX+B15FbL 3/EB5tYvVM5Y+rf/bJ/03jzlIpHukinzyMNTEtCpayeW7fKPGwdPMEbhkryvPF3KwSGR QhTLuynhxxlKAYMZDbhNIUATC3at4s+gfVh10DkxnXdl1tc5ucBSMCGnccrytYvMmMM3 /CQw== X-Google-Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:organization:mime-version:content-type :content-transfer-encoding; bh=PCp07V9cLxecEPY8LCbbLSTyrZNYX3EbNCR2FFEFXTI=; b=ZKwygD3HDxixlVMHCkt3H3GQETOB2eobPvzcUsUUDjU8uEwtWnsxqJ19RWHdQTMaSN E4+OeCW+Ub1X4JOGmS+kTz5fl2HCnzr+5VAHGGK3BUpdH/wacwlW6+uXlJn5Q6g4J/i3 ZyVKn3BQpmmhshyxhwZ8AVP2vgd6Z+Gt6hFgVaUeGVZW5lxgm75M0lXiQU/Z6kdCvx6c 8clmSuobvhZVFJSVPF9Hsqt7jb3+GeFsTNv0izj4IP0Qs4gKXGf6zdKmS+JD3cdyQvfV FSuMM2//IVvpd/VRYAgFHzlT6ZS30avDs+AZSogVU0IKf7XVmprGLp99ErfRk5qBNG9k CEcA== X-Gm-Message-State: AG10YOS7J23hr2MDqkNX2ETpBVmDKAe2lEGcZD04ndRKS2kzK6PwVoawiEGn0RPMkAWV1bkC X-Received: by 10.194.103.2 with SMTP id fs2mr53893827wjb.36.1455194424191; Thu, 11 Feb 2016 04:40:24 -0800 (PST) Organization: university of trento X-Mailer: Claws Mail 3.12.0 (GTK+ 2.24.28; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: robomod@news.nic.it List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Approved: robomod@news.nic.it Lines: 66 X-Original-Cc: Steven Rostedt , linux-kernel@vger.kernel.org, peterz@infradead.org, mingo@redhat.com, vincent.guittot@linaro.org, wanpeng.li@hotmail.com X-Original-Date: Thu, 11 Feb 2016 13:40:18 +0100 X-Original-Message-ID: <20160211134018.6b15fd68@utopia> X-Original-References: <1454935531-7541-1-git-send-email-juri.lelli@arm.com> <1454935531-7541-2-git-send-email-juri.lelli@arm.com> <20160210113258.GX11415@e106622-lin> <20160210093702.10c655be@gandalf.local.home> <20160210162748.GI11415@e106622-lin> <20160211121257.GL11415@e106622-lin> <20160211132254.1a369fe9@utopia> <20160211122754.GN11415@e106622-lin> X-Original-Sender: linux-kernel-owner@vger.kernel.org Xref: csiph.com linux.kernel:1331922 On Thu, 11 Feb 2016 12:27:54 +0000 Juri Lelli wrote: > On 11/02/16 13:22, Luca Abeni wrote: > > Hi Juri, > > > > On Thu, 11 Feb 2016 12:12:57 +0000 > > Juri Lelli wrote: > > [...] > > > I think we still have (at least) two problems: > > > > > > - select_task_rq_dl, if we select a different target > > > - select_task_rq might make use of select_fallback_rq, if > > > cpus_allowed changed after the task went to sleep > > > > > > Second case is what creates the problem here, as we don't update > > > task_rq(p) and fallback_cpu ac_bw. I was thinking we might do so, > > > maybe adding fallback_cpu in task_struct, from > > > migrate_task_rq_dl() (it has to be added yes), but I fear that we > > > should hold both rq locks :/. > > > > > > Luca, did you already face this problem (if I got it right) and > > > thought of a way to fix it? I'll go back and stare a bit more at > > > those paths. > > In my patch I took care of the first case (modifying > > select_task_rq_dl() to move the utilization from the "old rq" to the > > "new rq"), but I never managed to trigger select_fallback_rq() in my > > tests, so I overlooked that case. > > > > Right, I was thinking to do the same. And you did that after grabbing > both locks, right? Not sure if I did everything correctly, but my code in select_task_rq_dl() currently looks like this (you can obviously ignore the "migrate_active" and "*_running_bw()" parts, and focus on the "*_rq_bw()" stuff): [...] if (rq != cpu_rq(cpu)) { int migrate_active; raw_spin_lock(&rq->lock); migrate_active = hrtimer_active(&p->dl.inactive_timer); if (migrate_active) { hrtimer_try_to_cancel(&p->dl.inactive_timer); sub_running_bw(&p->dl, &rq->dl); } sub_rq_bw(&p->dl, &rq->dl); raw_spin_unlock(&rq->lock); rq = cpu_rq(cpu); raw_spin_lock(&rq->lock); add_rq_bw(&p->dl, &rq->dl); if (migrate_active) add_running_bw(&p->dl, &rq->dl); raw_spin_unlock(&rq->lock); } [...] lockdep is not screaming, and I am not able to trigger any race condition or strange behaviour (I am currently at more than 24h of continuous stress-testing, but maybe my testcase is not so good in finding races here :) Luca