From patchwork Tue Nov 22 12:51:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Faggioli X-Patchwork-Id: 9441017 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 419AB60235 for ; Tue, 22 Nov 2016 12:53:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3168C28524 for ; Tue, 22 Nov 2016 12:53:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2629A28528; Tue, 22 Nov 2016 12:53:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RCVD_IN_SORBS_SPAM,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D019628524 for ; Tue, 22 Nov 2016 12:53:26 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c9AXV-0000ox-Er; Tue, 22 Nov 2016 12:51:09 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c9AXT-0000or-O7 for xen-devel@lists.xenproject.org; Tue, 22 Nov 2016 12:51:07 +0000 Received: from [85.158.139.211] by server-4.bemta-5.messagelabs.com id 62/8F-22514-B3F34385; Tue, 22 Nov 2016 12:51:07 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrNIsWRWlGSWpSXmKPExsVyMfTGEV0re5M Ig8PXRCy+b5nM5MDocfjDFZYAxijWzLyk/IoE1owdz9+wF6wQqfi+dTZbA+NjgS5GLg4hgRmM Em+7mphAHBaBqawSl6a+ZwNxJAQ2skq0fz0FlOEEcmIkTq++CmRzANllEs+O1ICEhQRUJG5uX 8UEMekHo8TVj/vZQBLCAnoSR47+YIewfSQuPdrKAmKzCRhIvNmxlxXEFhFQkri3ajLYfGaBXI mzh/vBbBYBVYmHU6eB1fAC9X5qeQ02R1RATmLl5RaouKDEyZlPWEDuYRbQlFi/Sx9ijLzE9rd zmCcwCs1CUjULoWoWkqoFjMyrGNWLU4vKUot0LfSSijLTM0pyEzNzdA0NTPVyU4uLE9NTcxKT ivWS83M3MQKDmQEIdjAebHY+xCjJwaQkynt4qVGEEF9SfkplRmJxRnxRaU5q8SFGDQ4OgQln5 05nkmLJy89LVZLg/WhrEiEkWJSanlqRlpkDjDeYUgkOHiUR3ncgad7igsTc4sx0iNQpRmOOVx 9ePGDi6Pjw4QGTENgkKXHezyClAiClGaV5cINgaeASo6yUMC8j0JlCPAWpRbmZJajyrxjFORi VhHkN7YCm8GTmlcDtewV0ChPQKZLfjEFOKUlESEk1MGZF3+LmnLkt6Lt44SautbtzjrefdDl5 RE/L+MTRTTI8NyY6Xd7570+T+U7XW2JLn+wVlWm7z/tiv/ChZpEnbBWbGndWPZqQaZNh7JfwY 1eb3e3b1sv6H+27NfNvyql2GVGDCTeNrQ+EzbaMkqk8WyKj55e5RkbraMODiA/O9Z4yYas/+W g7JymxFGckGmoxFxUnAgA8cT4g/gIAAA== X-Env-Sender: raistlin.df@gmail.com X-Msg-Ref: server-8.tower-206.messagelabs.com!1479819065!71429620!1 X-Originating-IP: [209.85.216.196] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.0.16; banners=-,-,- X-VirusChecked: Checked Received: (qmail 65318 invoked from network); 22 Nov 2016 12:51:05 -0000 Received: from mail-qt0-f196.google.com (HELO mail-qt0-f196.google.com) (209.85.216.196) by server-8.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 22 Nov 2016 12:51:05 -0000 Received: by mail-qt0-f196.google.com with SMTP id l20so1961833qta.1 for ; Tue, 22 Nov 2016 04:51:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:from:to:cc:date:message-id:user-agent:mime-version :content-transfer-encoding; bh=RF2ycdWRQd9mVL+GzOuhbYWAyXU1YI/NFSBr3QxtwGA=; b=aGV7qe304QVBVvygHwJ4BIVJAisteDT2ezfZ77PZGh5+vSP3qx7ExKukXmFTcSLLex gu4+ZXKeeSDU8HziopqyPYOaW34MnenMAlB0Bf0QPRy7JukoxcpaTLafLdz8X6TzGu0b rKdnkNQkgehkVZLuSAWIkutGBMXgpVcEq89F5YEwJYJOONeY6l1HnK8GxlrT8OVwF7rY A7ILx5KDWmtNnANIUC+fDrXplz15xDrWy96/sfFdhhuTgi7r15wVp4GgyhDw3+1x3Yf6 2QBzQHsYldBNQJjGQLx/Dfd3IQHd+R2gxeTSEsjzAr0TrYx1xcfzw58CMlaznCd6LqUx JoRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:from:to:cc:date:message-id :user-agent:mime-version:content-transfer-encoding; bh=RF2ycdWRQd9mVL+GzOuhbYWAyXU1YI/NFSBr3QxtwGA=; b=fsFZb3+z9OAewntZtf90qGfIjc0+4YOfXxeThF+O4617qK7gAJkN5aJhfbS+cFI5xv +sDZ4nSva5tiX3z/8IX65yeYZLpfsATOaoZFrvq8SrkJr0iWqBz4J32wRtiR9ieu7jNN mWK+5Z+qgAZ0fgv5wvB197QmZLapTpDsgCFmu7OuCFYYfnS6MYgZ6Lz03UNrEL7C18Vy qoMKmykM+3nLR1UpAASjwjjTY6nn9CSig4KqjdhnxQ9aGg7BEsQpos4PWwZnNoNy2zhi eY47NN3fkEpngg5gXbsl1sirTbDu/QkTBfZQ1d+FQinRa6T/NUWjtumE8ICAHkkYa6BC mzyA== X-Gm-Message-State: AKaTC00+zcbL3iMIbSBioTRCSlpKfwohlFazYCls19fFAvdB54igK2hjwqoqw67uT/5XOA== X-Received: by 10.28.49.3 with SMTP id x3mr2224630wmx.121.1479819064957; Tue, 22 Nov 2016 04:51:04 -0800 (PST) Received: from Solace.fritz.box ([80.66.223.24]) by smtp.gmail.com with ESMTPSA id d64sm2836264wmh.3.2016.11.22.04.51.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Nov 2016 04:51:04 -0800 (PST) From: Dario Faggioli To: xen-devel@lists.xenproject.org Date: Tue, 22 Nov 2016 13:51:02 +0100 Message-ID: <147981906281.19181.14128282832689294852.stgit@Solace.fritz.box> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Cc: Wei Liu , George Dunlap , Jan Beulich Subject: [Xen-devel] [for-4.8 PATCH v2] xen: credit2: fix wrong assert in runq_tickle(). X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Since b047f888d489 ("xen: sched: leave CPUs doing tasklet work alone") a cpu executing a tasklet, is not marked as idle. Therefore: - avoid asserting that we can't find the idle vcpu running on one of them, which is not true, - avoid triggering a preemption on them (and add an assert checking that). This fixes a bug identified by OSSTest, in flight 102372 (on ARM, but it's not at all ARM specific), where the ASSERT() was triggering like this: (XEN) Xen call trace: (XEN) [<0022af78>] sched_credit2.c#runq_tickle+0x3e8/0x61c (PC) (XEN) [<0022aedc>] sched_credit2.c#runq_tickle+0x34c/0x61c (LR) (XEN) [<0022b644>] sched_credit2.c#csched2_context_saved+0x128/0x1a4 (XEN) [<0023303c>] context_saved+0x7c/0xa4 (XEN) [<0024f660>] domain.c#schedule_tail+0x2b4/0x308 (XEN) [<0024faac>] context_switch+0x80/0x94 (XEN) [<0022ff48>] schedule.c#schedule+0x76c/0x7ec (XEN) [<002338d4>] softirq.c#__do_softirq+0xcc/0xec (XEN) [<00233968>] do_softirq+0x18/0x28 (XEN) [<00261084>] leave_hypervisor_tail+0x58/0x88 (XEN) [<002649d0>] entry.o#return_to_guest+0xc/0xb8 (XEN) (XEN) **************************************** (XEN) Panic on CPU 1: (XEN) Assertion '!is_idle_vcpu(cur->vcpu)' failed at sched_credit2.c:1009 (XEN) **************************************** Signed-off-by: Dario Faggioli Reviewed-by: Jan Beulich --- Cc: George Dunlap Cc: Wei Liu --- Changes from v1: * ASSERT() moved down, as suggested during review. --- xen/common/sched_credit2.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/xen/common/sched_credit2.c b/xen/common/sched_credit2.c index 1f26553..c2c563d 100644 --- a/xen/common/sched_credit2.c +++ b/xen/common/sched_credit2.c @@ -1006,7 +1006,12 @@ runq_tickle(const struct scheduler *ops, struct csched2_vcpu *new, s_time_t now) cur = CSCHED2_VCPU(curr_on_cpu(i)); - ASSERT(!is_idle_vcpu(cur->vcpu)); + /* + * Even if the cpu is not in rqd->idle, it may be running the + * idle vcpu, if it's doing tasklet work. Just skip it. + */ + if ( is_idle_vcpu(cur->vcpu) ) + continue; /* Update credits for current to see if we want to preempt. */ burn_credits(rqd, cur, now); @@ -1042,6 +1047,7 @@ runq_tickle(const struct scheduler *ops, struct csched2_vcpu *new, s_time_t now) return; } + ASSERT(!is_idle_vcpu(curr_on_cpu(ipid))); SCHED_STAT_CRANK(tickled_busy_cpu); tickle: BUG_ON(ipid == -1);