From: Ronald Rojas <ronladred@gmail.com>
To: xen-devel <xen-devel@lists.xen.org>,
Ian Jackson <ian.jackson@eu.citrix.com>,
Wei Liu <wei.liu2@citrix.com>,
George Dunlap <george.dunlap@citrix.com>,
George Dunlap <dunlapg@umich.edu>
Subject: [PATCH RFC 51/59] controller: Make and/or modify cpupools when possible
Date: Wed, 28 Dec 2016 20:14:44 -0500 [thread overview]
Message-ID: <1482974092-15891-51-git-send-email-ronladred@gmail.com> (raw)
In-Reply-To: <1482974092-15891-1-git-send-email-ronladred@gmail.com>
From: George Dunlap <george.dunlap@citrix.com>
Make it possible for schedbench to modify cpupools in order to satisfy
run constraints.
Make a "RunConfig" option which contains the name of the pool, the
scheduler, and the number of cpus. As with WorkerConfig, make these
automatically inherited from larger levels to smaller levels. This
makes it straightforward to allow arbitrary pool configurations in the
same plan.
Modify sample.bench to have a RunConfig entry at the top level
(instead of the WorkerConfig option). SimplePlan already sets
RunConfig.Scheduler, so the effect will be for each run to have all
three options set. (Punt on SimplePlan generating more complex
options for now.)
Change BenchmarkRun.Ready() to BenchmarkRun.Prep(), which will cause
the configuration in RunConfig to become true if possible. Empty
'Pool' element means the default pool (Pool-0). Always create the
cpupool if it's non-pool-0, destroying the current one if it exists.
If it is pool 0, just check if it matches, and skip if not.
(We could in theory modify cpupool 0, but push that for future work.)
Signed-off-by: George Dunlap <george.dunlap@citrix.com>
---
benchmark.go | 17 +++++-
run.go | 176 +++++++++++++++++++++++++++++++++++++++++++++++++++--------
2 files changed, 169 insertions(+), 24 deletions(-)
diff --git a/benchmark.go b/benchmark.go
index aecb574..bd513fd 100644
--- a/benchmark.go
+++ b/benchmark.go
@@ -67,7 +67,6 @@ func (l *WorkerConfig) PropagateFrom(g WorkerConfig) {
}
}
-
type WorkerSet struct {
Params WorkerParams
Config WorkerConfig
@@ -140,6 +139,21 @@ type BenchmarkRunData struct {
type RunConfig struct {
Scheduler string
+ Pool string
+ Cpus []int
+}
+
+// Propagate unset values from a higher level
+func (l *RunConfig) PropagateFrom(g RunConfig) {
+ if l.Pool == "" {
+ l.Pool = g.Pool
+ }
+ if l.Scheduler == "" {
+ l.Scheduler = g.Scheduler
+ }
+ if l.Cpus == nil {
+ l.Cpus = g.Cpus
+ }
}
type BenchmarkRun struct {
@@ -159,6 +173,7 @@ type BenchmarkPlan struct {
// Global options for workers that will be over-ridden by Run
// and WorkerSet config options
WorkerConfig `json:",omitempty"`
+ RunConfig RunConfig `json:",omitempty"`
Runs []BenchmarkRun `json:",omitempty"`
}
diff --git a/run.go b/run.go
index 1a753bc..2d0db01 100644
--- a/run.go
+++ b/run.go
@@ -156,34 +156,158 @@ func getCpuHz() (err error) {
return
}
-func (run *BenchmarkRun) Ready() (ready bool, why string) {
- // FIXME: Check WorkerType
- // Skip this run if it's not the scheduler we want
- if run.RunConfig.Scheduler != "" {
- var pool CpupoolInfo
- if run.WorkerConfig.Pool != "" {
- var found bool
- pool, found = Ctx.CpupoolFindByName(run.WorkerConfig.Pool)
- if !found {
- why = "cpupool error"
- return
- }
- } else {
- // xl defaults to cpupool 0
- plist := Ctx.ListCpupool()
- if len(plist) > 0 {
- pool = plist[0]
+// If the pool is specified, use that pool; otherwise assume pool 0.
+//
+// Unspecified schedulers match any pool; unspecifiend cpu lists match
+// any pool.
+//
+// If the pool exists and the scheduler and cpu lists match the pool,
+// carry on. (This is running the VMs in a pre-configured pool.)
+//
+// If the pool exists and either the scheduler or the cpus don't match
+// the pool, and this is pool 0, skip.
+//
+// TODO: If the scheduler matches but the cpus don't, modify the pool
+// by adding or removing cpus. (This can be done for Pool-0 as well.)
+//
+// If the pool is not Pool-0, and the scheduler doesn't match or the
+// pool doesn't exist, but there are no cpus, skip (because we don't
+// have enough information to create the pool).
+//
+// If the pool is not Pool-0, and either the scheduler or the cpus
+// don't match, and the cpus are specified, create the pool.
+func (run *BenchmarkRun) Prep() (ready bool, why string) {
+ var pool CpupoolInfo
+ poolPresent := false
+
+ // Generate the requested cpumap
+ var Cpumap Bitmap
+ if run.RunConfig.Cpus != nil {
+ fmt.Print("Run.Prep: Cpus: ")
+ printed := false
+ for _, i := range run.RunConfig.Cpus {
+ if printed {
+ fmt.Printf(",%d", i)
} else {
- why = "cpupool error"
- return
+ printed = true
+ fmt.Printf("%d", i)
+ }
+ Cpumap.Set(i)
+ }
+ fmt.Print("\n")
+ if Cpumap.IsEmpty() {
+ why = "Invalid (empty) cpumap"
+ return
+ }
+ }
+
+
+ if run.RunConfig.Pool == "" {
+ fmt.Printf("Run.Prep: No pool set, using 0\n")
+ pool = Ctx.CpupoolInfo(0)
+ poolPresent = true
+ } else {
+ pool, poolPresent = Ctx.CpupoolFindByName(run.RunConfig.Pool)
+ if poolPresent {
+ fmt.Printf("Run.Prep: Pool %s found, Poolid %d\n",
+ run.RunConfig.Pool, pool.Poolid)
+ } else {
+ fmt.Printf("Run.Prep: Pool %s not found\n")
+ }
+ }
+
+ schedMatches := true
+ if run.RunConfig.Scheduler != "" &&
+ poolPresent &&
+ pool.Scheduler.String() != run.RunConfig.Scheduler {
+ schedMatches = false;
+ }
+
+ cpuMatches := true
+ if run.RunConfig.Cpus != nil {
+ if !poolPresent {
+ cpuMatches = false
+ } else {
+ for i := 0; i <= pool.Cpumap.Max(); i++ {
+ if pool.Cpumap.Test(i) != Cpumap.Test(i) {
+ fmt.Printf("Prep: cpu %d: pool %v, want %v, bailing\n",
+ i, pool.Cpumap.Test(i), Cpumap.Test(i))
+ cpuMatches = false
+ break
+ }
}
}
+ }
+
+
+ // If we're using pool 0, and the scheduler or cpus don't
+ // match, bail; otherwise say we're ready.
+ if poolPresent && pool.Poolid == 0 {
+ if ! schedMatches {
+ why = "scheduler != "+run.RunConfig.Scheduler+", can't change"
+ return
+ }
- if pool.Scheduler.String() != run.RunConfig.Scheduler {
- why = "scheduler != "+run.RunConfig.Scheduler
- return
+ // TODO: Actually, we can modify pool 0; leave this until we want it.
+ if ! cpuMatches {
+ why = "Cpumap mismatch"
+ return
}
+
+ fmt.Printf("Prep: Poolid 0, sched and cpumap matches\n")
+ ready = true
+ return
}
+
+ // OK, we got here it
+ if run.RunConfig.Cpus == nil {
+ // No construction information; is the cpupool ready without it?
+ if !poolPresent {
+ why = "Pool not present, no pool construction information"
+ return
+ } else if !schedMatches {
+ why = "scheduler != "+run.RunConfig.Scheduler+", no pool construction information"
+ return
+ }
+
+ // Scheduler matches, pool present, cpus not
+ // specified, just go with it
+ ready = true
+ return
+ }
+
+ // OK, we have all the information we need to create the pool we want.
+ Scheduler := SchedulerCredit
+ err := Scheduler.FromString(run.RunConfig.Scheduler)
+ if err != nil {
+ why = "Invalid scheduler: "+run.RunConfig.Scheduler
+ return
+ }
+
+ // Destroy the pool if it's present;
+ if poolPresent {
+ err := Ctx.CpupoolDestroy(pool.Poolid)
+ if err != nil {
+ fmt.Printf("Trying to destroy pool: %v\n", err)
+ why = "Couldn't destroy cpupool"
+ return
+ }
+ }
+
+ // Free the cpus we need;
+ err = Ctx.CpupoolMakeFree(Cpumap)
+ if err != nil {
+ why = "Couldn't free cpus"
+ return
+ }
+
+ // And create the pool.
+ err, _ = Ctx.CpupoolCreate("schedbench", Scheduler, Cpumap)
+ if err != nil {
+ why = "Couldn't create cpupool"
+ return
+ }
+
ready = true
return
}
@@ -191,13 +315,18 @@ func (run *BenchmarkRun) Ready() (ready bool, why string) {
func (run *BenchmarkRun) Run() (err error) {
for wsi := range run.WorkerSets {
run.WorkerSets[wsi].Config.PropagateFrom(run.WorkerConfig)
+ if run.WorkerSets[wsi].Config.Pool == "" {
+ run.WorkerSets[wsi].Config.Pool = run.RunConfig.Pool
+ }
run.WorkerSets[wsi].Params.SetkHZ(CpukHZ)
+
}
Workers, err := NewWorkerList(run.WorkerSets, WorkerXen)
if err != nil {
fmt.Println("Error creating workers: %v", err)
return
+
}
report := make(chan WorkerReport)
@@ -272,7 +401,8 @@ func (plan *BenchmarkPlan) Run() (err error) {
r := &plan.Runs[i];
if ! r.Completed {
r.WorkerConfig.PropagateFrom(plan.WorkerConfig)
- ready, why := r.Ready()
+ r.RunConfig.PropagateFrom(plan.RunConfig)
+ ready, why := r.Prep()
if ready {
fmt.Printf("Running test [%d] %s\n", i, r.Label)
err = r.Run()
--
2.7.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-12-29 1:14 UTC|newest]
Thread overview: 67+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-29 1:13 [PATCH RFC 01/59] Initial controller framework Ronald Rojas
2016-12-29 1:13 ` [PATCH RFC 02/59] controller: Revamp communication structure Ronald Rojas
2016-12-29 1:13 ` [PATCH RFC 03/59] controller: Initial attempt to generalize process / vm creation Ronald Rojas
2016-12-29 1:13 ` [PATCH RFC 04/59] Controller: Move process worker into its own file Ronald Rojas
2016-12-29 1:13 ` [PATCH RFC 05/59] controller: Add WorkerParams argument to Init in Worker interface Ronald Rojas
2016-12-29 1:13 ` [PATCH RFC 06/59] Reorganize to enable "Dist" directory Ronald Rojas
2016-12-29 1:14 ` [PATCH RFC 07/59] controller: Introduce basic Xen functionality Ronald Rojas
2016-12-29 1:14 ` [PATCH RFC 08/59] controller: Exit after second SIGINT Ronald Rojas
2016-12-29 1:14 ` [PATCH RFC 09/59] controller: Refactor creation and stopping of workers into WorkerList methods Ronald Rojas
2016-12-29 1:14 ` [PATCH RFC 10/59] controller: First cut at BenchmarkParams Ronald Rojas
2016-12-29 1:14 ` [PATCH RFC 11/59] Refactor to move towards benchmark "plans" and data analysis Ronald Rojas
2016-12-29 1:14 ` [PATCH RFC 12/59] Basic 'report' functionality Ronald Rojas
2016-12-29 1:14 ` [PATCH RFC 13/59] Add GPL headers / COPYING file (v2 only) Ronald Rojas
2016-12-29 10:51 ` Wei Liu
2016-12-29 1:14 ` [PATCH RFC 14/59] benchmark: Store data in terms of worker sets and worker ids Ronald Rojas
2016-12-29 1:14 ` [PATCH RFC 15/59] controller: Move "running" code to a separate file Ronald Rojas
2016-12-29 1:14 ` [PATCH RFC 16/59] controller: Rename an element in BenchmarkRun to be more accurate Ronald Rojas
2016-12-29 1:14 ` [PATCH RFC 17/59] controller: Collect and display statistics on WorkerSets Ronald Rojas
2016-12-29 1:14 ` [PATCH RFC 18/59] controller: Add cpupool global config Ronald Rojas
2016-12-29 1:14 ` [PATCH RFC 19/59] Add basic libxl framework, get domain cpu_time Ronald Rojas
2016-12-29 1:14 ` [PATCH RFC 20/59] xenworker: Use libxl_domain_unpause rather than forking xl Ronald Rojas
2016-12-29 1:14 ` [PATCH RFC 21/59] Report utilization statistics Ronald Rojas
2016-12-29 1:14 ` [PATCH RFC 22/59] Use tsc for time rather than rumpkernel clock_gettime() Ronald Rojas
2016-12-29 1:14 ` [PATCH RFC 23/59] run: Don't collect results reported after command to stop guests is issued Ronald Rojas
2016-12-29 1:14 ` [PATCH RFC 24/59] report: Lots of changes Ronald Rojas
2016-12-29 1:14 ` [PATCH RFC 25/59] main: Change default workload to something a bit more extreme Ronald Rojas
2016-12-29 1:14 ` [PATCH RFC 26/59] Use kops rather than mops Ronald Rojas
2016-12-29 1:14 ` [PATCH RFC 27/59] report: Allow report verbosity to be specified Ronald Rojas
2016-12-29 1:14 ` [PATCH RFC 28/59] controller: Handle worker early death Ronald Rojas
2016-12-29 1:14 ` [PATCH RFC 29/59] report: Add basic html report Ronald Rojas
2016-12-29 1:14 ` [PATCH RFC 30/59] htmlreport: Include utilization scatterplots Ronald Rojas
2016-12-29 1:14 ` [PATCH RFC 31/59] Make a binary that can run reports on a system without libxl Ronald Rojas
2016-12-29 1:14 ` [PATCH RFC 32/59] controller: Allow specification of an input file Ronald Rojas
2016-12-29 1:14 ` [PATCH RFC 33/59] controller: Add verbosity argument and update README with new instructions Ronald Rojas
2016-12-29 1:14 ` [PATCH RFC 34/59] controller: Make a useful config file Ronald Rojas
2016-12-29 1:14 ` [PATCH RFC 35/59] libxl: Add ListCpupool Ronald Rojas
2016-12-29 1:14 ` [PATCH RFC 36/59] controller: Make 'dummy' at the level of 'run' rather than xenworker Ronald Rojas
2016-12-29 1:14 ` [PATCH RFC 37/59] libxl.go: Provide a single global context by default Ronald Rojas
2016-12-29 1:14 ` [PATCH RFC 38/59] controller: Allow multiple schedulers in the same benchmark file Ronald Rojas
2016-12-29 1:14 ` [PATCH RFC 39/59] libxl.go: Put common link flags in libxl.go Ronald Rojas
2016-12-29 1:14 ` [PATCH RFC 40/59] controller: Add / update GPL text Ronald Rojas
2016-12-29 1:14 ` [PATCH RFC 41/59] libxl.go: Link statically rather than dynamically Ronald Rojas
2016-12-29 1:14 ` [PATCH RFC 42/59] plan: Allow "templating" from other runs Ronald Rojas
2016-12-29 1:14 ` [PATCH RFC 43/59] libxl: Add bitmap support Ronald Rojas
2016-12-29 1:14 ` [PATCH RFC 44/59] libxl: Implement CpupoolCreate Ronald Rojas
2016-12-29 1:14 ` [PATCH RFC 45/59] libxl: Implement Destroy, Add/Remove operations Ronald Rojas
2016-12-29 1:14 ` [PATCH RFC 46/59] libxl: Reorganize bitmapGotoC Ronald Rojas
2016-12-29 1:14 ` [PATCH RFC 47/59] libxl: Reorganize code Ronald Rojas
2016-12-29 1:14 ` [PATCH RFC 48/59] libxl: Add Ctx.CheckOpen Ronald Rojas
2016-12-29 1:14 ` [PATCH RFC 49/59] libxl: Implement libxl_cpupool_info and Scheduler.FromString() Ronald Rojas
2016-12-29 1:14 ` [PATCH RFC 50/59] libxl: Fix Bitmap.Max(), make Test() / Clear() more robust Ronald Rojas
2016-12-29 1:14 ` Ronald Rojas [this message]
2016-12-29 1:14 ` [PATCH RFC 52/59] libxl: Implement Bitmap.String() Ronald Rojas
2016-12-29 1:14 ` [PATCH RFC 53/59] controller: Add WorkerConfig.SoftAffinity Ronald Rojas
2016-12-29 1:14 ` [PATCH RFC 54/59] controller/run: Add RunConfig.NumaDisable Ronald Rojas
2016-12-29 1:14 ` [PATCH RFC 55/59] plan: Make the matrix generation more programmatic Ronald Rojas
2016-12-29 1:14 ` [PATCH RFC 56/59] controller/plan: Add NumaDisable to SimpleMatrix Ronald Rojas
2016-12-29 1:14 ` [PATCH RFC 57/59] tools/blktap2: remove unused inclusion of sys/sysctl.l Ronald Rojas
2016-12-29 1:14 ` [PATCH RFC 58/59] remove irrelevant files from old repository Ronald Rojas
2016-12-29 1:14 ` [PATCH RFC 59/59] tools/xenlight: Create interface for xenlight info Ronald Rojas
2016-12-29 10:34 ` George Dunlap
2016-12-29 10:52 ` Wei Liu
2016-12-29 13:49 ` Ronald Rojas
2016-12-29 13:45 ` George Dunlap
2016-12-29 20:20 ` George Dunlap
2017-01-03 17:45 ` Ronald Rojas
2017-01-04 16:44 ` George Dunlap
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1482974092-15891-51-git-send-email-ronladred@gmail.com \
--to=ronladred@gmail.com \
--cc=dunlapg@umich.edu \
--cc=george.dunlap@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).