From nobody Mon May 6 03:33:53 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=1588759273; cv=none; d=zohomail.com; s=zohoarc; b=PbaeWVf12jnytiKc5WBrc/grCtnI2dGnM/hQgDKvsZr2Scu1R0r0ZSMOdJRp36FSIA49HFMTHvXVTf/5geI+zImN11PaU4u+gKvkBRKGJnfLBs7Pg1j1wAxz5iCMjVlvnG53UYz7/RokgTNAcT2n0KGhkF3r2IgC5Verp69ntqo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588759273; h=Content-Type:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=/RwE1Mpwr2SQdXJPnZEJOfU5v5iftLnG2CpWxUKFYd0=; b=Xfqyqm85MX9YHqJOEcKgf6AJ54OXiBti30Ji7AIahohzXsmc0YZQgLPrOOonWfE7E4qfhHHe16+znzO7SLQWX43XWI4spgTMTK4JC21AX1fFcqTTBkrUmYxNzXZRBWyPmTJs4DjJ3g5OHvfWQ8o+tiOXvf9e4OLdLflYdvlVEp4= 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 1588759273219976.8882180614858; Wed, 6 May 2020 03:01:13 -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 1jWGqz-0002AB-Pr; Wed, 06 May 2020 10:00:37 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jWGqy-0002A6-E2 for xen-devel@lists.xenproject.org; Wed, 06 May 2020 10:00:36 +0000 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 6d71ac5a-8f80-11ea-9e2f-12813bfff9fa; Wed, 06 May 2020 10:00:35 +0000 (UTC) X-Inumbo-ID: 6d71ac5a-8f80-11ea-9e2f-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1588759235; h=from:to:cc:subject:date:message-id:mime-version; bh=VEHvrNdna954yOi6N0z6Tc4Wo5AXNtDxRKBvEml7kTc=; b=cbOEilXB9+3pBBG4NT5xnXz5/vkBSzNeGLEv1HRMFpTh12hitIulIoOj 6JjmNVW+1xAmH8Str78M4rPq27ZyuW1Bo422xQl4E68fY9psPzvduMz3l Ec1pg502Bd97H4ojoHMIs44IPt1ILG0hdFYCDZb3MvqWM0/ozvWcjhQbQ w=; Authentication-Results: esa1.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 (esa1.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=esa1.hc3370-68.iphmx.com; envelope-from="sergey.dyasli@citrix.com"; x-sender="sergey.dyasli@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa1.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=esa1.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 (esa1.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=esa1.hc3370-68.iphmx.com; envelope-from="sergey.dyasli@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: boEVyDM4bTUastmKGN5ISboGEULGiFlWhpfVdliKwfx348M754JSoXHT597CA5tSng11X+70sX 1JYVG9MyIkwe58nVBX2ByB2Qltj/QoyNOnPL2tZ1Fo7evp71qDws/pM4izodaBm5erNDhJO8Zg X96JAQie/0/cWy9qy0Rh2Ml+F/pdIQNaqrJoXN9iYmb2SJm7Rp79jHrbDOvXelhweQisbIeafS Gpd8uIB0UGZqm4A4fe0Gxb1MbPwQuaJj/ZhAUGpuO1C0HaTragqqpNV2HT8NPI6+w5v/pCLzmH w3o= X-SBRS: 2.7 X-MesageID: 17114949 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.73,358,1583211600"; d="scan'208";a="17114949" From: Sergey Dyasli To: Subject: [PATCH v4] sched: print information about scheduling granularity Date: Wed, 6 May 2020 11:00:24 +0100 Message-ID: <20200506100024.17387-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 Acked-by: Dario Faggioli --- v4: - use char[8] 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..97c2d5b3c1 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; + char name[8]; +}; + +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