From nobody Thu May 9 00:03:23 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1587547843; cv=none; d=zohomail.com; s=zohoarc; b=jiLzJZa5rwSSzMISGcnOtqMOaA6w4vNTIRZL86pOFfytDWy53P4Iy1T/mmyF2D5h+igUv54CojqPBHm9nVFL6+fqVq9pF1RSktNYdfPwWzrA/Xwl/JK3trWqUV0kW+Y3Rb4kMP7g4AqOk54+1JtPLIBD40quFFozvGzHf0maSJE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587547843; h=Content-Type:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=rRjX7GNQd8YBZWgjdb/0K0u20KWhdGKwGl4/Cdb4CPs=; b=NFeCfZS9z0aqX9WXgq1vtj6CeoHdIlP02bwnHgxmU2hpHA8PgfrhHjQT9/gnEOA/MLlAfEuUU8AivLKE6xEolqNT8dEwJ6sziqkE7YfpvFIMUcw/77lG+9dEGKEwdwPHfYFqGMqy5FMEqTaduOLytkVf+kQb3uieo8TklQRFWi4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) 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 1587547842946511.45792711492004; Wed, 22 Apr 2020 02:30:42 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jRBi6-0006X0-7g; Wed, 22 Apr 2020 09:30:26 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jRBi4-0006Wu-NG for xen-devel@lists.xenproject.org; Wed, 22 Apr 2020 09:30:24 +0000 Received: from esa4.hc3370-68.iphmx.com (unknown [216.71.155.144]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id e44e818c-847b-11ea-b4f4-bc764e2007e4; Wed, 22 Apr 2020 09:30:23 +0000 (UTC) X-Inumbo-ID: e44e818c-847b-11ea-b4f4-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1587547823; h=from:to:cc:subject:date:message-id:mime-version; bh=H1tzBodFfLZl2PzsVtHMvT84Jmeky0w/e8zXs1bdyBQ=; b=ZVnCvN7unU5aC7/dxaxoQwHEMvAP3pigyeOj4Lio0Zsn62F8EU26o3t4 jA5vW728D5z1uC0Lg9jvnRCWtfSzDks+sm/DEKsYE9HfV5EIincHGwcp9 Fdk+rZwdG1vV9zSWbl+RsLkXbw0PCVvwEZ+MPyNbB1B+gZGtWHPqeCZ+b 0=; Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=sergey.dyasli@citrix.com; spf=Pass smtp.mailfrom=sergey.dyasli@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa4.hc3370-68.iphmx.com: no sender authenticity information available from domain of sergey.dyasli@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="sergey.dyasli@citrix.com"; x-sender="sergey.dyasli@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa4.hc3370-68.iphmx.com: domain of sergey.dyasli@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="sergey.dyasli@citrix.com"; x-sender="sergey.dyasli@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa4.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="sergey.dyasli@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: vcc7NVwL3g0jnfCKRteDH5h5+L8cJyhUS5T0e7Wf+c8b0CI3CzKvYt7JbWDFX3jTKe33y89q70 0yUIJgVCkPo+xj1bBj1D6uG3RRyG5v9NdqY2E/DHncuqS6y9fu8sTTYqjVTBaYW5gcZUfFQbKN k67JkvhlyzioqmctBRopaFFxtyx5ipfrD0sZ5bXVPEyeK3c5YyqN6Ss9bBNXbjW5jM1hnYXqI/ N6RucdKo5fjhrogunF35QQIshgSH6YyPEeTAeRw1O96d7NPe5oXvKLvKhEZDHUpIiMoXpiFSJm O5I= X-SBRS: 2.7 X-MesageID: 16733751 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.72,413,1580792400"; d="scan'208";a="16733751" From: Sergey Dyasli To: Subject: [PATCH v3] sched: print information about scheduling granularity Date: Wed, 22 Apr 2020 10:30:10 +0100 Message-ID: <20200422093010.12940-1-sergey.dyasli@citrix.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Juergen Gross , Sergey Dyasli , George Dunlap , Jan Beulich , Dario Faggioli Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Currently it might be not obvious which scheduling mode (e.g. core- scheduling) is being used by the scheduler. Alleviate this by printing additional information about the selected granularity per-cpupool. Note: per-cpupool granularity selection is not implemented yet. Every cpupool gets its granularity from the single global value. Take this opportunity to introduce struct sched_gran_name array and refactor sched_select_granularity(). Signed-off-by: Sergey Dyasli --- v3: - use const char* - use sched_gran_name array instead of switch - updated commit message v2: - print information on a separate line - use per-cpupool granularity - updated commit message CC: Juergen Gross CC: Dario Faggioli CC: George Dunlap CC: Jan Beulich --- xen/common/sched/cpupool.c | 51 +++++++++++++++++++++++++++++++------- 1 file changed, 42 insertions(+), 9 deletions(-) diff --git a/xen/common/sched/cpupool.c b/xen/common/sched/cpupool.c index d40345b585..b60799a558 100644 --- a/xen/common/sched/cpupool.c +++ b/xen/common/sched/cpupool.c @@ -40,19 +40,50 @@ static DEFINE_SPINLOCK(cpupool_lock); static enum sched_gran __read_mostly opt_sched_granularity =3D SCHED_GRAN_= cpu; static unsigned int __read_mostly sched_granularity =3D 1; =20 +struct sched_gran_name { + enum sched_gran mode; + const char *name; +}; + +static const struct sched_gran_name sg_name[] =3D { + {SCHED_GRAN_cpu, "cpu"}, + {SCHED_GRAN_core, "core"}, + {SCHED_GRAN_socket, "socket"}, +}; + +static void sched_gran_print(enum sched_gran mode, unsigned int gran) +{ + const char *name =3D ""; + unsigned int i; + + for ( i =3D 0; i < ARRAY_SIZE(sg_name); i++ ) + { + if ( mode =3D=3D sg_name[i].mode ) + { + name =3D sg_name[i].name; + break; + } + } + + printk("Scheduling granularity: %s, %u CPU%s per sched-resource\n", + name, gran, gran =3D=3D 1 ? "" : "s"); +} + #ifdef CONFIG_HAS_SCHED_GRANULARITY static int __init sched_select_granularity(const char *str) { - if ( strcmp("cpu", str) =3D=3D 0 ) - opt_sched_granularity =3D SCHED_GRAN_cpu; - else if ( strcmp("core", str) =3D=3D 0 ) - opt_sched_granularity =3D SCHED_GRAN_core; - else if ( strcmp("socket", str) =3D=3D 0 ) - opt_sched_granularity =3D SCHED_GRAN_socket; - else - return -EINVAL; + unsigned int i; =20 - return 0; + for ( i =3D 0; i < ARRAY_SIZE(sg_name); i++ ) + { + if ( strcmp(sg_name[i].name, str) =3D=3D 0 ) + { + opt_sched_granularity =3D sg_name[i].mode; + return 0; + } + } + + return -EINVAL; } custom_param("sched-gran", sched_select_granularity); #endif @@ -115,6 +146,7 @@ static void __init cpupool_gran_init(void) warning_add(fallback); =20 sched_granularity =3D gran; + sched_gran_print(opt_sched_granularity, sched_granularity); } =20 unsigned int cpupool_get_granularity(const struct cpupool *c) @@ -911,6 +943,7 @@ void dump_runq(unsigned char key) { printk("Cpupool %d:\n", (*c)->cpupool_id); printk("Cpus: %*pbl\n", CPUMASK_PR((*c)->cpu_valid)); + sched_gran_print((*c)->gran, cpupool_get_granularity(*c)); schedule_dump(*c); } =20 --=20 2.17.1