From patchwork Fri Jul 26 06:26:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Faggioli X-Patchwork-Id: 11060361 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C29991398 for ; Fri, 26 Jul 2019 06:27:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B2775205A9 for ; Fri, 26 Jul 2019 06:27:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A705E28A4F; Fri, 26 Jul 2019 06:27:26 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 440B5205A9 for ; Fri, 26 Jul 2019 06:27:26 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hqtgB-0003DW-7w; Fri, 26 Jul 2019 06:26:11 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hqtgA-0003D8-9K for xen-devel@lists.xenproject.org; Fri, 26 Jul 2019 06:26:10 +0000 X-Inumbo-ID: 413df3ca-af6e-11e9-8980-bc764e045a96 Received: from mx1.suse.de (unknown [195.135.220.15]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 413df3ca-af6e-11e9-8980-bc764e045a96; Fri, 26 Jul 2019 06:26:09 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 73B98AD31; Fri, 26 Jul 2019 06:26:08 +0000 (UTC) From: Dario Faggioli To: xen-devel@lists.xenproject.org Date: Fri, 26 Jul 2019 08:26:07 +0200 Message-ID: <156412236781.2385.9110155201477198899.stgit@Palanthas> In-Reply-To: <156412188377.2385.12588508835559819141.stgit@Palanthas> References: <156412188377.2385.12588508835559819141.stgit@Palanthas> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v2 4/4] xen: sched: refactor the ASSERTs around vcpu_deassing() X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: George Dunlap Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP It is all the time that we call vcpu_deassing() that the vcpu _must_ be assigned to a pCPU, and hence that such pCPU can't be free. Therefore, move the ASSERT-s which check for these properties in that function, where they belong better. Signed-off-by: Dario Faggioli Reviewed-by: George Dunlap --- xen/common/sched_null.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/xen/common/sched_null.c b/xen/common/sched_null.c index 1bbcaf92b9..c72335e5fa 100644 --- a/xen/common/sched_null.c +++ b/xen/common/sched_null.c @@ -368,6 +368,8 @@ static bool vcpu_deassign(struct null_private *prv, struct vcpu *v) struct null_vcpu *wvc; ASSERT(list_empty(&null_vcpu(v)->waitq_elem)); + ASSERT(per_cpu(npc, v->processor).vcpu == v); + ASSERT(!cpumask_test_cpu(v->processor, &prv->cpus_free)); per_cpu(npc, cpu).vcpu = NULL; cpumask_set_cpu(cpu, &prv->cpus_free); @@ -529,9 +531,6 @@ static void null_vcpu_remove(const struct scheduler *ops, struct vcpu *v) goto out; } - ASSERT(per_cpu(npc, v->processor).vcpu == v); - ASSERT(!cpumask_test_cpu(v->processor, &prv->cpus_free)); - vcpu_deassign(prv, v); out: