From patchwork Mon Sep 30 05:21:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SsO8cmdlbiBHcm/Dnw==?= X-Patchwork-Id: 11166007 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 10C7F16C1 for ; Mon, 30 Sep 2019 05:23:02 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EB42220815 for ; Mon, 30 Sep 2019 05:23:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EB42220815 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iEo86-0001wl-Ao; Mon, 30 Sep 2019 05:21:50 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iEo85-0001w9-BH for xen-devel@lists.xenproject.org; Mon, 30 Sep 2019 05:21:49 +0000 X-Inumbo-ID: 2e7d97d8-e342-11e9-bf31-bc764e2007e4 Received: from mx1.suse.de (unknown [195.135.220.15]) by localhost (Halon) with ESMTPS id 2e7d97d8-e342-11e9-bf31-bc764e2007e4; Mon, 30 Sep 2019 05:21:40 +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 30CD1AFF0; Mon, 30 Sep 2019 05:21:39 +0000 (UTC) From: Juergen Gross To: xen-devel@lists.xenproject.org Date: Mon, 30 Sep 2019 07:21:16 +0200 Message-Id: <20190930052135.11257-1-jgross@suse.com> X-Mailer: git-send-email 2.16.4 Subject: [Xen-devel] [PATCH v5 00/19] xen: add core scheduling support 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: Juergen Gross , Stefano Stabellini , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , Robert VanVossen , Tim Deegan , Julien Grall , Josh Whitehead , Meng Xu , Jan Beulich , Dario Faggioli , Volodymyr Babchuk , =?utf-8?q?Roger_Pau_Monn?= =?utf-8?q?=C3=A9?= MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Add support for core- and socket-scheduling in the Xen hypervisor. Via boot parameter sched-gran=core (or sched-gran=socket) it is possible to change the scheduling granularity from cpu (the default) to either whole cores or even sockets. All logical cpus (threads) of the core or socket are always scheduled together. This means that on a core always vcpus of the same domain will be active, and those vcpus will always be scheduled at the same time. This is achieved by switching the scheduler to no longer see vcpus as the primary object to schedule, but "schedule units". Each schedule unit consists of as many vcpus as each core has threads on the current system. The vcpu->unit relation is fixed. I have done some very basic performance testing: on a 4 cpu system (2 cores with 2 threads each) I did a "make -j 4" for building the Xen hypervisor. With This test has been run on dom0, once with no other guest active and once with another guest with 4 vcpus running the same test. The results are (always elapsed time, system time, user time): sched-gran=cpu, no other guest: 116.10 177.65 207.84 sched-gran=core, no other guest: 114.04 175.47 207.45 sched-gran=cpu, other guest: 202.30 334.21 384.63 sched-gran=core, other guest: 207.24 293.04 371.37 The performance tests have been performed with credit2, the other schedulers are tested only briefly to be able to create a domain in a cpupool. Cpupools have been moderately tested (cpu add/remove, create, destroy, move domain). Cpu on-/offlining has been moderately tested, too. The series is based on: "xen/sched: rework and rename vcpu_force_reschedule()" which has been split off from V2 and: "xen/sched: fix locking in a653sched_free_vdata()" which is fixing a problem detected via review of V3. The complete patch series (plus prereq patches and some debugging additions in form of additional patches) is available under: git://github.com/jgross1/xen/ sched-v5 Changes in V5: - dropped patches 1-27 as they already went in - added comments in 2 patches Changes in V4: - comments addressed - former patch 36 merged into patch 32 Changes in V3: - comments addressed - former patch 26 carved out and sent separately - some minor bugs fixed Changes in V2: - comments addressed - some patches merged into one - idle scheduler related patches split off to own series - some patches are already applied - some bugs fixed (e.g. crashes when powering off) Changes in V1: - cpupools are working now - cpu on-/offlining working now - all schedulers working now - renamed "items" to "units" - introduction of "idle scheduler" - several new patches (see individual patches, mostly splits of former patches or cpupool and cpu on-/offlining support) - all review comments addressed - some minor changes (see individual patches) Changes in RFC V2: - ARM is building now - HVM domains are working now - idling will always be done with idle_vcpu active - other small changes see individual patches Juergen Gross (19): xen/sched: add code to sync scheduling of all vcpus of a sched unit xen/sched: introduce unit_runnable_state() xen/sched: add support for multiple vcpus per sched unit where missing xen/sched: modify cpupool_domain_cpumask() to be an unit mask xen/sched: support allocating multiple vcpus into one sched unit xen/sched: add a percpu resource index xen/sched: add fall back to idle vcpu when scheduling unit xen/sched: make vcpu_wake() and vcpu_sleep() core scheduling aware xen/sched: move per-cpu variable scheduler to struct sched_resource xen/sched: move per-cpu variable cpupool to struct sched_resource xen/sched: reject switching smt on/off with core scheduling active xen/sched: prepare per-cpupool scheduling granularity xen/sched: split schedule_cpu_switch() xen/sched: protect scheduling resource via rcu xen/sched: support multiple cpus per scheduling resource xen/sched: support differing granularity in schedule_cpu_[add/rm]() xen/sched: support core scheduling for moving cpus to/from cpupools xen/sched: disable scheduling when entering ACPI deep sleep states xen/sched: add scheduling granularity enum xen/arch/arm/domain.c | 2 +- xen/arch/x86/Kconfig | 1 + xen/arch/x86/acpi/power.c | 4 + xen/arch/x86/domain.c | 26 +- xen/arch/x86/sysctl.c | 5 + xen/common/Kconfig | 3 + xen/common/cpupool.c | 232 ++++++-- xen/common/domain.c | 8 +- xen/common/domctl.c | 2 +- xen/common/sched_arinc653.c | 4 +- xen/common/sched_credit.c | 73 +-- xen/common/sched_credit2.c | 32 +- xen/common/sched_null.c | 11 +- xen/common/sched_rt.c | 18 +- xen/common/schedule.c | 1300 +++++++++++++++++++++++++++++++++-------- xen/common/softirq.c | 6 +- xen/include/asm-arm/current.h | 1 + xen/include/asm-x86/current.h | 19 +- xen/include/asm-x86/smp.h | 7 + xen/include/xen/sched-if.h | 86 ++- xen/include/xen/sched.h | 26 +- xen/include/xen/softirq.h | 1 + 22 files changed, 1504 insertions(+), 363 deletions(-)