From patchwork Tue Jan 17 17:27:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Faggioli X-Patchwork-Id: 9521593 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 EBEE06043D for ; Tue, 17 Jan 2017 17:29:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DDDFC285F1 for ; Tue, 17 Jan 2017 17:29:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D2F22285F7; Tue, 17 Jan 2017 17:29:05 +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 81AFC285F4 for ; Tue, 17 Jan 2017 17:29:05 +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 1cTXXP-0008JY-U6; Tue, 17 Jan 2017 17:27:15 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cTXXO-0008Ik-77 for xen-devel@lists.xenproject.org; Tue, 17 Jan 2017 17:27:14 +0000 Received: from [85.158.139.211] by server-4.bemta-5.messagelabs.com id 62/E4-25360-1F35E785; Tue, 17 Jan 2017 17:27:13 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrPIsWRWlGSWpSXmKPExsXiVRvkrPshuC7 C4MJVc4vvWyYzOTB6HP5whSWAMYo1My8pvyKBNePk9dyCE/wV245vYmtgfM3dxcjFISQwk1Hi 3dpPjCAOi8AaVokve38xgTgSApdYJVb2TGLpYuQEcmIkrvz4xwxhV0isvnuBFcQWElCRuLl9F RPEqBlMEvseH2cESQgL6EkcOfqDvYuRA8i2k7iwOQ0kzCZgIPFmx16wXhEBJYl7qyYzgZQwC+ hLrP7KAxJmEVCVmP23HWwKr4CPxJvLPYwgJZxA9quzkhBbvSX2Nl1gArFFBeQkVl5uYYUoF5Q 4OfMJC8RETYn1u/RBwswC8hLb385hnsAoMgtJ1SyEqllIqhYwMq9i1ChOLSpLLdI1NNFLKspM zyjJTczM0TU0MNXLTS0uTkxPzUlMKtZLzs/dxAgMfAYg2MF49rTnIUZJDiYlUd6Ox7URQnxJ+ SmVGYnFGfFFpTmpxYcYZTg4lCR4u4PqIoQEi1LTUyvSMnOAMQiTluDgURLhdQNJ8xYXJOYWZ6 ZDpE4x6nLs2nX5JZMQS15+XqqUOO8bkCIBkKKM0jy4EbB0cIlRVkqYlxHoKCGegtSi3MwSVPl XjOIcjErCvBzA5CLEk5lXArfpFdARTEBHXNepBjmiJBEhJdXAOCdy2gP7S1WxMS7CH++LZM92 11sv6Miv48sou6zX83wcg5zfzi1XbVa+Ezp21NyCkfP3wfxFa2SOlQmUuN6T/9LiILay02Gno JLLRa0XJY3z/B4bvZK8ufTr6r+vZu4pCT2tPOWOz+c/2sUJ/Cs3Tv8/zXhJrt+7mqSWw4vMvK 5P/RzZq78wWomlOCPRUIu5qDgRAPHJjNMCAwAA X-Env-Sender: raistlin.df@gmail.com X-Msg-Ref: server-6.tower-206.messagelabs.com!1484674032!80204559!1 X-Originating-IP: [74.125.82.67] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.1.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 64026 invoked from network); 17 Jan 2017 17:27:12 -0000 Received: from mail-wm0-f67.google.com (HELO mail-wm0-f67.google.com) (74.125.82.67) by server-6.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 17 Jan 2017 17:27:12 -0000 Received: by mail-wm0-f67.google.com with SMTP id d140so23650585wmd.2 for ; Tue, 17 Jan 2017 09:27:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:from:to:cc:date:message-id:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=HNxk9e1CzXpn4UWZIV5f023YMei2UFwm+Q4spK9fVh8=; b=fbYPr1RLt/CJWkDDtQm33zl86Xw56hE7I+JeuzzjMc3U74U+378WdshjXtXXHsSvXt 1abdzopYc4V7uZqrzmOVv7/GA0lgX9TuiJcjb6ReMeI4VH1yuZsjX2f4bFL/yK1jP4YB I226Vbbf/yYKzGAsrj4/j2Un5DHV8Nif0CBG8eTbjoBicav031Tp/L8WKKXrUgq/DET1 NVr17EnXJk7S+8EHRkVN9IPKwEU+5b7QkDias3wtWL9GCvdUtm5bkRWR66V6dqNecRNc FFfsxmYB6saYwKyN1tPTMMSgUpQfJFI7Z7VGc5eVTpRRxxryICzQBkKgbLFzrE5OMJwX 3Xew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:from:to:cc:date:message-id :in-reply-to:references:user-agent:mime-version :content-transfer-encoding; bh=HNxk9e1CzXpn4UWZIV5f023YMei2UFwm+Q4spK9fVh8=; b=jph1pdasIy0P9aGHMAvI6kBONRNDvT6EEZWiS3HPwYlTCk0gs50wqMaz9a83z2mG87 40uKdoNr5rspaU6dCVqOKYecD5Nt62cPvyFtYGUslZOD0VaMZo8HZ6xUE1PaGKvoUQoT nbmNbMWgk1ZHufW9N4ifUVIRcVZfdhj0o+ytjx8UNtjPjF5YfCzQTqo6/+JWPxSDInS8 aD6f+H0u/da4itG48XZ6qaWzrVEA8NLvFY/v1hnAUa2aMkGQM2yBo0CkIjW6z98mNcsl /a/cqntXjDDc3uDrRyj5CZnCpOa6wJX3rLQxEiIrvUJ2DrWxmOtUowhYHIrqGxuzCvjD 9y0g== X-Gm-Message-State: AIkVDXIvnw9UOeXqRmpD+hES7xpd+qVNLjzQ2Nd51H2KgjABu4xDQltSvHhdahJIzeYXEQ== X-Received: by 10.28.69.202 with SMTP id l71mr7923849wmi.68.1484674032505; Tue, 17 Jan 2017 09:27:12 -0800 (PST) Received: from Solace.fritz.box (58-209-66-80.hosts.abilene.it. [80.66.209.58]) by smtp.gmail.com with ESMTPSA id l67sm31433199wmf.1.2017.01.17.09.27.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Jan 2017 09:27:11 -0800 (PST) From: Dario Faggioli To: xen-devel@lists.xenproject.org Date: Tue, 17 Jan 2017 18:27:10 +0100 Message-ID: <148467403070.27920.13927682504995274110.stgit@Solace.fritz.box> In-Reply-To: <148467379229.27920.2367500429219327194.stgit@Solace.fritz.box> References: <148467379229.27920.2367500429219327194.stgit@Solace.fritz.box> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Cc: George Dunlap Subject: [Xen-devel] [PATCH 5/5] xen: sched: simplify ACPI S3 resume path. 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 In fact, when domains are being unpaused: - it's not necessary to put the vcpu to sleep, as they are all already paused; - it is not necessary to call vcpu_migrate(), as the vcpus are still paused, and therefore won't wakeup anyway. Basically, the only important thing is to call pick_cpu, to let the scheduler run and figure out what would be the best initial placement (i.e., the value stored in v->processor), for the vcpus, as they come back up, one after another. Note that this is consistent with what was happening before this change, as vcpu_migrate() calls pick_cpu. But much simpler and quicker. Signed-off-by: Dario Faggioli Reviewed-by: George Dunlap --- Cc: George Dunlap --- xen/common/schedule.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/xen/common/schedule.c b/xen/common/schedule.c index bee5d1f..43b5b99 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -635,7 +635,11 @@ void restore_vcpu_affinity(struct domain *d) for_each_vcpu ( d, v ) { - spinlock_t *lock = vcpu_schedule_lock_irq(v); + spinlock_t *lock; + + ASSERT(!vcpu_runnable(v)); + + lock = vcpu_schedule_lock_irq(v); if ( v->affinity_broken ) { @@ -659,17 +663,11 @@ void restore_vcpu_affinity(struct domain *d) cpupool_domain_cpumask(v->domain)); v->processor = cpumask_any(cpumask_scratch_cpu(cpu)); - if ( v->processor == cpu ) - { - set_bit(_VPF_migrating, &v->pause_flags); - spin_unlock_irq(lock);; - vcpu_sleep_nosync(v); - vcpu_migrate(v); - } - else - { - spin_unlock_irq(lock); - } + spin_unlock_irq(lock);; + + lock = vcpu_schedule_lock_irq(v); + v->processor = SCHED_OP(VCPU2OP(v), pick_cpu, v); + spin_unlock_irq(lock); } domain_update_node_affinity(d);