From nobody Mon Feb 9 20:46:00 2026 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1568198046; cv=none; d=zoho.com; s=zohoarc; b=LimDtAT8q6GY61gA4GoFHAPAn3bRU2ouh1zyFDMAvgnfWpqkvu30Wom0VNjNnNGDRnmijk2tHuEoBmV7ZXmuAJE1ECr3l5EE1lc6ZvWaaaDUZSTkY+0Dtv+FgQt9WEzRhEhf9amLW3yA4bMP62ej73NAQcMhR4kfWAzoTqqc4Xs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568198046; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=WOTRTleAxDNNUCZzt1aKf7zuM+ZvERH4y1Ayl0d4tEg=; b=D0NOWdobYFxfCWKpULTWY3x+tiOY66JFDb+cf3r28owinNKpdpEKzCdTq/F4U1xFcC1KNiz95LK6jeSy+c8S00UJrTwZpvaR5/FYoSebWE8nXgX0pWvLRSCGhk1eA1HSVRCB0+TXK4OeXCTK2WpZnBLCedQVgO+WHiZZwM1ENIg= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1568198046648534.6329977678579; Wed, 11 Sep 2019 03:34:06 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1i7zvx-0000Q7-Ta; Wed, 11 Sep 2019 10:33:09 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1i7zvw-0000P1-AV for xen-devel@lists.xenproject.org; Wed, 11 Sep 2019 10:33:08 +0000 Received: from mail-lj1-x244.google.com (unknown [2a00:1450:4864:20::244]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 7a46ec36-d47f-11e9-b299-bc764e2007e4; Wed, 11 Sep 2019 10:32:39 +0000 (UTC) Received: by mail-lj1-x244.google.com with SMTP id u14so19450744ljj.11 for ; Wed, 11 Sep 2019 03:32:39 -0700 (PDT) Received: from aanisov-work.kyiv.epam.com (ll-74.141.223.85.sovam.net.ua. [85.223.141.74]) by smtp.gmail.com with ESMTPSA id w27sm4585275ljd.55.2019.09.11.03.32.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Sep 2019 03:32:37 -0700 (PDT) X-Inumbo-ID: 7a46ec36-d47f-11e9-b299-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=D1tmQx4QQQTXiGm/taYp9ljWrLsYP/6Sdp2V1mTvY5Q=; b=mkSkUftQESBwTE4pIFjxK9nOfDpujozkVjuwu1pLch7xAXRF/bECdIU1TZyHk5wChg UOWQlOXQPb+UjPLj1fcfEKamv9s8PynMB/StH3U1vRP3AVaxbIt6pFCra/d5IR0oaQ7N y1dARxwpsAU8HA4wOmcyUrXnodrkPo2Z2BlzebyvDBGOSb5pOKWcckzW0t2j7WZ1hVT7 R0m8q0eaAzywezFAe9j1YCCFj/MzugvLzL2bEl1hD7r+TQXlb1Z6aydmgpSAnAFAVSFH 4ybJJfc3bCZccsg+w7QQKvZRgQdFcaChtvEEeXHp1GLQq+AB+t2h01uvp+cZrj+uefcl dLTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=D1tmQx4QQQTXiGm/taYp9ljWrLsYP/6Sdp2V1mTvY5Q=; b=Gi0uxWIXJRxiLsFeowNR8QaCk/ZcT1BtiEG0h9rrZLOUU8AtRKatA5tq85Y/B457TX GSAEGcWY6QaHXIn52YV45MESDIi6t9t589qYFQunRgHe/5lMYFuqrPiw6TGQCQUURhN4 dk84kLfOtbKFMUU6oF+JqELdjN/UP8cYBrvJT99dmF2eI47erFfP2buIWNwjR+jDV+iI 9H9yU+V2/D8ZSDA4NEDvsjbdUSKCSVbqMWNMBnBBaFW5DShDKhh8gcHiwiJClCpdnXvC vmX8mXh2R3rjThzcxUC9eYjF14RBiZfqk6dSW8YvVi+ZXCyAsWO2wX+Ut2YdNuKOSJpG Ur3w== X-Gm-Message-State: APjAAAUNA9baGP0Pw155WKcVU6WkOAm9+rc2Lp4h3KsxRqPw4WdNmUXY R1d+k5tH2c9GYhBGHP8r6zkenr/m40U= X-Google-Smtp-Source: APXvYqzHZOS70e5XAk+zkJW0cCEdc6izNMK3UieVBImeIDCwGtsLRl0Oq/AKUp5DG3TGajQ0KAUjAw== X-Received: by 2002:a2e:504f:: with SMTP id v15mr23161379ljd.67.1568197957942; Wed, 11 Sep 2019 03:32:37 -0700 (PDT) From: Andrii Anisov To: xen-devel@lists.xenproject.org Date: Wed, 11 Sep 2019 13:32:21 +0300 Message-Id: <1568197942-15374-9-git-send-email-andrii.anisov@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1568197942-15374-1-git-send-email-andrii.anisov@gmail.com> References: <1568197942-15374-1-git-send-email-andrii.anisov@gmail.com> Subject: [Xen-devel] [RFC 8/9] sched:credit: get guest time from time accounting code 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: Stefano Stabellini , Andrii Anisov , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , Tim Deegan , Julien Grall , Jan Beulich , Dario Faggioli MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Andrii Anisov While the Credit scheduler code uses guest time from the other pcpu, we have to use locked time accounting. Signed-off-by: Andrii Anisov --- xen/common/Kconfig | 1 + xen/common/sched_credit.c | 12 +++++------- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/xen/common/Kconfig b/xen/common/Kconfig index c1748dd..d17a8b4 100644 --- a/xen/common/Kconfig +++ b/xen/common/Kconfig @@ -227,6 +227,7 @@ config TACC_NEEDS_LOCK config SCHED_CREDIT bool "Credit scheduler support" default y + select TACC_NEEDS_LOCK ---help--- The traditional credit scheduler is a general purpose scheduler. =20 diff --git a/xen/common/sched_credit.c b/xen/common/sched_credit.c index 81dee5e..ac6b9e6 100644 --- a/xen/common/sched_credit.c +++ b/xen/common/sched_credit.c @@ -324,16 +324,15 @@ runq_remove(struct csched_vcpu *svc) __runq_remove(svc); } =20 -static void burn_credits(struct csched_vcpu *svc, s_time_t now) +static void burn_credits(struct csched_vcpu *svc, s_time_t delta) { - s_time_t delta; uint64_t val; unsigned int credits; =20 /* Assert svc is current */ ASSERT( svc =3D=3D CSCHED_VCPU(curr_on_cpu(svc->vcpu->processor)) ); =20 - if ( (delta =3D now - svc->start_time) <=3D 0 ) + if ( delta <=3D 0 ) return; =20 val =3D delta * CSCHED_CREDITS_PER_MSEC + svc->residual; @@ -341,7 +340,6 @@ static void burn_credits(struct csched_vcpu *svc, s_tim= e_t now) credits =3D val; ASSERT(credits =3D=3D val); /* make sure we haven't truncated val */ atomic_sub(credits, &svc->credit); - svc->start_time +=3D (credits * MILLISECS(1)) / CSCHED_CREDITS_PER_MSE= C; } =20 static bool_t __read_mostly opt_tickle_one_idle =3D 1; @@ -956,7 +954,7 @@ csched_vcpu_acct(struct csched_private *prv, unsigned i= nt cpu) /* * Update credits */ - burn_credits(svc, NOW()); + burn_credits(svc, tacc_get_guest_time_delta_vcpu(svc->vcpu)); =20 /* * Put this VCPU and domain back on the active list if it was @@ -1856,14 +1854,14 @@ csched_schedule( (unsigned char *)&d); } =20 - runtime =3D now - current->runstate.state_entry_time; + runtime =3D tacc_get_guest_time_delta(); if ( runtime < 0 ) /* Does this ever happen? */ runtime =3D 0; =20 if ( !is_idle_vcpu(scurr->vcpu) ) { /* Update credits of a non-idle VCPU. */ - burn_credits(scurr, now); + burn_credits(scurr, runtime); scurr->start_time -=3D now; scurr->last_sched_time =3D now; } --=20 2.7.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel