From patchwork Tue Nov 22 10:43:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Faggioli X-Patchwork-Id: 9440797 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 A02E8600BA for ; Tue, 22 Nov 2016 10:45:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 841EB284D9 for ; Tue, 22 Nov 2016 10:45:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 77887284DB; Tue, 22 Nov 2016 10:45:55 +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 CE959284D9 for ; Tue, 22 Nov 2016 10:45:52 +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 1c98YD-00013K-8d; Tue, 22 Nov 2016 10:43:45 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c98YB-000136-De for xen-devel@lists.xenproject.org; Tue, 22 Nov 2016 10:43:43 +0000 Received: from [85.158.139.211] by server-11.bemta-5.messagelabs.com id 72/35-09407-E5124385; Tue, 22 Nov 2016 10:43:42 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrDIsWRWlGSWpSXmKPExsVyMfTSId0oRZM Ig713eC2+b5nM5MDocfjDFZYAxijWzLyk/IoE1oznn56xFbwWruie38DUwLhAoIuRi0NIYDqj xPFDDxhBHBaBqawSi/sXgTkSAhtZJc7/usrWxcgJ5MRIrGvuYYGwqyX+LpwMZgsJqEjc3L6KC WLUL0aJvidPGEESwgJ6EkeO/mCHsD0l5u8/ATaITcBA4s2OvawgtoiAksS9VZOZQGxmAW+Jj/ sagWo4gM5QlXg+2RskzAsU/jPtC9guUQE5iZWXW1gh4oISJ2c+YQEpZxbQlFi/Sx9iirzE9rd zmCcwCs1CUjULoWoWkqoFjMyrGDWKU4vKUot0jQz0kooy0zNKchMzc3QNDUz1clOLixPTU3MS k4r1kvNzNzECw7megYFxB2PjbL9DjJIcTEqivIeXGkUI8SXlp1RmJBZnxBeV5qQWH2LU4OAQm HB27nQmKZa8/LxUJQleRQWTCCHBotT01Iq0zBxgxMGUSnDwKInw8oKkeYsLEnOLM9MhUqcYjT lefXjxgImj48OHB0xCYJOkxHktQEoFQEozSvPgBsESwSVGWSlhXkYGBgYhnoLUotzMElT5V4z iHIxKwrzyIFN4MvNK4Pa9AjqFCegUyW/GIKeUJCKkpBoY7Z/q6cq93pQ3tfik40EXqyWX1KWC d2xvCdZeyC50dkIKz/MXYYWPvBS6mzy5Y5lkjy59OJUvIGoJQ8h88Ydqz24znPC1txG1FHww4 e06+xm7zpfNuvEznYN19v74IzfZmQR92p/WNU68XDdp6xGxGINNLy1dNL++vvyhbNmDrzaSno e3xu+7rcRSnJFoqMVcVJwIAOJdpQT/AgAA X-Env-Sender: raistlin.df@gmail.com X-Msg-Ref: server-9.tower-206.messagelabs.com!1479811417!71663336!1 X-Originating-IP: [209.85.210.194] 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 15745 invoked from network); 22 Nov 2016 10:43:37 -0000 Received: from mail-wj0-f194.google.com (HELO mail-wj0-f194.google.com) (209.85.210.194) by server-9.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 22 Nov 2016 10:43:37 -0000 Received: by mail-wj0-f194.google.com with SMTP id f8so5960874wje.2 for ; Tue, 22 Nov 2016 02:43:38 -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=hcTtYuyz3Cr/1uHP91CQ4IMM10Jfn1wl4RaXDhm2a0I=; b=x3AxAGFqBYXL9WrRhKN00OFjvB8JHyNUKv+gZBfdLY8dubTKmvbmDA26uVfvonm3dI kJY5NhcuTt+PpF93wOf+sQGmKysnY7NUPG+S3PI0ZGvuecDDZHFOZxTHkV1Ekwq0H/fw 7lqjY+KCFGayYW9Dbp/893FATO5wuuun1pw8MARK4DCfneaL2K3LPiulu4Fw8z2MvRFe nS/+h30oaluMRcDHPknb2tvEIpeLzpm2bey8YRYi+RtDD3iJIdodWpyiKvbPevliWcR9 FV60xE8hme71SCTY4uro1FvGEUPBHIuw4M/wBEzhHtEjejPNqaYTEvdoBLL/KpuOeJ0I NjkA== 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=hcTtYuyz3Cr/1uHP91CQ4IMM10Jfn1wl4RaXDhm2a0I=; b=B3/0vxC4/IRqWx01kNbXsUAqNRzbhLghd4G5QJfBrGilMcQ1fWCbSDUQo7V6pn/pJc oFGHherjZ/PNULjtJ9yRsF7ox1PhsJPlSxx+JXBQ1hChI/qtje/6RrX9WNQK1NGSsHW+ uvhhHQc7ExG///tCbt9JS6VIFULvS6YNPBb6gMy8UWnJJnt+bCFpxi1DoPmYw2cO63yX vsfmyusvsUv9VYk58JoiU0Ncwpwiet0+GV8cMI9P6A1sU9jmpkf3Ofnmwxfkkxg0oDYz Pl+CwMJp1MyNIgOefzGre1jszhOiBJAKghNR+0Y2wi2nHPRjtL8A8Tv0Qcx6o0a6V21I i3UQ== X-Gm-Message-State: AKaTC00OWKd1MRGWPypMjJ+vEjVfSIBdR4a1yh7R1LigNKykeoAm8pg3eRQ611j1GWm2Dw== X-Received: by 10.194.222.169 with SMTP id qn9mr13280460wjc.62.1479811417750; Tue, 22 Nov 2016 02:43:37 -0800 (PST) Received: from Solace.fritz.box ([80.66.223.24]) by smtp.gmail.com with ESMTPSA id pd2sm30098001wjb.31.2016.11.22.02.43.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Nov 2016 02:43:37 -0800 (PST) From: Dario Faggioli To: xen-devel@lists.xenproject.org Date: Tue, 22 Nov 2016 11:43:35 +0100 Message-ID: <147981141529.15399.3103284119825700755.stgit@Solace.fritz.box> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Cc: Wei Liu , George Dunlap Subject: [Xen-devel] [for-4.8 PATCH] 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 --- xen/common/sched_credit2.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/xen/common/sched_credit2.c b/xen/common/sched_credit2.c index 1f26553..ac5ef7d 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); @@ -1032,6 +1037,8 @@ runq_tickle(const struct scheduler *ops, struct csched2_vcpu *new, s_time_t now) } } + ASSERT(ipid == -1 || !is_idle_vcpu(curr_on_cpu(ipid))); + /* * Only switch to another processor if the credit difference is * greater than the migrate resistance.